[issue47226] if we write a line of code like i wrote keys = pygame.key.get_pressed() is showing error

2022-04-04 Thread Dennis Sweeney


New submission from Dennis Sweeney :

What error message?

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue47220] Document the optional callback parameter of weakref.WeakMethod

2022-04-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Antoine, was the *callback* argument intended to be part of the public  API?

--
nosy: +pitrou, rhettinger

___
Python tracker 

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



[issue47226] if we write a line of code like i wrote keys = pygame.key.get_pressed() is showing error

2022-04-04 Thread Kaushal Sai v


Change by Kaushal Sai v :


--
nosy: vkaushalsai
priority: normal
severity: normal
status: open
title: if we write a line of code like i wrote keys = pygame.key.get_pressed() 
is showing 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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset d1fb16ae286795abe3e9da86332c891b4b18826f by Jelle Zijlstra in 
branch '3.9':
[3.9] bpo-45790: List macros in same order in which fields are described 
(GH-29529) (GH-32321)
https://github.com/python/cpython/commit/d1fb16ae286795abe3e9da86332c891b4b18826f


--

___
Python tracker 

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



[issue47225] Issue in subtraction of float numbers

2022-04-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

See https://docs.python.org/3/tutorial/floatingpoint.html

--
nosy: +rhettinger
resolution:  -> wont fix
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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-04 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy:  -Anthony Sottile

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-04 Thread Ned Deily


Ned Deily  added the comment:


New changeset a0c700480b52dffab830d52e9c4eba15d4b57a89 by Ned Deily in branch 
'main':
bpo-45847: Adapt macOS installer build to use new tkinter configure vars 
(GH-32328)
https://github.com/python/cpython/commit/a0c700480b52dffab830d52e9c4eba15d4b57a89


--

___
Python tracker 

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



[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2022-04-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> any objections before I propose the removal of one-argument super?

AFAICT there is nothing to be gained by deprecating the one argument form.  
Because it has been stable API for two decades, removing it is guaranteed to 
cause some disruption. So why bother?

Anthony Sottile provided this search to showing that at least a few popular 
projects are using the one argument form of super():

https://sourcegraph.com/search?q=context:global+%5Cbsuper%5C%28%5B%5E%2C%5C%28%5C%29%5Cn%5D%2B%5C%29+file:.py%24=regexp=yes

--

___
Python tracker 

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



[issue47225] Issue in subtraction of float numbers

2022-04-04 Thread Prem B. Shah


New submission from Prem B. Shah :

There is an issue when subtracting float numbers ...
for e.g.
print (5.67 - 5.6)
gives an output : 0.07028

--
components: Windows
messages: 416748
nosy: MrPhenomenal3110, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Issue in subtraction of float numbers
versions: Python 3.9

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Ma Lin


Ma Lin  added the comment:

> cryptic name

In very early versions, "mark" was called register/region.
https://github.com/python/cpython/blob/v1.0.1/Modules/regexpr.h#L48-L52

If span is accessed repeatedly, it's faster than Match.span().
Maybe consider renaming it, and make it as public attribute.

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-04 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +30387
pull_request: https://github.com/python/cpython/pull/32328

___
Python tracker 

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



[issue47136] Wrong value assigned automatically to the variable __module__ in the class body.

2022-04-04 Thread Ethan Furman


Ethan Furman  added the comment:

Takuo, please give us an example from real code so we can see the problem.

--

___
Python tracker 

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



[issue47136] Wrong value assigned automatically to the variable __module__ in the class body.

2022-04-04 Thread Ethan Furman


Ethan Furman  added the comment:

issue47223 and issue47224 closed, reopening this one.

--
nosy: +ethan.furman
resolution: duplicate -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue47224] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Ethan Furman


Ethan Furman  added the comment:

Stop creating new issues for the same problem.

If you didn't specify the first issue well enough, add your specifics to it and 
continue that conversation.  Splitting the thoughts and feedback across 
multiple issues is not efficient.

Closing this issue, reopening the original (issue47136).

--
nosy: +ethan.furman
resolution:  -> duplicate
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



[issue47136] Wrong value assigned automatically to the variable __module__ in the class body.

2022-04-04 Thread Takuo Matsuoka


Takuo Matsuoka  added the comment:

I'm going to close this one since I failed to specify the issue
clearly enough.  See

https://bugs.python.org/issue47224

for a more specific issue.

--
resolution:  -> duplicate
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



[issue47223] (closed mistakingly, see the next issue) The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Takuo Matsuoka


Takuo Matsuoka  added the comment:

It can't be moved backed to unresolved this way.  I close this one now.

--
resolution:  -> duplicate
status: open -> closed
title: The variable __module__ in the class body getting an undesirable value 
from __prepare__ of the metaclass -> (closed mistakingly, see the next issue) 
The variable __module__ in the class body getting an undesirable value from 
__prepare__ of the metaclass

___
Python tracker 

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



[issue47224] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Takuo Matsuoka


New submission from Takuo Matsuoka :

Context
---
Some classes have the variable __name__ in their namespace __dict__ ,
and one may wish to create more such classes with varied values of
__name__ .  Some of those could be created with a metaclass whose
__prepare__ returns a mapping having key "__name__", for which the
value is created depending on the arguments of __prepare__ and can be
updated or deleted in the body of the class to be created.  (See C
below for a very silly example of such a metaclass.)


Problem
---
The value of __name__ given by __prepare__ becomes not just that in
the class body, but automatically also the value of __module__
there.  As far as I could see, this is not documented, and the
programmer might not notice __module__ was messed up.  I think this
behaviour is unexpected and problematic at least unless a warning is
given on it in the document.


Example
---
Here's a code which produces a problem.

```
# In this example, the metaclass C is intended to be a class of
# subclasses of:
B = type

class C(type(B)):
@classmethod
def __prepare__(cls, /, *args, **kwargs):
return dict(__name__ = cls._name(*args, **kwargs))
@classmethod
def _name(cls, /, *args, **kwargs):
# The actual value of __name__ doesn't matter much to the
# issue, so I make this function always return the same silly
# thing in this example.
return type.__dict__["__name__"]

class O(B, metaclass=C):
print(__module__ == __name__) # True
# Could update or delete __name__ here.
```

Consequently,

>>> O.__module__



Discussion
--
If the value of __name__ can be read from the scope
outside for the assignment to __module__, then that will erase this
unexpected behaviour and I think it would be a much safer thing to do.


Remarks
---
The issue was previously

https://bugs.python.org/issue47136

which I'm going to close now since I failed to specify the issue
clearly enough there.  Here I've made the issue more specific.

(The issue is same as https://bugs.python.org/issue47223 which I closed
mistaking it with https://bugs.python.org/issue47136)

The issue is different from but seems related to

https://bugs.python.org/issue28869

I haven't figured out the exact relation.


Thanks.

--
components: Interpreter Core
messages: 416741
nosy: Takuo Matsuoka
priority: normal
severity: normal
status: open
title: The variable __module__ in the class body getting an undesirable value 
from __prepare__ of the metaclass
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue47223] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Takuo Matsuoka


Takuo Matsuoka  added the comment:

I tried to close

https://bugs.python.org/issue47136

and mistakingly closed this one.

This one is open.  Sorry about the mistake.

--
resolution: duplicate -> 
status: closed -> open

___
Python tracker 

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



[issue47223] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Takuo Matsuoka


Takuo Matsuoka  added the comment:

I'm going to close this one since I failed to specify the issue
clearly enough.  See

https://bugs.python.org/issue47223

for a more specific issue.

--
resolution:  -> duplicate
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



[issue47223] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-04 Thread Takuo Matsuoka


New submission from Takuo Matsuoka :

Context
---
Some classes have the variable __name__ in their namespace __dict__ ,
and one may wish to create more such classes with varied values of
__name__ .  Some of those could be created with a metaclass whose
__prepare__ returns a mapping having key "__name__", for which the
value is created depending on the arguments of __prepare__ and can be
updated or deleted in the body of the class to be created.  (See C
below for a very silly example of such a metaclass.)


Problem
---
The value of __name__ given by __prepare__ becomes not just that in
the class body, but automatically also the value of __module__
there.  As far as I could see, this is not documented, and the
programmer might not notice __module__ was messed up.  I think this
behaviour is unexpected and problematic at least unless a warning is
given on it in the document.


Example
---
Here's a code which produces a problem.

```
# In this example, the metaclass C is intended to be a class of
# subclasses of:
B = type

class C(type(B)):
@classmethod
def __prepare__(cls, /, *args, **kwargs):
return dict(__name__ = cls._name(*args, **kwargs))
@classmethod
def _name(cls, /, *args, **kwargs):
# The actual value of __name__ doesn't matter much to the
# issue, so I make this function always return the same silly
# thing in this example.
return type.__dict__["__name__"]

class O(B, metaclass=C):
print(__module__ == __name__) # True
# Could update or delete __name__ here.
```

Consequently,

>>> O.__module__



Discussion
--
If the value of __name__ can be read from the scope
outside for the assignment to __module__, then that will erase this
unexpected behaviour and I think it would be a much safer thing to do.


Remarks
---
The issue was previously

https://bugs.python.org/issue47136

which I'm going to close now since I failed to specify the issue
clearly enough there.  Here I've made the issue more specific.

The issue is different from but seems related to

https://bugs.python.org/issue28869

I haven't figured out the exact relation.


Thanks.

--
components: Interpreter Core
messages: 416738
nosy: Takuo Matsuoka
priority: normal
severity: normal
status: open
title: The variable __module__ in the class body getting an undesirable value 
from __prepare__ of the metaclass
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset bc9ec24290d0fa823fa2ac19ac9767b2b8498faa by Miss Islington (bot) 
in branch '3.9':
bpo-40982: shutil docs: Remove outdated copytree() example (GH-24778)
https://github.com/python/cpython/commit/bc9ec24290d0fa823fa2ac19ac9767b2b8498faa


--

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset 857cf55cbdd65b7a9534dc35d89a19dfe8cbdba5 by Miss Islington (bot) 
in branch '3.10':
bpo-40982: shutil docs: Remove outdated copytree() example (GH-24778)
https://github.com/python/cpython/commit/857cf55cbdd65b7a9534dc35d89a19dfe8cbdba5


--

___
Python tracker 

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



[issue45542] Using multiple comparison operators can cause performance issues

2022-04-04 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

For reference, chaining is about 1.18x slower in this microbenchmark on GCC:

./python -m pyperf timeit -s "x = 100" "if 10 < x < 30: print('no')" 
--duplicate=10
.
Mean +- std dev: 21.3 ns +- 0.2 ns
./python -m pyperf timeit -s "x = 100" "if 10 < x and x < 30: print('no')" 
--duplicate=10
.
Mean +- std dev: 18.0 ns +- 0.5 ns

For a related case, in GH-30970, the bytecode generate by "a, b = a0, b0" was 
changed.
   Before: [load_a0, load_b0, swap, store_a, store_b]
   After:  [load_a0, load_b0, store_b, store_a]
However, this was only changed when the stores were STORE_FASTs. 
STORE_GLOBAL/STORE_NAME/STORE_DEREF cases still have the SWAP.
In the STORE_GLOBAL cases, you can construct scenarios with custom __del__ 
methods where storing b and then a has different behavior than storing a and 
then b. No such cases can be constructed for STORE_FAST without resorting to 
frame hacking.

I wonder if the same argument applies here: maybe @akuvfx's PR could be altered 
to use LOAD_FAST twice for each variable *only* if everything in sight is the 
result of a LOAD_FAST or a LOAD_CONST. My example above uses a LOAD_DEREF, so 
its behavior could remain unchanged.

The argument that this would within the language spec is maybe a little bit 
more dubious than the "a, b = a0, b0" case though, since custom `__lt__` 
methods are a bit more well-specified than custom `__del__` methods.

Thoughts?

--

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset 31c9e35e5360ba91fc6b81b23eb21dd3c39e2257 by Miss Islington (bot) 
in branch '3.9':
bpo-32658: Regex docs: Fix metacharacter reference (GH-32230)
https://github.com/python/cpython/commit/31c9e35e5360ba91fc6b81b23eb21dd3c39e2257


--

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset d95e072c419e40b0fb67b8cc8a84087c8a0276ee by Miss Islington (bot) 
in branch '3.10':
bpo-32658: Regex docs: Fix metacharacter reference (GH-32230)
https://github.com/python/cpython/commit/d95e072c419e40b0fb67b8cc8a84087c8a0276ee


--

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the report and patch!

--
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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset c0063bdc7b5fed98c6799f3da0a954a775e3d89e by Miss Islington (bot) 
in branch '3.9':
bpo-47007: [doc] `str` special method lookup (GH-31863)
https://github.com/python/cpython/commit/c0063bdc7b5fed98c6799f3da0a954a775e3d89e


--

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30386
pull_request: https://github.com/python/cpython/pull/32327

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset e06f920c5bc6e9fad29082ba0d84043722806e17 by Zackery Spytz in 
branch 'main':
bpo-40982: shutil docs: Remove outdated copytree() example (GH-24778)
https://github.com/python/cpython/commit/e06f920c5bc6e9fad29082ba0d84043722806e17


--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue40982] copytree example in shutil

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +30385
pull_request: https://github.com/python/cpython/pull/32326

___
Python tracker 

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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset f4e711bb49881deb1f07a685878646cd5cdee50f by Miss Islington (bot) 
in branch '3.10':
bpo-45790: List macros in same order in which fields are described (GH-29529)
https://github.com/python/cpython/commit/f4e711bb49881deb1f07a685878646cd5cdee50f


--

___
Python tracker 

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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset f502dadb332f911fa3b6c531bbc5065795cca242 by Miss Islington (bot) 
in branch '3.10':
bpo-47007: [doc] `str` special method lookup (GH-31863)
https://github.com/python/cpython/commit/f502dadb332f911fa3b6c531bbc5065795cca242


--

___
Python tracker 

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



[issue43224] Add support for PEP 646

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 772d8080c9fd635c3999673ca9fad8b674385c7f by Matthew Rahtz in 
branch 'main':
bpo-43224: typing: Add tests for pickling and copying of unpacked native tuple 
(GH-32159)
https://github.com/python/cpython/commit/772d8080c9fd635c3999673ca9fad8b674385c7f


--

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the patch!

--

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30384
pull_request: https://github.com/python/cpython/pull/32323

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 43571a3eea8b5931769376daf4bdad1c9184ae0d by Mike cm in branch 
'main':
bpo-32658: Regex docs: Fix metacharacter reference (GH-32230)
https://github.com/python/cpython/commit/43571a3eea8b5931769376daf4bdad1c9184ae0d


--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +30383
pull_request: https://github.com/python/cpython/pull/32322

___
Python tracker 

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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for noticing and fixing!

--
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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
pull_requests: +30382
pull_request: https://github.com/python/cpython/pull/32321

___
Python tracker 

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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the report and fix!

--
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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset b275267aa7d44ec90fa435c9cb1610c549da745a by rtobar in branch 
'main':
bpo-45790: List macros in same order in which fields are described (GH-29529)
https://github.com/python/cpython/commit/b275267aa7d44ec90fa435c9cb1610c549da745a


--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +30381
pull_request: https://github.com/python/cpython/pull/32320

___
Python tracker 

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



[issue46998] Allow subclassing Any at runtime

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the idea and patch!

--
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



[issue46998] Allow subclassing Any at runtime

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 5a4973e29f2f5c4ee8c086f40325786c62381540 by Shantanu in branch 
'main':
bpo-46998: Allow subclassing Any at runtime (GH-31841)
https://github.com/python/cpython/commit/5a4973e29f2f5c4ee8c086f40325786c62381540


--

___
Python tracker 

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



[issue45542] Using multiple comparison operators can cause performance issues

2022-04-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I came here from #47221.

If I am reading this correctly, it concerns me that stack operations (which 
should be fast) are apparently slow?

If we can't reduce the number of stack operations, can we speed them up?

--
nosy: +steven.daprano
status: pending -> open

___
Python tracker 

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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30380
pull_request: https://github.com/python/cpython/pull/32319

___
Python tracker 

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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset bb86d1d9fbd1888524e04475383f4ea764277f67 by Vanshaj Singhania in 
branch 'main':
bpo-47007: [doc] `str` special method lookup (GH-31863)
https://github.com/python/cpython/commit/bb86d1d9fbd1888524e04475383f4ea764277f67


--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue47007] [doc] str docs are inconsistent with special method lookup

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +30379
pull_request: https://github.com/python/cpython/pull/32318

___
Python tracker 

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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the patch!

--
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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset e47e6ffed36eb1dd82da3bcadf8b45b894ef4ce2 by Miss Islington (bot) 
in branch '3.9':
bpo-41233: Add links to errnos referenced in exceptions docs (GH-21380)
https://github.com/python/cpython/commit/e47e6ffed36eb1dd82da3bcadf8b45b894ef4ce2


--

___
Python tracker 

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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset 3fa800d7a7a405f51e0e8c9b7dac2f2a75c17bb4 by Miss Islington (bot) 
in branch '3.10':
bpo-41233: Add links to errnos referenced in exceptions docs (GH-21380)
https://github.com/python/cpython/commit/3fa800d7a7a405f51e0e8c9b7dac2f2a75c17bb4


--

___
Python tracker 

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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30378
pull_request: https://github.com/python/cpython/pull/32317

___
Python tracker 

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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +30377
pull_request: https://github.com/python/cpython/pull/32316

___
Python tracker 

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



[issue41233] Missing links to errnos on Built-in Exceptions page

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset a74892cb2168d249d9a8c53fad605a5def9b41d4 by yyyan in branch 
'main':
bpo-41233: Add links to errnos referenced in exceptions docs (GH-21380)
https://github.com/python/cpython/commit/a74892cb2168d249d9a8c53fad605a5def9b41d4


--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue47222] subprocess.Popen() should allow capturing output and sending it to stdout and stderr

2022-04-04 Thread Ned Deily


Change by Ned Deily :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed

2022-04-04 Thread Ned Deily


Ned Deily  added the comment:

Unfortunately, this is the kind of issue, often the case with tkinter issues, 
where it is difficult to know where the problem might be. While I know little 
about the internals of tkinter and Tk, my intuition is that this is most likely 
a Tk issue and would need to be resolved by the Tk folks. For these kinds of 
problems, it is usually helpful to try to reproduce the problem using Tcl and 
Tk directly; I have no idea how difficult that would be in this case. If 
someone can do so, then it would be much more likely to get the Tk project to 
look into it (by opening an issue with them). Another ofter useful approach is 
to ask on the tkinter mailing list or on StackOverflow where people with both 
tkinter and Tk expertise hang out.

https://mail.python.org/mailman/listinfo/tkinter-discuss

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-04 Thread Ned Deily


Ned Deily  added the comment:


New changeset 5a7506de7374c10e6eb9ae5a232cc88d4d588450 by Oleg Iarygin in 
branch 'main':
Fix "Contributed ... in bpo-bpo-45847" (GH-32299)
https://github.com/python/cpython/commit/5a7506de7374c10e6eb9ae5a232cc88d4d588450


--
nosy: +ned.deily

___
Python tracker 

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



[issue47210] './configure --help' causes infinite loop

2022-04-04 Thread Ned Deily


Ned Deily  added the comment:

Python 3.9.6 is no longer supported, 3.9.12 is the most recent 3.9.x release. 
Do you get the same results with 3.9.12? But, for what it's worth, ./configure 
--help of that 3.9.6 tarball works just fine on other current Linux systems I 
have available.

--
nosy: +ned.deily

___
Python tracker 

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



[issue46850] [C API] Move _PyEval_EvalFrameDefault() to the internal C API

2022-04-04 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

per 
https://mail.python.org/archives/list/python-...@python.org/message/GFOMU7LP63JUVFMWNJNZJLUMZDRPTUYJ/
 lets roll some of those PRs back and reshape where we move these APIs as 
despite the PEP they were not as private as other privates.

(deferred blocker meaning: block 3.11beta1 - though Pablo could decide to have 
the rollbacks block 3.11alpha7)

--
nosy: +gregory.p.smith, pablogsal
priority: normal -> deferred blocker

___
Python tracker 

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



[issue47097] Document PEP 646

2022-04-04 Thread Alex Waygood


Alex Waygood  added the comment:

(Feel free to reopen this issue if there's more to be done, Matthew!)

--

___
Python tracker 

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



[issue47097] Document PEP 646

2022-04-04 Thread Alex Waygood


Change by Alex Waygood :


--
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



[issue47097] Document PEP 646

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 38ae5b8c0c0b64ae6100b0dee8707d5ab769e381 by Matthew Rahtz in 
branch 'main':
bpo-47097: Add documentation for TypeVarTuple (#32103)
https://github.com/python/cpython/commit/38ae5b8c0c0b64ae6100b0dee8707d5ab769e381


--

___
Python tracker 

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



[issue47006] PEP 646: Decide on substitution behavior

2022-04-04 Thread Matthew Rahtz


Matthew Rahtz  added the comment:

Apologies for the slow reply - coming back to this now that the docs and 
pickling issues are mostly sorted.

[Serhiy]

> > Alias = C[T, *Ts]
> > Alias2 = Alias[*tuple[int, ...]]
> > # Alias2 should be C[int, *tuple[int, ...]]
>
> tuple[int, ...] includes also an empty tuple, and in this case there is no 
> value for T.

This was my initial intuition too, but Pradeep pointed out to me in 
https://github.com/python/cpython/pull/31021#discussion_r815853784 that for 
tuple[int, ...], Python has chosen the opposite mindset: instead of assuming 
the worst-case scenario, we assume the best-case scenario. Thus, the following 
type-checks correctly with mypy 
(https://mypy-play.net/?mypy=latest=3.10=b9ca66fb7d172f939951a741388836a6):

def return_first(tup: tuple[int, ...]) -> int:
return tup[0]
tup: tuple[()] = ()
return_first(tup)

> > We actually deliberately chose not to unpack concrete tuple types - see the 
> > description of https://github.com/python/cpython/pull/30398, under the 
> > heading 'Starred tuple types'. (If you see another way around it, though, 
> > let me know.)
> 
> You assumed that *tuple[str, bool] in def foo(*args: *tuple[str, bool]) 
> should give foo.__annotations__['args'] = tuple[str, bool], but it should 
> rather give (str, bool). No confusion with tuple[str, bool].

Fair point, we could *technically* distinguish between tuple[str, bool] and 
(str, bool). But if I was a naive user and I saw `foo.__annotations__['args'] 
== (str, bool)`, I don't think it'd be immediately obvious to me that the type 
of `args` was `*tuple[str, bool]`.

Also though, there's a second reason mentioned in 
https://github.com/python/cpython/pull/30398 why `(str, bool)` wouldn't be the 
best choice. We decided that the runtime behaviour of `*args: *something` 
should be that we essentially do `(*something,)[0]`. If we made `tuple[int, 
str]` unpack to `(int, str)`, then we'd end up with `__annotations__['args'] == 
(int,)`.

> And one of PEP 646 options is to implement star-syntax only in subscription, 
> not in var-parameter type annotations.

As in, we would allow `Generic[*Ts]`, but not `*args: *Ts`? That'd be a *major* 
change to the PEP - not an option I'm willing to consider at this stage in the 
process.

> > I'm also not sure about this one; disallowing unpacked TypeVarTuples in 
> > argument lists to generic aliases completely (if I've understood right?)
>
> No, it will only be disallowed in substitution of a VarType. Tuple[T][*Ts] -- 
> error. Tuple[*Ts][*Ts2] -- ok.

Ah, gotcha. My mistake.

[Guido]

I ran out of time this evening :) Will reply properly soon.

--

___
Python tracker 

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



[issue45542] Using multiple comparison operators can cause performance issues

2022-04-04 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

https://bugs.python.org/issue47221 was opened as a duplicate of this.

Unless there are any new ideas for getting around the concerns here, I think 
this can be closed.

--
status: open -> pending

___
Python tracker 

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



[issue47221] chained comparisons slower than using `and`

2022-04-04 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Feel free to comment on that issue if you have any ideas about how to address 
the concerns there.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Using multiple comparison operators can cause performance issues

___
Python tracker 

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



[issue47221] chained comparisons slower than using `and`

2022-04-04 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
title: Bug or bad performance -> chained comparisons slower than using `and`

___
Python tracker 

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



[issue47221] Bug or bad performance

2022-04-04 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe this is a duplicate of this issue: https://bugs.python.org/issue45542

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue47222] subprocess.Popen() should allow capturing output and sending it to stdout and stderr

2022-04-04 Thread Philip Prindeville


New submission from Philip Prindeville :

I'd like to see handlers exposes for the stdout and stderr pipe-reading threads 
so that I could customize what's done with the data as it's read.

I might, for instance, want to:

(1) accumulate it into a buffer;
(2) copy it onto sys.stdout or sys.stderr, respectively;
(3) send it to a logging object;

or some combination of the above, possibly all of them.

--
components: Library (Lib)
messages: 416703
nosy: pprindeville
priority: normal
severity: normal
status: open
title: subprocess.Popen() should allow capturing output and sending it to 
stdout and stderr
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



[issue47203] ImportError: DLL load failed while importing binascii: %1 is not a valid Win32 application.

2022-04-04 Thread Matthew


Matthew  added the comment:

Hello,

Thanks for all the help people have given me! I've found the solution to my 
problem. The Environment Variable was set below every other, leading to a 
different Python interpreter to being used, which was probably bundled with a 
different software. I moved the Env. Variable up to the top, and the issue was 
fixed.

Thanks again!

--
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



[issue47221] Bug or bad performance

2022-04-04 Thread Cezary Wagner


Cezary Wagner  added the comment:

Some more experiments:

import dis
import timeit

REPEATS = 100


def test1():
selected = []
for i in range(REPEATS):
if i >= 25 and i <= 75:
selected.append(i)
return selected


def test2():
selected = []
for i in range(REPEATS):
if 25 <= i <= 75:
selected.append(i)
return selected


def test3():
return [x for x in range(REPEATS) if x >= 25 and x <= 75]


def test4():
return [x for x in range(REPEATS) if 25 <= x <= 75]


def test(f):
print(dis.dis(f.__code__.co_code))
print(timeit.timeit(f))


test(test1)
test(test2)
test(test3)
test(test4)

Result:

  0 BUILD_LIST   0
  2 STORE_FAST   0 (0)
  4 LOAD_GLOBAL  0 (0)
  6 LOAD_GLOBAL  1 (1)
  8 CALL_FUNCTION1
 10 GET_ITER
>>   12 FOR_ITER15 (to 44)
 14 STORE_FAST   1 (1)
 16 LOAD_FAST1 (1)
 18 LOAD_CONST   1 (1)
 20 COMPARE_OP   5 (>=)
 22 POP_JUMP_IF_FALSE   21 (to 42)
 24 LOAD_FAST1 (1)
 26 LOAD_CONST   2 (2)
 28 COMPARE_OP   1 (<=)
 30 POP_JUMP_IF_FALSE   21 (to 42)
 32 LOAD_FAST0 (0)
 34 LOAD_METHOD  2 (2)
 36 LOAD_FAST1 (1)
 38 CALL_METHOD  1
 40 POP_TOP
>>   42 JUMP_ABSOLUTE6 (to 12)
>>   44 LOAD_FAST0 (0)
 46 RETURN_VALUE
None
4.56567799025
  0 BUILD_LIST   0
  2 STORE_FAST   0 (0)
  4 LOAD_GLOBAL  0 (0)
  6 LOAD_GLOBAL  1 (1)
  8 CALL_FUNCTION1
 10 GET_ITER
>>   12 FOR_ITER19 (to 52)
 14 STORE_FAST   1 (1)
 16 LOAD_CONST   1 (1)
 18 LOAD_FAST1 (1)
 20 DUP_TOP
 22 ROT_THREE
 24 COMPARE_OP   1 (<=)
 26 POP_JUMP_IF_FALSE   18 (to 36)
 28 LOAD_CONST   2 (2)
 30 COMPARE_OP   1 (<=)
 32 POP_JUMP_IF_FALSE   25 (to 50)
 34 JUMP_FORWARD 2 (to 40)
>>   36 POP_TOP
 38 JUMP_ABSOLUTE6 (to 12)
>>   40 LOAD_FAST0 (0)
 42 LOAD_METHOD  2 (2)
 44 LOAD_FAST1 (1)
 46 CALL_METHOD  1
 48 POP_TOP
>>   50 JUMP_ABSOLUTE6 (to 12)
>>   52 LOAD_FAST0 (0)
 54 RETURN_VALUE
None
5.639823407506
  0 LOAD_CONST   1 (1)
  2 LOAD_CONST   2 (2)
  4 MAKE_FUNCTION0
  6 LOAD_GLOBAL  0 (0)
  8 LOAD_GLOBAL  1 (1)
 10 CALL_FUNCTION1
 12 GET_ITER
 14 CALL_FUNCTION1
 16 RETURN_VALUE
None
3.879290759425
  0 LOAD_CONST   1 (1)
  2 LOAD_CONST   2 (2)
  4 MAKE_FUNCTION0
  6 LOAD_GLOBAL  0 (0)
  8 LOAD_GLOBAL  1 (1)
 10 CALL_FUNCTION1
 12 GET_ITER
 14 CALL_FUNCTION1
 16 RETURN_VALUE
None
3.859126637943

--

___
Python tracker 

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



[issue47049] Incorrect shutil.copytree() behaviour with symlinks

2022-04-04 Thread Zoltan Vajda


Zoltan Vajda  added the comment:

Because I am a first contributor, the automatic quality checks on GitHub have 
to be manually started by somebody. How can I reqest this and by whom?

--
type:  -> behavior

___
Python tracker 

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



[issue47221] Bug or bad performance

2022-04-04 Thread Cezary Wagner


New submission from Cezary Wagner :

I am experienced programmer 10y+ - that is very very strange performance 
problem when I play Python timeit with my son :)

three way operator a <= x <= b is slower than a <= x and x <= b.

It looks like wrong implementation since it is impossible that two separate 
check is faster that one check (with two low level check in C).




import timeit

REPEATS = 100


def test1():
selected = []
for i in range(REPEATS):
if i >= 25 and i <= 75:
selected.append(i)
return selected


def test2():
selected = []
for i in range(REPEATS):
if 25 <= i <= 75:
selected.append(i)
return selected


print(timeit.timeit(test1))
print(timeit.timeit(test2))


Result is on Windows 10.
4.42894768389
4.906247778

--
components: Interpreter Core
messages: 416699
nosy: Cezary.Wagner
priority: normal
severity: normal
status: open
title: Bug or bad performance
type: performance
versions: Python 3.10

___
Python tracker 

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



[issue38299] build errors - latest "git pull"

2022-04-04 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks for the report.

We run AddressSanitizer on the buildbots now, so I'm going to assume that we 
know about these issues when they come up.

--
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



[issue47220] Document the optional callback parameter of weakref.WeakMethod

2022-04-04 Thread Géry

New submission from Géry :

- Document the optional *callback* parameter of `weakref.WeakMethod`.
- Fix a few spelling mistakes.
- Improve wording.

--
components: Library (Lib)
messages: 416697
nosy: maggyero
priority: normal
pull_requests: 30376
severity: normal
status: open
title: Document the optional callback parameter of weakref.WeakMethod
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue47190] Integrating tkinter and asyncio event loops

2022-04-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

That issue has my previous experiments.  Thank you Serhiy for finding it ;-).

--
resolution:  -> duplicate
superseder:  -> Integrate tkinter and asyncio (and async)

___
Python tracker 

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



[issue21314] Document '/' in signatures

2022-04-04 Thread Petr Viktorin


Petr Viktorin  added the comment:

- PEP 570 (Python Positional-Only Parameters) is final
- The language spec was updated to mention it
- the FAQ entry was revised to not link to the PEP and be a self-contained 
explanation

IMO the only thing left is to make searching for `/` yield the right results, 
but that is bpo-15871.
Closing this issue.

--
nosy: +petr.viktorin
resolution:  -> fixed
stage: commit 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



[issue47219] asyncio with two interpreter instances

2022-04-04 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +eric.snow

___
Python tracker 

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



[issue47219] asyncio with two interpreter instances

2022-04-04 Thread Matthias Badaire


New submission from Matthias Badaire :

Hi,
I have an issue when using asyncio and two interpreter instances each launched 
and used in a seperated thread. 
I am getting a asyncio loop for each thread .However asyncio is getting me the 
same loop because of this code in get_running_loop. Indeed when I have two 
interpreter, the ts_id would be the same for both my threads and therefore I 
will get the cached value of the first thread. cached_running_holder being 
static, it is the same value for all instances of interpreter.
Maybe we should check if we are in the same interpreter or same thread ,.. I am 
not sure how it could be fixed. 

_asynciomodule.c:
get_running_loop(PyObject **loop)
{
PyObject *rl;

PyThreadState *ts = _PyThreadState_GET();
uint64_t ts_id = PyThreadState_GetID(ts);
if (ts_id == cached_running_holder_tsid && cached_running_holder != NULL) {

If it does not make sense, I have some sample code but it is not just 10 lines.

--
components: asyncio
messages: 416694
nosy: asvetlov, mbadaire, yselivanov
priority: normal
severity: normal
status: open
title: asyncio with two interpreter instances
type: behavior

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Match.regs is an undocumented attribute, it seems it has existed since 1991. 
Can it be removed?

It was kept for compatibility with the pre-SRE implementation of the re module. 
It was an implementation detail in the original Python code, but I am sure that 
somebody still uses it. I am sure some code still use it. If we are going to 
remove it, it needs to be deprecated first.

--

___
Python tracker 

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



[issue47182] _PyUnicode_Fini should invalidate ucnhash_capi capsule pointer

2022-04-04 Thread neonene


Change by neonene :


--
nosy: +neonene
nosy_count: 5.0 -> 6.0
pull_requests: +30375
pull_request: https://github.com/python/cpython/pull/32313

___
Python tracker 

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



[issue47208] Support libffi implementations that cannot support invocations with 1024 arguments

2022-04-04 Thread Hood Chatham


Hood Chatham  added the comment:

Ideally the library should be able to define a different macro, e.g., 
CTYPES_CUSTOM_MAX_ARGCOUNT. This way the libffi port can define 
CTYPES_CUSTOM_MAX_ARGCOUNT and it will be compatible with older Python versions 
without causing Warning: "CTYPES_MAX_ARGCOUNT redefined`.

--

___
Python tracker 

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



[issue47218] adding name to lzmafile

2022-04-04 Thread Marin M


Change by Marin M :


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

___
Python tracker 

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



[issue47218] adding name to lzmafile

2022-04-04 Thread Marin M


New submission from Marin M :

LZMAFile doesn't have attribute name, unlike GzipFile which has it. Trying to 
access that attribute results in error.

PR is ready with code changes and tests which mimics what is already available 
for GzipFile (e.g. we do not take name from BytesIO() objects because they do 
not have it).
A similar PR is ready for BZ2File as well (a different enhancement).

--
components: Library (Lib)
messages: 416691
nosy: ellaellela
priority: normal
severity: normal
status: open
title: adding name to lzmafile
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



[issue47217] adding name to BZ2File

2022-04-04 Thread Marin M


Change by Marin M :


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

___
Python tracker 

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



[issue47217] adding name to BZ2File

2022-04-04 Thread Marin M


New submission from Marin M :

BZ2File doesn't have attribute name, unlike GzipFile which has it. Trying to 
access that attribute results in error.

PR is ready with code changes and tests which mimics what is already available 
for GzipFile (e.g. we do not take name from BytesIO() objects because they do 
not have it).
A similar PR is ready for LZMAFile as well (a different enhancement).

--
components: Library (Lib)
messages: 416690
nosy: ellaellela
priority: normal
severity: normal
status: open
title: adding name to BZ2File
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



[issue43224] Add support for PEP 646

2022-04-04 Thread Matthew Rahtz


Matthew Rahtz  added the comment:

> 1. Finish writing docs

Done once https://github.com/python/cpython/pull/32103 is merged.

> 2. Implement support for pickling of unpacked native tuples

Done once https://github.com/python/cpython/pull/32159 is merged.

4. Resolve the issue of how we implement type substitution 
(https://bugs.python.org/issue47006)

Will re-visit this now.

--

___
Python tracker 

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



[issue42012] typing support in wsgiref

2022-04-04 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

This seems useful to me but I don't have experience with wsgiref. pje is listed 
as the maintainer in the devguide but appears to be inactive.

I'd suggest you open a PR and if anyone feels strongly against it, they can 
complain.

--
nosy: +JelleZijlstra, pje

___
Python tracker 

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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you Jiahua!

--
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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset 5b4bc61d897c956c245a907807d0073aaa35f1c3 by Miss Islington (bot) 
in branch '3.9':
bpo-46484:Add test for Calendar.iterweekdays (GH-30825)
https://github.com/python/cpython/commit/5b4bc61d897c956c245a907807d0073aaa35f1c3


--

___
Python tracker 

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



[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Ravi Jain


Ravi Jain  added the comment:

yes, I think `inspect.isroutine` does the required functionality.
sorry, I did not know about it, and could not think of the word `routine` when 
checking for functions.

--

___
Python tracker 

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



[issue47216] adding mtime option to gzip open()

2022-04-04 Thread Marin M


Change by Marin M :


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

___
Python tracker 

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



[issue47216] adding mtime option to gzip open()

2022-04-04 Thread Marin M


New submission from Marin M :

init of class GzipFile has mtime as an optional argument, but open() function 
does not.

When using open(), mtime will always be set to the current time and so far 
there was no way of fixing it to a specific timestamp.

In case two people would tar.gz the same file and take its sha, the shas would 
be different. With an option to fix the mtime, they could have a unique sha.

PR containing code change and the tests is already ready.

--
components: Library (Lib)
messages: 416685
nosy: ellaellela
priority: normal
severity: normal
status: open
title: adding mtime option to gzip open()
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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread miss-islington


miss-islington  added the comment:


New changeset 6b4b892e0962a7050c5064133c59955691f9776c by Miss Islington (bot) 
in branch '3.10':
bpo-46484:Add test for Calendar.iterweekdays (GH-30825)
https://github.com/python/cpython/commit/6b4b892e0962a7050c5064133c59955691f9776c


--

___
Python tracker 

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



[issue47186] split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump

2022-04-04 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +30370
pull_request: https://github.com/python/cpython/pull/32309

___
Python tracker 

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



[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Perhaps what you want is inspect.isroutine ?

https://docs.python.org/3/library/inspect.html#inspect.isroutine

I agree with Dennis that the isfunction test is for **Python** (def or lambda) 
functions, not builtins. The docstring for the inspect.is* methods make 
promises about what attributes an object will have:

def isbuiltin(object):
"""Return true if the object is a built-in function or method.
Built-in functions and methods provide these attributes:
__doc__ documentation string
__name__original name of this function or method
__self__instance to which a method is bound, or None"""


def isfunction(object):
"""Return true if the object is a user-defined function.
Function objects provide these attributes:
__doc__ documentation string
__name__name with which this function was defined
__code__code object containing compiled function bytecode
__defaults__tuple of any default values for arguments
__globals__ global namespace in which this function was defined
__annotations__ dict of parameter annotations
__kwdefaults__  dict of keyword only parameters with defaults"""


def (and lambda) functions have a different API from builtin_function_or_method 
objects. They should be kept separate.

--
nosy: +steven.daprano

___
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-04-04 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset c9844cb8aa9615cdc8770d1e43ce6e2ac3efd836 by Christian Heimes in 
branch 'main':
bpo-40280: Add --enable-wasm-dynamic-linking (GH-32253)
https://github.com/python/cpython/commit/c9844cb8aa9615cdc8770d1e43ce6e2ac3efd836


--

___
Python tracker 

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



[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Ravi Jain


Ravi Jain  added the comment:

but `callable` returns `True` for classes with `__call__` also, it does not 
check whether the argument passed to it is a function or not.

I want some way to return `True` for both builtin functions and Python 
functions, but not for classes.

And similarly, some way to return `True` for both builtin methods and Python 
methods.

Should the documentation for `inspect.isfunction` include, `this does not 
include builtin functions.`, and similarly for `inspect.ismethod`?

Should I create a PR to add these two sentences to the documentation?

--

___
Python tracker 

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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30369
pull_request: https://github.com/python/cpython/pull/32308

___
Python tracker 

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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +30368
pull_request: https://github.com/python/cpython/pull/32307

___
Python tracker 

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



[issue46484] Add test for Calendar().iterweekdays()

2022-04-04 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 48269ea9fdbc5804f80962364f95e69097c417ba by 180909 in branch 
'main':
bpo-46484:Add test for Calendar.iterweekdays (GH-30825)
https://github.com/python/cpython/commit/48269ea9fdbc5804f80962364f95e69097c417ba


--
nosy: +iritkatriel

___
Python tracker 

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



  1   2   >