[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-16 Thread theeshallnotknowethme


Change by theeshallnotknowethme :


--
type:  -> performance

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-16 Thread theeshallnotknowethme


Change by theeshallnotknowethme :


--
keywords: +patch
pull_requests: +28831
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30628

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-16 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

Note that `n` should not be over PY_SSIZE_T_MAX, else an error should occur.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

bisected to here:

631f9938b1604d4f893417ec339b9e0fa9196fb1 is the first new commit
commit 631f9938b1604d4f893417ec339b9e0fa9196fb1
Author: Eric Snow 
Date:   Mon Jun 7 16:52:00 2021 -0600

bpo-43693: Add the MAKE_CELL opcode and interleave fast locals offsets. 
(gh-26396)

This moves logic out of the frame initialization code and into the compiler 
and eval loop.  Doing so simplifies the runtime code and allows us to optimize 
it better.

https://bugs.python.org/issue43693

--
nosy: +Dennis Sweeney, eric.snow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-16 Thread theeshallnotknowethme


New submission from theeshallnotknowethme :

Optimize calculating powers of 2 for integers. Does not include optimizing 
modular exponentiation because benchmarking shows current version of modular 
exponentiation is faster. Also optimizes any call with the structure 
`l_divmod(a, b, NULL, )`.

> python_modified.exe -m timeit -s "x = 2" "x**1000"
1 loops, best of 5: 33.1 usec per loop
> python_current.exe -m timeit -s "x = 2" "x**1000"
10 loops, best of 5: 35.2 msec per loop

--
components: Interpreter Core
messages: 410744
nosy: February291948
priority: normal
severity: normal
status: open
title: optimizing `1 << n` or `2 ** n` and modulo-only operations
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 7f4b69b9076bdbcea31f6ad16eb125ee99cf0175 by Christian Heimes in 
branch 'main':
bpo-40280: Change subprocess imports for cleaner error on wasm32 (GH-30620)
https://github.com/python/cpython/commit/7f4b69b9076bdbcea31f6ad16eb125ee99cf0175


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Lumír Balhar

Change by Lumír Balhar :


--
nosy: +frenzy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] Unhelpful SyntaxError

2022-01-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Email bounced.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] Unhelpful SyntaxError

2022-01-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

For non-coredevs, 'not a bug' means not a bug in the CPython interpreter, as 
opposed to user code, which here has bugs.

People asking questions (preferably in a more appropriate place) should read, 
for instance, 
https://stackoverflow.com/help/minimal-reproducible-example
How to create a Minimal, Reproducible Example

A minimal reproducer is '('.  In 3.9, the message is 'unexpected EOF while 
parsing'.  It is not unusual for beginners to leave out the message when 
reporting an exception in text rather than copy-pasting the last few lines of 
the traceback (which indicates exactly where the error is caught).

[bpo software should be rejecting number IDs]

I sent an email to Hayden.

--
assignee: terry.reedy -> 
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46405] Warning compiling main on Windows

2022-01-16 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 6.0 -> 7.0
pull_requests: +28830
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30627

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Hynek Schlawack


Change by Hynek Schlawack :


--
nosy: +hynek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger, tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35467] IDLE: unrequested pasting into Shell after restart

2022-01-16 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I finally caught an example, which was not immediately after restart.  I copied 
the two lines of output, entered 'import re\n' and the copied text was pasted, 
then the line with the addition compiled, leading to the error.

Type "help", "copyright", "credits" or "license()" for more information.
>>> for c in '℘·': hex(ord(c))
... 
'0x2118'
'0xb7'
>>> import re'0x2118'
... '0xb7'
SyntaxError: invalid syntax
>>> for c in '℘·': hex(ord(c))

I pasted the copied output into an issue on the browser and did other stuff 
before coming back to this window to try something with re.

Differences from my initial report: No RESTART (though usually or often is), no 
exception, not first entry (but first time not?).  

Edit menu item 'Paste' and the shortcut are bound to IDLE-defined pseudoevent 
'<>' which invokes method EditorWindow.paste which calls 
event_generate('<>'), where the latter event is a tk-defined event. 
Where triggered?  I could add a print-to-console in .paste?  Happening only in 
shell and after Enter suggest looking as shell-specific part of Enter handling. 
 If never on Linux, could x-11-only fix-x11-paste (called in pyshell.main) 
explain why not?

I searched stackoverflow [tkinter] questions for 'paste'.  Got 840 responses, 
looked as first page, saw nothing relevant.  Adding 'unwanted', 'unexpected', 
or 'spontaneous' resulted in no hits.  I will consider asking a question myself.

--
nosy: +epaine

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I tested my PR branch on 32-bit arm (raspbian bullseye) and the microbenchmark 
timing shows no change (within the noise across repeated runs).  Unsurprising 
as division is entirely different on 32-bit arm.

Raspbian uses armv6 for compatibility with the original rpi and rpi0.  armv6 
does not have an integer division instruction. (how RISCy of it)  But that 
doesn't make a difference in this code as the final 32-bit arm ISA, armv7-a, 
only has a 32:32 divider.  (armv8 aka aarch64 is 64-bit and uses a UDIV as one 
would expect)

anyways, that satisfies me that it isn't making anything worse elsewhere.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2022-01-16 Thread Inada Naoki


Inada Naoki  added the comment:

Mercurial still use it.
https://www.mercurial-scm.org/repo/hg-stable/file/tip/mercurial/pycompat.py#l113

Mercurial has plan to move filesystem name from ANSI Code Page to UTF-8, but I 
don't know about its progress.
https://www.mercurial-scm.org/wiki/WindowsUTF8Plan

--
nosy: +methane

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46401] Setuptools 60.0 breaks building from source on Debian 11: No module named 'binascii'

2022-01-16 Thread Ching


Ching  added the comment:

Thank you for your solution: setting the env var 
SETUPTOOLS_USE_DISTUTILS=stdlib.

1. At my previous Python 3.10.1, I always upgrade to the latest setuptools 
(60.5.0), then I get an error of "No module named 'binascii'" during upgrading 
to Python 3.10.2 from compiling source.

2. I do not have the above issue as I install a new Python 3.10.2 with the 
bundled setuptools 59.0.1 at termux environment.

It is an issue of upgrade at my linux environment.

I shall close this ticket soon.

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25652] collections.UserString.__rmod__() raises NameError

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The PR was directly inspired by Mark Dickinson's code in the email thread 
directly using __asm__ to get the instruction he wanted.  There is usually a 
way to make the compiler actually do what you intend.  This appears to be it.

Interestingly, experimenting with small code snippets rather than the entire 
longobject.c on gotbolt.org to check various compilers output does not always 
yield as nice of a result.  (clang 11+ showed promise there, but this change 
benefits gcc equally as well in real world CPython microbenchmark timeit 
tests).  https://godbolt.org/z/63eWPczjx was my playground code.

```
$ ./b-clang13/python -m timeit -n 150 -s 'x = 10**1000; r=x//10; assert r 
== 10**999, r' 'x//17'
150 loops, best of 5: 450 nsec per loop
$ ./b-clang13-new-basic-divrem1/python -m timeit -n 150 -s 'x = 10**1000; 
r=x//10; assert r == 10**999, r' 'x//17'
150 loops, best of 5: 375 nsec per loop
$ ./b-gcc9/python -m timeit -n 150 -s 'x = 10**1000; r=x//10; assert r == 
10**999, r' 'x//17'
150 loops, best of 5: 448 nsec per loop
$ ./b-gcc9-new-basic-divrem1/python -m timeit -n 150 -s 'x = 10**1000; 
r=x//10; assert r == 10**999, r' 'x//17'
150 loops, best of 5: 370 nsec per loop
```

That's on an AMD zen3 (x86_64).  Also tested with other divisors, 17 is not 
specialized by the compiler.  These were not --enable-optimizations builds, 
though the results remain similar on those for non-specialized values as x//10 
turns into when using -fprofile-values on gcc9.

Performance tests using other architectures forthcoming.

A pyperformance suite run on a benchmark-stable host is worthwhile. I don't 
actually expect this to show up as significant in most things there; we'll see.

The new code is not any more difficult to maintain than the previous code 
regardless.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +patch
pull_requests: +28829
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30626

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31894] [doc] documentation incorrectly says that “datetime.timestamp” calls “mktime”

2022-01-16 Thread Irit Katriel

Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib), Tests
nosy: +docs@python
title: test_timestamp_naive failed on NetBSD -> [doc] documentation incorrectly 
says that “datetime.timestamp” calls “mktime”
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46406] optimize int division

2022-01-16 Thread Gregory P. Smith


New submission from Gregory P. Smith :

Based on a python-dev thread, we've come up with faster int division code for 
CPython's bignums.

https://mail.python.org/archives/list/python-...@python.org/thread/ZICIMX5VFCX4IOFH5NUPVHCUJCQ4Q7QM/#NEUNFZU3TQU4CPTYZNF3WCN7DOJBBTK5

filing this issue for starters to attach a PR to.  details forthcoming.

--
messages: 410735
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: optimize int division
type: performance
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46405] Warning compiling main on Windows

2022-01-16 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Sometime between Jan 7 and Jan 16 (today) this VC compile warning appeared 
(debug build).
"specialize.c
..\Python\specialize.c(1243): warning C4018: '<': signed/unsigned mismatch 
[f:\dev\3x\PCbuild\_freeze_module.vcxproj]"
Same is repeated at end of compile.

Could and should such warnings be treated as errors in CI Windows' build?  Or 
is it specific to debug build?

--
components: Build, Windows
messages: 410734
nosy: Mark.Shannon, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Warning compiling main on Windows
type: compile error
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43012] Remove pathlib accessors

2022-01-16 Thread Barney Gale

Barney Gale  added the comment:

Thank you Éric!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24194] Make tokenize recognize Other_ID_Start and Other_ID_Continue chars

2022-01-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
assignee: meador.inge -> terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24194] Make tokenize recognize Other_ID_Start and Other_ID_Continue chars

2022-01-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: tokenize fails on some Other_ID_Start or Other_ID_Continue -> Make 
tokenize recognize Other_ID_Start and Other_ID_Continue chars

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43012] Remove pathlib accessors

2022-01-16 Thread Éric Araujo

Éric Araujo  added the comment:

PR looks good, just needs a look by a pathlib expert.

--
nosy: +eric.araujo, eric.smith, eryksun, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24194] tokenize fails on some Other_ID_Start or Other_ID_Continue

2022-01-16 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Udated doc link, which appears to be same:
https://docs.python.org/3.11/reference/lexical_analysis.html#identifiers

Updated property list linked in above:
https://www.unicode.org/Public/14.0.0/ucd/PropList.txt

Relevant content for this issue:

1885..1886; Other_ID_Start # Mn   [2] MONGOLIAN LETTER ALI GALI 
BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA

2118  ; Other_ID_Start # Sm   SCRIPT CAPITAL P
212E  ; Other_ID_Start # So   ESTIMATED SYMBOL
309B..309C; Other_ID_Start # Sk   [2] KATAKANA-HIRAGANA VOICED SOUND 
MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
# Total code points: 6

00B7  ; Other_ID_Continue # Po   MIDDLE DOT
0387  ; Other_ID_Continue # Po   GREEK ANO TELEIA
1369..1371; Other_ID_Continue # No   [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT 
NINE
19DA  ; Other_ID_Continue # No   NEW TAI LUE THAM DIGIT ONE
# Total code points: 12

Codepoints of '℘·' opening example: 
'0x2118' Other_Id_start  Sm Script Capital P
'0xb7'   Other_Id_continue  P0 Middle dot

Except for the two Mongolian start characters, Meador's patch hardcodes the 
'Other' characters, thereby adding them without waiting for re to be fixed.  
While this will miss new additions without manual updates, it is better than 
missing everything for however many years.  I will make a PR with the additions 
and looks at the new tests.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Tin Tvrtković

New submission from Tin Tvrtković :

We've received a report over at the attrs issue tracker about our test suite 
failing on Python 3.11. Here's the link: 
https://github.com/python-attrs/attrs/issues/907

It turns out to be an issue with the no-arg `super()` calls in slotted classes. 
Here's a minimal reproducer example:

```
from attrs import define


@define
class A:
pass


@define
class B(A):
def test(self):
super()


B().test()
```

```
Traceback (most recent call last):
  File "/Users/tintvrtkovic/pg/attrs/a01.py", line 15, in 
B().test()
^^
  File "/Users/tintvrtkovic/pg/attrs/a01.py", line 12, in test
super()
^^^
TypeError: super(type, obj): obj must be an instance or subtype of type
```
This is a known issue for which we have implemented workarounds. The 
workarounds aren't effective for 3.11 though. I have implemented a fix in attrs 
(https://github.com/python-attrs/attrs/pull/910), but I still thought I'd post 
this here to maybe get the core devs opinion.

Dataclasses exhibit the exact same issue when used with `slots=True`, both in 
3.10 when `slots` was added and in 3.11. I guess no one reported it or tried 
fixing it.

A comprehensive description of the issue follows: since it's impossible to add 
*slotness* (i.e. set `__slots__`) to a class after it has been created, when 
creating a slotted class the class decorators in attrs and dataclasses actually 
replace the class they are applied to with a copy of it, with slots added. This 
works, except in the case of the no-arg `super()` being used in any of the 
class methods (and maybe another edge case that I can't remember). When the 
compiler encounters the no-arg `super()` form, it adds some state to the 
function `__closure__` cells. This state causes the exception shown above, 
since it's incorrect when the class gets replaced.

So these closure cells need to be rewritten when the class is replaced. In 
Python versions prior to 3.11, the closure cells were immutable so extra effort 
was needed to rewrite them. The functions are here: 
https://github.com/python-attrs/attrs/blob/9727008fd1e40bc55cdc6aee71e0f61553f33127/src/attr/_compat.py#L145.

In 3.11, our old closure cell rewriting doesn't work any more, but closure 
cells don't appear to be immutable either, so the fix in my attr PR linked 
above is simple. Still, it's another branch in the code to support a specific 
version.

I don't know if there's anything actionable here for Python, apart from 
confirming or denying if this behavior is expected.

--
components: Interpreter Core
messages: 410730
nosy: tinchester
priority: normal
severity: normal
status: open
title: 3.11a4: a small attrs regression
type: behavior
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46381] Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST

2022-01-16 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2022-01-16 Thread Éric Araujo

Éric Araujo  added the comment:

[There are two separate events in the ticket log: I added my comment, then 
noticed I was the only nosy so I found all the prople recently removed by error 
and re-added them]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2022-01-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

[Meta: Why did adding a comment add all those people (back?) to the nosy list?]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 91e33ac3d08a1c6004c469da2c0e2a97b5bdc53c by Christian Heimes in 
branch 'main':
bpo-40280: Add requires_fork test helper (GH-30622)
https://github.com/python/cpython/commit/91e33ac3d08a1c6004c469da2c0e2a97b5bdc53c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2022-01-16 Thread Éric Araujo

Change by Éric Araujo :


--
nosy: +Anthony Sottile, BTaskaya, Jeffrey.Kintscher, Julian, Terry Davis, 
barry, benjamin.peterson, ezio.melotti, georg.brandl, gvanrossum, ishimoto, 
jack1142, lukasz.langa, ncoghlan, pablogsal, r.david.murray, serhiy.storchaka, 
steven.daprano, thautwarm, ulope

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2022-01-16 Thread Éric Araujo

Éric Araujo  added the comment:

PEP 8 used with statements as an example of use of backslashes, I am proposing 
this change: https://github.com/python/peps/pull/2244

--
nosy: +eric.araujo
versions: +Python 3.10 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46401] Setuptools 60.0 breaks building from source on Debian 11: No module named 'binascii'

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:

Jason told me that setuptools is already aware of the issue. He reopened bug 
https://github.com/pypa/setuptools/issues/3007 and is now investigation the 
problem.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree that would be a useful option.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] Unhelpful SyntaxError

2022-01-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

[And I was unable to add the numeric id as nosy. Apologies to the OP, who 
probably will never see this! It's a bug in the bpo software.]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] Unhelpful SyntaxError

2022-01-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

[Numeric id's automatically get dropped from the nosy list: trying to add it 
back]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] Unhelpful SyntaxError

2022-01-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is not the appropriate place to ask for help in debugging your code. I 
suggest you ask on the python-list mailing list.

The error is that you're missing a bunch of right parenthesis in the isWinner() 
function.

I do think "Syntax Error" isn't the best error message, though.

Here's a simplified reproducer:
---
def f():
 return ((1==2)
x
---

Note that in 3.11 (the only other version I have handy), the error is:

  File "foo.py", line 2
return ((1==2)
   ^
SyntaxError: '(' was never closed

I suspect that we won't fix this in old versions of python.

--
components: +Parser -IDLE
nosy: +eric.smith, lys.nikolaou, pablogsal -1071754
title: SyntaxError for no reason -> Unhelpful SyntaxError

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-16 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +erlendaasland, zach.ware
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46403] SyntaxError for no reason

2022-01-16 Thread HAYDEN NGUYEN


New submission from HAYDEN NGUYEN <1071...@lcps.org>:

Here is my code:
import random
def drawBoard(board):
print(board[7] + '|' + board[8] + '|' + board[9])
print('-+-+-')
print(board[4] + '|' + board[5] + '|' + board[6])
print('-+-+-')
print(board[1] + '|' + board[2] + '|' + board[3])

def inputPlayerLetter():
letter=''
while not (letter=="X" or letter=="O"):
print('Do you want to be X or O?')
letter=input.upper()
if letter =='X':
return['X','O']
else:
return['O','X']

def whoGoesFirst():
if random.randint(0,1) == 0:
return 'computer'
else:
return 'player'

def makeMove(board,letter,move):
board[move]=letter

def isWinner(bo,le):
 return ((bo[7] == le and bo[8] == le and bo[9] == le) or
((bo[4] == le and bo[5] == le and bo[6] == le) or
((bo[1] == le and bo[2] == le and bo[3] == le) or
((bo[7] == le and bo[4] == le and bo[1] == le) or
((bo[8] == le and bo[5] == le and bo[2] == le) or
((bo[9] == le and bo[6] == le and bo[3] == le) or
((bo[7] == le and bo[5] == le and bo[3] == le) or
((bo[9] == le and bo[5] == le and bo[1] == le))
def getBoardCopy(board):
boardCopy=[]
for i in board:
boardCopy.append(i)
return boardCopy

def isSpaceFree(board,move):
return board[move] == ''

def getPlayerMove(board):
move=''
while move not in '1 2 3 4 5 6 7 8 9'.split() or not
  isSpaceFree(board,int(move)):
print('What is your next move? (1-9)')
move=input()
return int(move)

def chooseRandomMoveFromList(board,movesList):
possibleMoves=[]
for i in movesList:
if isSpaceFree(board,i):
possibleMoves.append(i)

if len(possibleMoves) != 0:
return random.choice(possibleMoves)
else:
return None

def getComputerMove(board,computerLetter):
if computerLetter=='X':
playerLetter=='O'
else:
playerLetter=='X'

for i in range(1,10):
boardCopy=getBoardCopy(board)
if isSpaceFree(boardCopy,i):
makeMove(boardCopy,computerLetter,i)
if isWinner(boardCopy,playerLetter):
return i

move=chooseRandomMoveFromList(board, [1,3,7,9])
if move!=None:
return move

if isSpaceFree(board,5):
return 5

return chooseRandomMoveFromList(board, [2,4,6,8])

def isBoardFull(board):
for i in range(1,10):
if isSpaceFree(board,i):
return False 
for i in range(1,10):
if isSpaceFree(board,i):
return False
return True
print('Welcome to Tic-Tac-Toe')

while True:
theBoard=[''] * 10
playerLetter, computerLetter=inputPlayerLetter()
turn=whoGoesFirst()
print('The ' + turn + ' will go first.')
gameIsPlaying=True

while gameIsPlaying:
if turn=='player':
drawBoard(theBoard)
move=getPlayerMove(theBoard)
makeMove(theBoard,playerLetter,move)

if isWinner(theBoard,playerLetter):
drawBoard(theBoard)
print('Hooray! You have won the game!')
gameIsPlaying=False
else:
if isBoardFull(theBoard):
drawBoard(theBoard)
print('The game is a tie!')
break
else:
turn='computer'

else:
move=getComputerMove(theBoard, computerLetter)
makeMove(theBoard,computerLetter,move)

if isWinner(theBoard,computerLetter):
drawBoard(theBoard)
print('The computer has beat you! You lose.')
gameIsPlaying=False
else:
if isBoardFull(theBoard):
drawBoard(theBoard)
print('The game is a tie!')
break
else:
turn='player'
print('Do you want to play again! (yes or no)')
if not input().lower().startswith('y'):
break
On def getBoardCopy(board):, it says "SyntaxError:invalid syntax". I looked 
through the code and found nothing wrong. Why is this?

--
assignee: terry.reedy
components: IDLE
files: tic_tac_toe.py
messages: 410720
nosy: 1071754, terry.reedy
priority: normal
severity: normal
status: open
title: SyntaxError for no reason
versions: Python 3.9
Added file: https://bugs.python.org/file50565/tic_tac_toe.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2022-01-16 Thread Humbled Drugman


Change by Humbled Drugman :


--
nosy: +humbdrag
nosy_count: 16.0 -> 17.0
pull_requests: +28828
pull_request: https://github.com/python/cpython/pull/30625

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

With 3.6 being over, is _enablelegacywindowsfsencoding still needed or is it 
time to deprecate it?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38963] multiprocessing processes seem to "bleed" user information (GID/UID/groups)

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2022-01-16 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +28827
pull_request: https://github.com/python/cpython/pull/30624

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24194] tokenize fails on some Other_ID_Start or Other_ID_Continue

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36988] zipfile: string IndexError on extract

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42543] case sensitivity in open() arguments

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

I also think the current error message and docs are clear enough. Things are 
usually case sensitive, and we don't state that in docs. 

Specifying the list of modes in the error message is possible, but I expect 
that we will get complaints about variations we did not list (why do you 
mention only "r" and "w" when "rw" is also fine?)

--
nosy: +iritkatriel
resolution:  -> wont fix
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13886] readline-related test_builtin failure

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

See also Issue44887.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13886] readline-related test_builtin failure

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

On 3.11 I don't see a problem on windows, but on mac test_input_tty from 
test_builtin hangs when test_readline runs first, while test_builtin passes on 
its own.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46401] Setuptools 60.0 breaks building from source on Debian 11: No module named 'binascii'

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:

Does setting the env var SETUPTOOLS_USE_DISTUTILS=stdlib resolve the issue for 
you?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34629] Python3 regression for urllib(2).urlopen(...).fp for chunked http responses

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +orsenthil

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46401] Setuptools 60.0 breaks building from source on Debian 11: No module named 'binascii'

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:

Please report the issue to setuptools, https://github.com/pypa/setuptools . 
It's a regression in setuptools 60.0.

--
components: +Build
nosy: +christian.heimes
title: Using setuptools version 59.8.0 or below before upgrade Python 3.10.2 
from source on Debian 11 -> Setuptools 60.0 breaks building from source on 
Debian 11: No module named 'binascii'

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:

GH-30582 broke doc tests in 3.11 branch:

File "library/enum.rst", line ?, in default
Failed example:
Color(0)
Exception raised:
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Lib/doctest.py", line 1346, in 
__run
exec(compile(example.source, filename, "single",

  File "", line 1, in 
Color(0)
^
NameError: name 'Color' is not defined

--
nosy: +christian.heimes, pablogsal
priority: normal -> release blocker
versions: +Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31038] test_runpy causes running all Python tests when run directly

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, Python 
3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37310] Solaris 11.3 w/ Studio 12.6 test_ctypes fail

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are seeing this 
problem on a current version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37311] Solaris 11.3 w/ Studio 12.6 test_support fail

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are seeing this 
problem on a current version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39064] ValueError in zipfile.ZipFile

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

It's unlikely that anyone will download a binary from bpo and open it. Can you 
help us reproduce the issue without that?

First question is whether you can reproduce this on a version of python that is 
still in maintenance - 3.9 or higher?

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39602] importlib: lazy loading can result in reimporting a submodule

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +brett.cannon
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Rejected by the reality of Python's dynamism, which I overall appreciate ;-).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35974] os.DirEntry.inode() returns invalid value within Docker container

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are seeing this 
on a current python version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44495] wrong FNAME in tarfile if tgz extension is used

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> behavior
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45444] test.test_concurrent_futures fail in x86_ 64 architecture

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37800] Clean up the documentation on module attributes

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45767] Fix types for dev_t processing in posix module

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-16 Thread Ned Batchelder


New submission from Ned Batchelder :

The sqlite3 library implicitly creates the database if the requested file 
doesn't exist.  I would like to be able to avoid that implicit creation.  
(Actually, it would be enough to know whether I had created the database, but 
the underlying SQLite library doesn't seem to indicate that.)

The C code currently hard-codes the SQLite flag to create the database if it 
doesn't exist:

rc = sqlite3_open_v2(database, ,
 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
 (uri ? SQLITE_OPEN_URI : 0), NULL);

Could we make this an option, so the Python code could avoid implicit creation?

--
components: Library (Lib)
messages: 410704
nosy: nedbat
priority: normal
severity: normal
status: open
title: Enhance sqlite3 to avoid implicit creation?

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

Okay, PR welcome.

(Though since this can only work for 3.11+,
maybe typeshed could also be adjusted?
For that you’d have to file a bug there.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45713] gcc warning when compiling Modules/expat/xmltok_ns.c

2022-01-16 Thread sping


sping  added the comment:

This has been fixed upstream in pull request 
https://github.com/libexpat/libexpat/pull/527 that is included with latest 
release libexpat 2.4.3.  bpo-46400 will fix this as a side effect.

--
nosy: +sping

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46400] Please update bundled libexpat to 2.4.3 with security fixes

2022-01-16 Thread sping


Change by sping :


--
title: Please updated bundled libexpat to 2.4.3 with security fixes -> Please 
update bundled libexpat to 2.4.3 with security fixes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46401] Using setuptools version 59.8.0 or below before upgrade Python 3.10.2 from source on Debian 11

2022-01-16 Thread Ching


New submission from Ching :

1. Before upgrade to Python version 3.10.2 from source on Debian Linux, I must 
downgrade setuptools to version 59.8.0 or below.

2. At the stage of "make -j 4", setuptools version 60.0.0 or above raise an 
error of: ModuleNotFoundError: No module named 'binascii'

It is not a big issue, just remind Pythonistas to save their time to debug.

Reference of installation Python from source on Debian:
https://computingforgeeks.com/how-to-install-python-on-debian-linux/

--
components: Installation
files: error1.txt
messages: 410701
nosy: i-Ching
priority: normal
severity: normal
status: open
title: Using setuptools version 59.8.0 or below before upgrade Python 3.10.2 
from source on Debian 11
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50564/error1.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46400] Please updated bundled libexpat to 2.4.3 with security fixes

2022-01-16 Thread sping


New submission from sping :

Expat 2.4.3 released, includes security fixes
https://blog.hartwork.org/posts/expat-2-4-3-released/

Thank you!

PS: This is similar to bpo-44394 excect now it's 2.4.3.

--
components: XML
messages: 410700
nosy: sping
priority: normal
severity: normal
status: open
title: Please updated bundled libexpat to 2.4.3 with security fixes
type: security
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I propose that two changes be made to `dict_keys`, `dict_values`
> and `dict_items`:
>
> * They should be officially exposed in the `types` module.
> * `__class_getitem__` should be added to the classes.

+1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46361] Small ints aren't always cached properly

2022-01-16 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46361] Small ints aren't always cached properly

2022-01-16 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 5cd9a162cd02a3d0f1b0a182d80feeb17439e84f by Brandt Bucher in 
branch 'main':
bpo-46361: Fix "small" `int` caching (GH-30583)
https://github.com/python/cpython/commit/5cd9a162cd02a3d0f1b0a182d80feeb17439e84f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46392] MessageIDHeader is too strict for message-id

2022-01-16 Thread bpoaugust


bpoaugust  added the comment:

The easiest might be for me to provide some test cases, but I have not been 
able to work out where the existing unit tests are.

One failure which I believe should be permitted under current rules is:

 - i.e. trailing space
The space gets added AFTER the >

However the following is parsed correctly:

 - i.e. trailing space but with previous comment

The obsolete rules I referred to are here:
https://datatracker.ietf.org/doc/html/rfc5322#section-4

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-16 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28826
pull_request: https://github.com/python/cpython/pull/30622

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Alex Waygood


Alex Waygood  added the comment:

As a fix, I propose that two changes be made to `dict_keys`, `dict_values` and 
`dict_items`:

* They should be officially exposed in the `types` module.
* `__class_getitem__` should be added to the classes.

These two changes would mean that users would be able to do the following:

```
from types import dict_keys
from typing import TypeVar

K = TypeVar("K")
V = TypeVar("V")

class DictSubclass(dict[K, V]):
def keys(self) -> dict_keys[K, V]:
return super().keys()
```

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Alex Waygood


New submission from Alex Waygood :

Issue40890 added a new `.mapping` attribute to dict_keys, dict_values and 
dict_items in 3.10. This addition is great for introspection. However, it has 
inadvertently caused some unexpected problems for type-checkers.

Prior to Issue40890, the typeshed stub for the three `dict` methods was 
something like this:

```
from typing import MutableMapping, KeysView, ItemsView, ValuesView, TypeVar

_KT = TypeVar("_KT")
_VT = TypeVar("_VT")

class dict(MutableMapping[_KT, _VT]):
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT]: ...
def items(self) -> ItemsView[_KT, _VT]: ...
```

In other words, typeshed did not acknowledge the existence of a "dict_keys" 
class at all. Instead, it viewed the precise class as an implementation detail, 
and merely stated in the stub that `dict.keys()` would return some class that 
implemented the `KeysView` interface.

After Issue40890, however, it was clear that this approach would no longer 
suffice, as mypy (and other type-checkers) would yield false-positive errors 
for the following code:

```
m = dict().keys().mapping
```

Following several PRs, the typeshed stub for these `dict` methods now looks 
something like this:

```
# _collections_abc.pyi

import sys
from types import MappingProxyType
from typing import Generic, KeysView, ValuesView, ItemsView, TypeVar, final

_KT_co = TypeVar("_KT_co", covariant=True)
_VT_co = TypeVar("_VT_co", covariant=True)

@final
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

@final
class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

@final
class dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

# builtins.pyi

from _collections_abc import dict_keys, dict_views, dict_items
from typing import MutableMapping, TypeVar

_KT = TypeVar("_KT")
_VT = TypeVar("_VT")

class dict(MutableMapping[_KT, _VT]):
def keys(self) -> dict_keys[KT, VT]: ...
def values(self) -> dict_values[_KT, _VT]: ...
def items(self) -> dict_items[_KT, _VT]: ...
```

The alteration to the typeshed stub means that mypy will no longer give 
false-positive errors for code in which a user attempts to access the `mapping` 
attribute. However, it has serious downsides. Users wanting to create typed 
subclasses of `dict` have found that they are no longer able to annotate 
`.keys()`, `.values()` and `.items()` as returning `KeysView`, `ValuesView` and 
`ItemsView`, as mypy now flags this as an incompatible override. Instead, they 
now have to import `dict_keys`, `dict_values` and `dict_items` from 
`_collections_abc`, a private module. Moreover, they are unable to parameterise 
these classes at runtime.

In other words, you used to be able to do this:

```
from typing import KeysView, TypeVar

K = TypeVar("K")
V = TypeVar("V")

class DictSubclass(dict[K, V]):
def keys(self) -> KeysView[K]:
return super().keys()
```

But now, you have to do this:

```
from _collections_abc import dict_keys
from typing import TypeVar

K = TypeVar("K")
V = TypeVar("V")

class DictSubclass(dict[K, V]):
def keys(self) -> "dict_keys[K, V]":
return super().keys()
```

References:
* PR where `.mapping` attribute was added to the typeshed stubs: 
https://github.com/python/typeshed/pull/6039
* typeshed issue where this was recently raised: 
https://github.com/python/typeshed/issues/6837
* typeshed PR where this was further discussed: 
https://github.com/python/typeshed/pull/6888

--
components: Library (Lib)
keywords: 3.10regression
messages: 410695
nosy: AlexWaygood, Dennis Sweeney, Jelle Zijlstra, gvanrossum, kj, rhettinger, 
serhiy.storchaka, sobolevn
priority: normal
severity: normal
status: open
title: Addition of `mapping` attribute to dict views classes has inadvertently 
broken type-checkers
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46398] posixshmem module shm_rename freebsd support.

2022-01-16 Thread David CARLIER


New submission from David CARLIER :

- Adding shm_rename (from FreeBSD 13) to be able to move a shared memory block 
from one location to another.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46398] posixshmem module shm_rename freebsd support.

2022-01-16 Thread David CARLIER


Change by David CARLIER :


--
components: FreeBSD
nosy: devnexen, koobs, vstinner
priority: normal
pull_requests: 28825
severity: normal
status: open
title: posixshmem module shm_rename freebsd support.
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-16 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-16 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28824
pull_request: https://github.com/python/cpython/pull/30620

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-16 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46396] Invalid usage of `Concatenate` is not covered at all

2022-01-16 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +gvanrossum, kj

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46392] MessageIDHeader is too strict for message-id

2022-01-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

In what way is it too strict? What "obsolete rules" are you referring to? What 
are some example Message-Ids should be considered valid that instead get 
truncated? What changes are you proposing?

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

> That's not always the case though.

Sorry, yes - I see. We're not creating a frozenset from a frozenset - we're 
creating a frozenset from a regular set from a frozenset. :-(

Sorry for the noise.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46395] `Concatenate` is not covered to be a return type in `test_typing`

2022-01-16 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thank you for the explanation, Ken Jin.

Going to close this issue as invalid.

--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46394] setuptools' _distutils_hack breaks Python build

2022-01-16 Thread Christian Heimes


Change by Christian Heimes :


--
title: 3.8.12: build fails because during handling of the exception, another 
exception occurred -> setuptools' _distutils_hack breaks Python build
type:  -> compile error

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46394] 3.8.12: build fails because during handling of the exception, another exception occurred

2022-01-16 Thread Christian Heimes


Christian Heimes  added the comment:

The problem is caused by setuptools 60.x's _distutils_hack. Please report the 
issue to setuptools or use SETUPTOOLS_USE_DISTUTILS env var to work around the 
issue.

--
nosy: +christian.heimes
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46395] `Concatenate` is not covered to be a return type in `test_typing`

2022-01-16 Thread Ken Jin


Ken Jin  added the comment:

> In this case, do we need to make this a `TypeError`? Right now you can use 
> `Concatenate` as the return type.

Last I recall, we stopped checking anything in the param args of Callable since 
3.10 because it has too many problems with inter-version typing and 
typing_extensions usage. E.g. in Python 3.8

Callable[typing_extensions.Concatenate[...], ...]

was extremely difficult to implement in typing_extensions since Callable checks 
were too strict back then (they only allowed list of args). So to avoid such 
problems in the future, we ceased all param args checking.

For the return arg, I'm not too keen on adding more checks for the same reason 
of allowing future additions. Also the static type checker should warn the user 
and mypy correctly does that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-16 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

That's not always the case though. 

>>> def f():
... return frozenset({1, 2, 3})
... 
>>> a = f.__code__.co_consts[1]
>>> a
frozenset({1, 2, 3})
>>> b = f()
>>> assert a == b
>>> a is b
False

Also see the disassembly I posted on Python-Ideas.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46397] urllib.parse.urlencode() return wrong character

2022-01-16 Thread Anh Dang


New submission from Anh Dang :

urllib.parse.urlencode() return "%2F%3F" instead of "/?"

--
components: Library (Lib)
files: urllib_issue.py
messages: 410687
nosy: scratch
priority: normal
severity: normal
status: open
title: urllib.parse.urlencode() return wrong character
versions: Python 3.9
Added file: https://bugs.python.org/file50563/urllib_issue.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46395] `Concatenate` is not covered to be a return type in `test_typing`

2022-01-16 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

> Sorry I'm confused: Callable[..., Concatenate] is invalid usage. So I don't 
> think we need to test it.

Yes, my bad :)

In this case, do we need to make this a `TypeError`? Right now you can use 
`Concatenate` as the return type.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46395] `Concatenate` is not covered to be a return type in `test_typing`

2022-01-16 Thread Ken Jin


Ken Jin  added the comment:

Sorry I'm confused: Callable[..., Concatenate] is invalid usage. So I don't 
think we need to test it.

https://docs.python.org/3/library/typing.html#typing.Concatenate. "Concatenate 
is currently only valid when used as the first argument to a Callable."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Terry]
> To avoid the intermediate set, [...]

It's not quite as bad as that: there _is_ no intermediate set (or if you 
prefer, the intermediate set is the same object as the final set), since the 
frozenset call returns its argument unchanged if it's already of exact type 
frozenset:

>>> x = frozenset({1, 2, 3})
>>> y = frozenset(x)
>>> y is x
True

Relevant source: 
https://github.com/python/cpython/blob/09087b8519316608b85131ee7455b664c00c38d2/Objects/setobject.c#L999-L1003

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46396] Invalid usage of `Concatenate` is not covered at all

2022-01-16 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
pull_requests: +28823
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30619

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >