[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sounds good, you have my blessing.

--

___
Python tracker 

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



[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Stefan Behnel


Stefan Behnel  added the comment:

> The patch looks fine, but it looks a bit like benchmark chasing. Is the speed 
> of builtin sum() of a sequence of integers important enough to do this bit of 
> inlining?

Given that we already accepted essentially separate loops for the int, float 
and everything else cases, I think the answer is that it doesn't add much to 
the triplication.


> It may break if we change the internals of Py_Long, as Mark Shannon has been 
> wanting to do for a while

I would assume that such a structural change would come with suitable macros to 
unpack the special 0-2 digit integers. Those would then apply here, too. As it 
stands, there are already some modules distributed over the source tree that 
use direct digit access: ceval.c, _decimal.c, marshal.c. They are easy to find 
with grep and my PR just adds one more.

--

___
Python tracker 

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



[issue45249] SyntaxError location range indicator does not work in doctests

2021-09-20 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
title: Syntax error location range indicator does not work in doctests -> 
SyntaxError location range indicator does not work in doctests

___
Python tracker 

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



[issue45249] Syntax error location range indicator does not work in doctests

2021-09-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Thinking a bit more on this, I'm not sure this can be closed, as SyntaxError 
indicators seems not to be working. I'm not sure if this is limited to doctests 
or not. I've updated the title to narrow it down to SyntaxErrors.

I can look more into this if needed. If it's just doctests, it doesn't matter 
because the doctests ignore the indicators anyway, but if it can happen in some 
other cases, perhaps it's worth fixing.

However I don't have experience with the C parts of python, so I'm not sure 
where / how to look.

Pablo: let me know if you have any pointers on how to debug this, or if you 
think this should be closed.

--
title: Fine grained error locations do not work in doctests -> Syntax error 
location range indicator does not work in doctests

___
Python tracker 

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



[issue45234] copy_file raises FileNotFoundError when src is a directory

2021-09-20 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj

___
Python tracker 

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



[issue45252] Missing support for Source Specific Multicast

2021-09-20 Thread CireSnave


New submission from CireSnave :

It appears that Python's socket module is missing support for the IGMPv3 socket 
options needed to support Source Specific Multicast.  Many developers appear to 
be adding the necessary constants through something like:

if not hasattr(socket, "IP_UNBLOCK_SOURCE"):
setattr(socket, "IP_UNBLOCK_SOURCE", 37)
if not hasattr(socket, "IP_BLOCK_SOURCE"):
setattr(socket, "IP_BLOCK_SOURCE", 38)
if not hasattr(socket, "IP_ADD_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_ADD_SOURCE_MEMBERSHIP", 39)
if not hasattr(socket, "IP_DROP_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_DROP_SOURCE_MEMBERSHIP", 40)


...but it would be nice if these were added to the official module as they are 
supported under current versions of Windows, Linux, and BSD at the least.

--
components: Library (Lib)
messages: 402283
nosy: ciresnave
priority: normal
severity: normal
status: open
title: Missing support for Source Specific Multicast
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, 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



[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

The patch looks fine, but it looks a bit like benchmark chasing. Is the speed 
of builtin sum() of a sequence of integers important enough to do this bit of 
inlining? (It may break if we change the internals of Py_Long, as Mark Shannon 
has been wanting to do for a while -- see 
https://github.com/faster-cpython/ideas/issues/42.)

--

___
Python tracker 

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



[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I created a PR from my last patch, inlining the unpacking 
> of single digit integers. 

Thanks, that gets to the heart of the issue.

I marked the PR as approved (though there is a small coding nit you may want to 
fix).

--

___
Python tracker 

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



[issue45251] signal.SIGCLD alias is not available on OSX

2021-09-20 Thread Thomas Caswell


New submission from Thomas Caswell :

The module attribute signal.SIGCLD 
(https://docs.python.org/3/library/signal.html#signal.SIGCLD) is an "archaic" 
(quoting from the GNU C Library source) alias for signal.SIGCHLD 
(https://docs.python.org/3/library/signal.html#signal.SIGCHLD). signal.SIGCHLD 
is documented as being available on unix, and signal.SIGCLD is documented as an 
alias of signal.SIGCHLD.  

However, it seems that clang does not define the SIGCLD back-compatibility name 
[1] so the SIGCLD alias is missing on OSX (all the way to at least 2.7) because 
the clang headers appear to not define the SIGCLD macro and hence the logic in 
modulesignal.c does not find it, and hence the rest of the tooling in signal.py 
does not find it.

I am not sure if the correct fix is to document that SIGCLD in only available 
on linux (which I am not sure is completely correct, maybe "availability is 
platform dependent, but definitely not on darwin"?) or to add the macro if 
SIGCHLD is defined and SIGCLD is missing (see attached patch)

[1] SIGCLD is not documented in 
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/signal.3.html
 and not the signal.h that ships with xcode

--
assignee: docs@python
components: Documentation, Library (Lib)
files: osx_signal_compat.patch
keywords: patch
messages: 402280
nosy: docs@python, tcaswell
priority: normal
severity: normal
status: open
title: signal.SIGCLD alias is not available on OSX
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: https://bugs.python.org/file50290/osx_signal_compat.patch

___
Python tracker 

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

wait.py: script to test the time.sleep() function. Press CTRL+C multiple times 
during the sleep to check that even if the sleep is interrupted, time.sleep() 
sleeps the expected duration.

--
Added file: https://bugs.python.org/file50289/wait.py

___
Python tracker 

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26882
pull_request: https://github.com/python/cpython/pull/28483

___
Python tracker 

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



[issue45246] the sorted() documentation should refer to operator

2021-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-0 on this.  While it is true that __lt__ is used, we don't really want people 
to exploit that fact.  Doing so will get them into trouble elsewhere.  For 
example, max(seq) uses __gt__.  Also, when mixing types, a return of 
NotImplemented will trigger a call to the reflection method.  And PEP 8 
recommends that all six rich comparison operators be defined to avoid 
hard-to-find bugs.

--
assignee: docs@python -> rhettinger
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



[issue45226] Misleading error message when pathlib.Path.symlink_to() fails with permissions error

2021-09-20 Thread Barney Gale


Barney Gale  added the comment:

`os.symlink()` and `pathlib.Path.symlink_to()` have reversed argument orders, 
but in the repro steps you're supplying arguments in the same order.

--
nosy: +barneygale

___
Python tracker 

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



[issue45250] Make sure documentation is accurate for what an (async) iterable and (async) iterator are

2021-09-20 Thread Brett Cannon


New submission from Brett Cannon :

There's some inaccuracies when it comes to iterable and iterators (async and 
not). See 
https://mail.python.org/archives/list/python-...@python.org/thread/3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ/#3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ
 for background.

Should probably check:

1. The glossary.
2. Language reference.
3. Built-ins.

This applies to iter()/__iter__/iterable, next()/__next__/iterator, and their 
async equivalents.

--
assignee: brett.cannon
components: Documentation
messages: 402276
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: Make sure documentation is accurate for what an (async) iterable and 
(async) iterator are

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue39778] collections.OrderedDict and weakref.ref raises "refcount is too small" assertion

2021-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

False alarm.  I misread the diff.  All is well.

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2021-09-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution: fixed -> 
status: closed -> 

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2021-09-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg402274

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2021-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

False alarm.  I misread the diff.  All is well.

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset b06c3b364720ce8e8dfb74dfa24434e067ac89ba by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-45021: Fix a hang in forked children (GH-28007) (GH-28481)
https://github.com/python/cpython/commit/b06c3b364720ce8e8dfb74dfa24434e067ac89ba


--

___
Python tracker 

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset d0d83a94314402366e04e7ea2638f809510eb830 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-45021: Fix a hang in forked children (GH-28007) (GH-28480)
https://github.com/python/cpython/commit/d0d83a94314402366e04e7ea2638f809510eb830


--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Pablo: that works fine, thanks!

I will look into updating the doctest docs, and will close this issue later
today ( or you can close it if you like).

--

___
Python tracker 

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I expect the unittest for this might causes hangs on some platforms in the 
future as it mixes fork and threads which is a posix-nono.  If so, we should 
just disable it on all but specific known-to-pass build configs as a future PR.

3.9 and 3.10 PRs will automerge.

--
assignee:  -> gregory.p.smith
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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Can you try a doctest that fails on something that is not a SyntaxError.

Something like:

>>> def foo(x):
...return x + 42

>>> foo(None)

--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ah, but that is a different issue. This is not PEP 657, this is a SyntaxError, 
so is related how those are printed, which I think is separared.

--

___
Python tracker 

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26881
pull_request: https://github.com/python/cpython/pull/28481

___
Python tracker 

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +26880
pull_request: https://github.com/python/cpython/pull/28480

___
Python tracker 

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



[issue45021] concurrent.futures race condition

2021-09-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 0bfa1106acfcddc03590e1f5d6789dbad3affe70 by nullptr in branch 
'main':
bpo-45021: Fix a hang in forked children (GH-28007)
https://github.com/python/cpython/commit/0bfa1106acfcddc03590e1f5d6789dbad3affe70


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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> It looks like the `_thread` module does not actually expose 
> `PyThread_exit_thread` --- the similarly named `thread_PyThread_exit_thread` 
> just raises SystemExit.

Oh right, I was confused by the function name: "thread_PyThread_exit_thread()". 
It's a good thing that it's not exposed in Python :-)

--

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 9510e6f3c797b4398aaf58abc1072b9db0a644f9 by Raymond Hettinger in 
branch 'main':
bpo-45155: Apply new byteorder default values for int.to/from_bytes (GH-28465)
https://github.com/python/cpython/commit/9510e6f3c797b4398aaf58abc1072b9db0a644f9


--

___
Python tracker 

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



[issue40503] PEP 615: Add zoneinfo module

2021-09-20 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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-20 Thread Jeremy Maitin-Shepard


Jeremy Maitin-Shepard  added the comment:

It looks like the `_thread` module does not actually expose 
`PyThread_exit_thread` --- the similarly named `thread_PyThread_exit_thread` 
just raises SystemExit.

>From a search in the codebase, it appears `PyThread_exit_thread` is currently 
>used only to kill threads when they attempt to acquire the GIL during 
>finalization.

Also, if it is changed to no longer kill the thread, it would probably make 
sense to rename it, e.g. to `PyThread_stop_thread_during_finalization`.

--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Andrei Kulakov

Andrei Kulakov  added the comment:

Sorry, I should have noted I’m referring to the line 1 1
Which is underlined by a single caret, but on the command line it has 3
carets as expected.

--

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +26879
pull_request: https://github.com/python/cpython/pull/28465

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2021-09-20 Thread Thomas


Thomas  added the comment:

I added a pull request to attempt to fix this issue. It received a label but no 
review and has gone stale, so I am sending out a ping.

--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Hu, could you explain a bit more in detail what is the expected output? I 
can see highlighting in the exec call that you pasted:

exec(compile(example.source, filename, "single",
 ^^^

The fact that you see those "^^" indicate that is working no? What is 
missing?

--

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Alex Waygood


Alex Waygood  added the comment:

Thanks, Serhiy, that makes sense. I'll consider raising this elsewhere, as you 
suggest.

--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've ran into this when looking at doctest docs, the issue is that they use the 
old example where a single column is highlighted, I want to update it to 
explain why doctest output differs from the one you get from REPL, but I 
probably need to understand why it happens to provide a good explanation.

Alternatively this may be fixed to be consistent if it's easy enough to do.

--

___
Python tracker 

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



[issue45249] Fine grained error locations do not work in doctests

2021-09-20 Thread Andrei Kulakov


New submission from Andrei Kulakov :

It seems like fine grained error locations do not work in failed doctest 
traceback output:

version 3.11.0a0

file contents:
--
def a(x):
"""
>>> 1 1
1
"""
import doctest
doctest.testmod()

OUTPUT
---

Failed example:
1 1
Exception raised:
Traceback (most recent call last):
  File "/Users/ak/opensource/cpython/Lib/doctest.py", line 1348, in __run
exec(compile(example.source, filename, "single",
 ^^^
  File "", line 1
1 1
^
SyntaxError: invalid syntax. Perhaps you forgot a comma?


The location in doctests that causes this:

https://github.com/python/cpython/blob/5846c9b71ee9277fe866b1bdee4cc6702323fe7e/Lib/doctest.py#L1348

--
components: Interpreter Core, Tests
messages: 402257
nosy: andrei.avk, kj, pablogsal
priority: low
severity: normal
status: open
title: Fine grained error locations do not work in doctests
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



[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Interesting, it is because object().__eq__(object()) returns NotImplemented 
instead of False.

object.__eq__ could return False if arguments have same type (or in some other 
cases). I think it would not break anything, and it would fix your case. But I 
am not sure that it is worth to change this. Using bound methods __eq__ and 
__ne__ is an antipattern, and we should not encourage this, even if it is safe 
as in your case. If you want to discuss this more, it is better to do this on a 
mailing-list or Discuss.

Your code can be rewritten as:

def other_colour(self):
for other in CardColour:
if self != other:
return other
assert False, "not reachable"

--

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 04dea46dde25d58f242171181805f0e71a042963 by Miss Islington (bot) 
in branch '3.9':
bpo-45229: Make pickle tests discoverable (GH-28467) (GH-28479)
https://github.com/python/cpython/commit/04dea46dde25d58f242171181805f0e71a042963


--
nosy: +lukasz.langa, lukasz.langa

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 74c6acc76fa00f1b80e96c8d4608ba1487387949 by Miss Islington (bot) 
in branch '3.10':
bpo-45229: Make pickle tests discoverable (GH-28467) (GH-28478)
https://github.com/python/cpython/commit/74c6acc76fa00f1b80e96c8d4608ba1487387949


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Alex Waygood


Alex Waygood  added the comment:

Thanks, Vedran. I read https://bugs.python.org/issue35712#msg349303 before 
adding my message, but am not quite clear why my snippet is the same situation. 

`next(filter((2).__eq__, 'text'))` surely returns 't' because `(2).__eq__('t')` 
returns `NotImplemented`, and `NotImplemented` is truthy. (Apologies if my 
understanding is wrong here.)

I'm unclear, however, why `x.__ne__(y)` should ever return `NotImplemented` (or 
even have the possibility of returning `NotImplemented`) if it is known that 
both `x` and `y` are members of the same `Enum`. The documentation for `Enum`s 
clearly states that equality comparisons between members of the same enum are 
defined (https://docs.python.org/3/library/enum.html#comparisons).

If the argument is "filter should never be used with a predicate that could 
return `NotImplemented` in some situations", then I think that could usefully 
be added to the documentation for `filter`. Moreover, if that is the argument, 
then I don't understand why the following does not raise a DeprecationWarning:

```
>>> next(filter((2).__eq__, (2, 3, 4)))
2
```

Again, apologies if I'm missing something here.

--

___
Python tracker 

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



[issue45237] Python subprocess not honoring append mode for stdout on Windows

2021-09-20 Thread Steve Dower


Steve Dower  added the comment:

> This change has been discussed, but I don't know whether or not it's just a 
> pipe dream

Still a bit of a pipe dream, but I'll add this issue as something that would be 
fixed by it (to stack up against the list of things that would be broken...)

--

___
Python tracker 

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



[issue44848] Upgrade macOS and Windows installers to use SQLite 3.36.0

2021-09-20 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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



[issue44848] Upgrade macOS and Windows installers to use SQLite 3.36.0

2021-09-20 Thread Steve Dower


Steve Dower  added the comment:


New changeset 5846c9b71ee9277fe866b1bdee4cc6702323fe7e by Erlend Egeberg 
Aasland in branch 'main':
bpo-44848: Update Windows installer to use SQLite 3.36.0 (GH-27622)
https://github.com/python/cpython/commit/5846c9b71ee9277fe866b1bdee4cc6702323fe7e


--

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-20 Thread Steve Dower


Steve Dower  added the comment:

I'd guess that these tests are assuming that sys.executable contains only ASCII 
characters. All the tests run in a non-ASCII working directory, so it's only 
the runtime that is not tested propersy here.

The easiest way for Ming Hua to test this is to install for all users (into 
Program Files), and run tests with the same user account.

If that's the case, we probably have to just go through the tests and make them 
Unicode-aware.

--

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 29e431419a0c23340099a9cd8cf23ec9c7788879 by Miss Islington (bot) 
in branch '3.9':
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466) 
(GH-28471)
https://github.com/python/cpython/commit/29e431419a0c23340099a9cd8cf23ec9c7788879


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Vedran Čačić

Vedran Čačić  added the comment:

Please see the message https://bugs.python.org/issue35712#msg349303. Filtering 
with those dunder sesqui-dispatch methods really is a bug magnet.

--

___
Python tracker 

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



[issue40503] PEP 615: Add zoneinfo module

2021-09-20 Thread Steve Dower


Steve Dower  added the comment:

That looks like a relocatable path anyway, which means you wouldn't want to 
compile it into the binary. Your patch to select a default value at runtime is 
probably better.

The compile-time option is meant for a system directory.

--

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Alex Waygood


Alex Waygood  added the comment:

The following code now leads to a `DeprecationWarning`, but I am unclear why it 
should.

```
>>> from enum import Enum
>>> 
>>> class CardColour(Enum):
... """Enumeration of the two colours in a pack of cards."""
... 
... BLACK = 'black'
... RED = 'red'
... 
... def other_colour(self):
... """Given one colour, get the other one."""
... return next(filter(self.__ne__, CardColour))
... 
>>> CardColour.BLACK.other_colour()
:5: DeprecationWarning: NotImplemented should not be used in a boolean 
context

```

If I change the last line of `other_colour` to either `return next(colour for 
colour in CardColour if colour != self)` or `return next(colour for colour in 
CardColour if colour is not self)`, the warning goes away.

Is this intended behaviour?

--
nosy: +AlexWaygood

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e6ba992288fdbe71aa808cfb6955f6f99da7e349 by Serhiy Storchaka in 
branch 'main':
bpo-45229: Make pickle tests discoverable (GH-28467)
https://github.com/python/cpython/commit/e6ba992288fdbe71aa808cfb6955f6f99da7e349


--

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26877
pull_request: https://github.com/python/cpython/pull/28479

___
Python tracker 

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



[issue34093] Reproducible pyc: FLAG_REF is not stable.

2021-09-20 Thread Eric Snow


Eric Snow  added the comment:

FWIW, I found a faster solution than calling `w_object()` twice.

Currently the logic for w_ref() (used for each "complex" object) looks like 
this:

* if ob_ref == 1
   * do not apply FLAG_REF
   * marshal normally
* else if seen for the first time
   * apply FLAG_REF
   * marshal normally
* otherwise
   * emit TYPE_REF
   * emit the ref index of the first instance

The faster solution looks like this:

* if seen for the first time
   * do not apply FLAG_REF
   * marshal normally
   * record the index of the type byte in the output stream
* else if seen for a second time
   * apply FLAG_REF to the byte at the earlier-recorded position
   * emit TYPE_REF
   * emit the ref index of the first instance
* otherwise
   * emit TYPE_REF
   * emit the ref index of the first instance

While this is faster, there are two downsides: extra memory usage and it isn't 
practical when writing to a file.  However, I don't think either is a 
significant problem.  For the former, it can be mostly mitigated by using the 
negative values in WFILE.hashtable to store the type byte position.  For the 
latter, "marshal.dump()" is already a light wrapper around "marshal.dump()" and 
for PyMarshal_WriteObjectToFile() we simply stick with the current unstable 
approach (or change it to do what "marshal.dump()" does).

FYI, I mostly have that implemented in a branch, but am not sure when I'll get 
back to it.

--

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:

Looks like we can lose this with fixes merged for 3.9 - 3.11.

--
nosy: +lukasz.langa
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



[issue1514420] Traceback display code can attempt to open a file named ""

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:

Fixed for Python 3.11. Thanks! ✨  ✨

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



[issue1514420] Traceback display code can attempt to open a file named ""

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset f71300cb0442f16ee9abc938e12537aec1eb5979 by Irit Katriel in 
branch 'main':
bpo-1514420: Do not attempt to open files with names in <>s when formatting an 
exception (GH-28143)
https://github.com/python/cpython/commit/f71300cb0442f16ee9abc938e12537aec1eb5979


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue40497] subprocess.check_output() accept the check keyword argument

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:

Fixed with GH-19897 for Python 3.11. Thanks! ✨  ✨

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +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



[issue40497] subprocess.check_output() accept the check keyword argument

2021-09-20 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 4d2957c1b9a915f76da418e89bf9b5add141ca3e by Rémi Lapeyre in 
branch 'main':
bpo-40497: Fix handling of check in subprocess.check_output() (GH-19897)
https://github.com/python/cpython/commit/4d2957c1b9a915f76da418e89bf9b5add141ca3e


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 50c0551f97f86bbf9f659e1bbe78a14df7754cbe by Miss Islington (bot) 
in branch '3.9':
bpo-45055: Add retry when downloading externals on Windows (GH-28399)
https://github.com/python/cpython/commit/50c0551f97f86bbf9f659e1bbe78a14df7754cbe


--

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset ee41d01326ddf48c411c019a4e63343668ebd829 by Miss Islington (bot) 
in branch '3.10':
bpo-45055: Add retry when downloading externals on Windows (GH-28399)
https://github.com/python/cpython/commit/ee41d01326ddf48c411c019a4e63343668ebd829


--

___
Python tracker 

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



[issue34093] Reproducible pyc: FLAG_REF is not stable.

2021-09-20 Thread Eric Snow


Eric Snow  added the comment:

It turns out that I don't need this after all (once I merged gh-28392 and 
bpo-45188 was resolved).  That impacts how much time I have to spend on this, 
so I might not be able to pursue this further.  That said, I think it is worth 
doing and the PR I have up mostly does everything we need here.  So I'll see if 
I can follow this through. :)

--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Miro Hrončok

Miro Hrončok  added the comment:

> It would mean that extensions compiled against the release candidates may not 
> be binary compatible with the final release

If that's true, I definitively argue not to do that. We've told everybody it 
won't happen.

--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread John Ehresman


John Ehresman  added the comment:

Is adding the field back an option at this point? It would mean that extensions 
compiled against the release candidates may not be binary compatible with the 
final release

My take is that use_tracing is an implementation and version dependent field, 
and that binary compatibility will be maintained for a specific release (e.g. 
3.10) but that there's no assurance that it will be there in the next release 
-- though these things tend not to change. I also regard generated cython code 
as only being valid for the releases that a specific cython version supports.

Code and API's change slowly, but eventually they do change.

--
nosy: +jpe

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26875
pull_request: https://github.com/python/cpython/pull/28477

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +26874
pull_request: https://github.com/python/cpython/pull/28476

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-20 Thread Steve Dower


Steve Dower  added the comment:


New changeset ef9e22b253253615098d22cb49141a2a1024ee3c by Steve Dower in branch 
'main':
bpo-45055: Add retry when downloading externals on Windows (GH-28399)
https://github.com/python/cpython/commit/ef9e22b253253615098d22cb49141a2a1024ee3c


--

___
Python tracker 

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



[issue45213] Frozen modules are looked up using a linear search.

2021-09-20 Thread Eric Snow


Eric Snow  added the comment:

On Mon, Sep 20, 2021 at 12:55 AM Raymond Hettinger
 wrote:
> If you close this out, consider adding a prominent comment so that the issue 
> will be on the minds of people looking at this code.

Good idea!

--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Stefan Behnel

Stefan Behnel  added the comment:

> The code in the examples given above are using `tstate->use_tracing` assuming 
> that its meaning is to determine whether tracing is turned on or not.

No, actually not. It is using the field in the same way as CPython, simply 
because most of this code was originally copied from CPython, and we also 
copied the optimisation of avoiding to check the other fields (for the obvious 
reason of being an optimisation).


> I propose adding back `tstate->use_tracing` as a copy of 
> `tstate->cframe->us_tracing`.

Cython 0.29.24 has already been adapted to this change and will use the new 
field in CPython 3.10b1+.


> Any code that reads `tstate->use_tracing` will work correctly.

Any code that reads and /writes/ the field would probably also continue to work 
correctly, which is what older Cython versions did.


> if_you_use_this_then_we_will_break_your_code_in_some_way_that_will_ruin_your_reputation_as_a_library_developer…

The thing is, new APIs can only be added to new CPython releases. Supporting 
features in older CPython versions (currently 2.7+) means that we always *have 
to* use the existing fields, and can only switch to new APIs by duplicating 
code based on a PY_VERSION_HEX preprocessor check. Even if a new low-latency 
profiling API was added in CPython 3.11, we'd have to wait until there is at 
least an alpha release that has it before enabling this code switch.

And if the new API proves to be slower, we may end up keeping the old code 
around and adding a C compile-time configuration option for users to enable (or 
disable) its use. Cython has lots of those these days, mostly to support the 
different C-API capabilities of different Python implementations, e.g. to take 
advantage of the PyLong or PyUnicode internals if available, and use generic 
C-API calls if not.

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Can someone repeat the benchmarks with 
https://github.com/python/cpython/pull/28475 ?

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-20 Thread Mark Shannon


Mark Shannon  added the comment:

If we are hitting a size limit for PGO, then we need to reduce the size of 
_PyEval_EvalFrameDefault, to let the compiler do its job.
Force inlining stuff is not going to help.

Reverting https://github.com/python/cpython/pull/25244 for 3.10 seems to be the 
cleanest way to do this.

Would someone with a reliable way to test performance on Windows test the 
effect of https://github.com/python/cpython/pull/28475, please?

Longer term we need get PGO in MSVC working on larger functions, but I doubt 
that will be possible for 3.10.

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-20 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26873
pull_request: https://github.com/python/cpython/pull/28475

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you for doing this.  When I started setting up the IDLE test suite 8 
years ago, I was a bit confused about the mixture of old ways (test_main) and 
new ways (unittest.main and possibly load_tests) in the test suite.  
Fortunately, Nick C. told me which was which.  Updating the test suite should 
make it better as an example for new unittest users.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue45248] Documentation example in copyreg errors

2021-09-20 Thread Ciaran Welsh


Change by Ciaran Welsh :


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



[issue45248] Documentation example in copyreg errors

2021-09-20 Thread Ciaran Welsh


New submission from Ciaran Welsh :

The example on https://docs.python.org/3/library/copyreg.html does not work: 

```
import copyreg, copy, pickle
class C:
def __init__(self, a):
self.a = a

def pickle_c(c):
print("pickling a C instance...")
return C, (c.a,)

copyreg.pickle(C, pickle_c)
c = C(1)
d = copy.copy(c)

>   p = pickle.dumps(c)
E   AttributeError: Can't pickle local object 
'RoadRunnerPickleTests.test_ex..C'

picklable_swig_tests.py:133: AttributeError
```

--
assignee: docs@python
components: Documentation
messages: 402227
nosy: CiaranWelsh, docs@python
priority: normal
severity: normal
status: open
title: Documentation example in copyreg errors
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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Xtrem532


Change by Xtrem532 :


--
nosy: +Xtrem532

___
Python tracker 

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



[issue39747] test_os debug assertion failure

2021-09-20 Thread Irit Katriel


Irit Katriel  added the comment:

If I understand Steve's comment it sounds like there's nothing we can do here. 
Shall we close it as not a bug?

--
nosy: +iritkatriel
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-20 Thread 4-launchpad-kalvdans-no-ip-org


Change by 4-launchpad-kalvdans-no-ip-org :


--
nosy: +4-launchpad-kalvdans-no-ip-org

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26872
pull_request: https://github.com/python/cpython/pull/28474

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Mark Shannon


Mark Shannon  added the comment:

IMO those failures are bugs in the projects listed not in CPython.


Relying on the exact meaning, or even the existence of an undocumented field of 
a C struct is not, nor ever has been, safe.
The user of the field is assuming a meaning that is not known to the developers 
of the library/application, so there is no way for them to preserve that 
meaning.
This is not specific to CPython, but applies to any C API.

The code in the examples given above are using `tstate->use_tracing` assuming 
that its meaning is to determine whether tracing is turned on or not.
However, it has no such meaning. It is an internal performance optimization to 
avoid checking both `tstate->c_tracefunc` and `tstate->c_profilefunc`.
It is `tstate->tracing` that determines whether tracing is active or not.

I propose adding back `tstate->use_tracing` as a copy of 
`tstate->cframe->us_tracing`. Any writes to `tstate->use_tracing` will be 
ignored, but any code that also sets `tstate->tracing`, as the Cython code 
does, will work correctly. Any code that reads `tstate->use_tracing` will work 
correctly.

I'm minded to prefix all the names of all fields in all C structs that happen 
to be included by Python.h with 
"if_you_use_this_then_we_will_break_your_code_in_some_way_that_will_ruin_your_reputation_as_a_library_developer__maybe_not_tomorrow_maybe_not_next_year_but_someday"
Although that might prove tricky with a 80 character line limit :)

My attempts to avoid this happening again next year, and the year after that, 
and...
https://bugs.python.org/issue45247
https://github.com/cython/cython/issues/4382

--

___
Python tracker 

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



[issue45247] Add explicit support for Cython to the C API.

2021-09-20 Thread Mark Shannon


New submission from Mark Shannon :

As the C API has evolved it has grown features in an ad-hoc way, driven by the 
needs to whoever has bothered to add the code.

Maybe we should be a bit more principled about this. Specifically we should 
make sure that there is a well defined interface between CPython and the other 
major components of the Python ecosystem.
The obvious places to start are with Cython and Numpy.

This issue deals specifically with Cython. I will leave it to someone who know 
more about Numpy to open an issue for Numpy.

Matching Cython issue: https://github.com/cython/cython/issues/4382


This issue is an attempt to stop the annual occurrence of bugs like 
https://bugs.python.org/issue43760#msg393401

--
components: C API
messages: 402224
nosy: Mark.Shannon, scoder
priority: normal
severity: normal
status: open
title: Add explicit support for Cython to the C API.
type: enhancement

___
Python tracker 

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



[issue45200] Address Sanitizer: libasan dead lock in pthread_create() (test_multiprocessing_fork.test_get() hangs)

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> I didn't check the error rate of this issue. Usually, I'm not sure why, but 
> I'm the one affected by every single test which fails randomly :-D

If you wish, as a compromise we can ignore multiprocessing tests on ASAN build 
for now and leave them for the buildbots.

--

___
Python tracker 

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



[issue39778] collections.OrderedDict and weakref.ref raises "refcount is too small" assertion

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Also, the ordered dict dealloc is already doing that:

https://github.com/python/cpython/blob/a856364cc920d8b16750fd1fadc902efb509754c/Objects/odictobject.c#L1372-L1373

--

___
Python tracker 

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



[issue39778] collections.OrderedDict and weakref.ref raises "refcount is too small" assertion

2021-09-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> I'm thinking that edit to tp_dealloc was incorrect. 

What edit are you referring to? PR 18749 only touches tp_clear and tp_traverse, 
not tp_dealloc

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-13077 "Windows: Unclear behavior of daemon threads on main thread 
exit".

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

I don't think that there is a "good default behavior" where Python currently 
calls PyThread_exit_thread().

IMO we should take the problem from the other side and tries to reduce cases 
when Python can reach this case. Or even make it impossible if possible. For 
example, *removing* daemon threads would remove the most common case when 
Python has to call PyThread_exit_thread().

I'm not sure how to make this case less likely when threading._shutdown() is 
interrupted by CTRL+C. This function can likely hang if a thread is stuck for 
whatever reason. It's important than an user is able to "interrupt" or kill a 
stuck process with CTRL+C (SIGINT). It's a common expectation on Unix, at least 
for me.

Maybe threading._shutdown() should be less nice and call os._exit() in this 
case: exit *immediately* the process in this case. Or Python should restore the 
default SIGINT handler: on Unix, the default SIGINT handler immediately 
terminate the process (like os._exit() does).

I don't think that abort() should be called here (raise SIGABRT signal), since 
the intent of an user pressing CTRL+C is to silently terminate the process. 
It's not an application bug, but an user action.

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

PyThread_exit_thread() is exposed as _thread.exit() and _thread.exit_thread().

PyThread_exit_thread() is only called in take_gil() (at 3 places in the 
function) if tstate_must_exit(tstate) is true. It happens in two cases:

* (by design) at Python exit if a daemon thread tries to "take the GIL": 
PyThread_exit_thread() is called.

* (under an user action) at Python exit if threading._shutdown() is interrupted 
by CTRL+C: Python (regular) threads will continue to run while Py_Finalize() is 
running. In this case, when a (regular) thread tries to "take the GIL", 
PyThread_exit_thread() is called.

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-20 Thread neonene


neonene  added the comment:

>release with the performance regression

I'm OK with the option. The limitation of PGO seems to me a bit weird and it 
might be unexpected for MSVC team.

--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> A Cython issue report: https://github.com/cython/cython/issues/4153

Cython 0.29.24 released at July 13, 2021 with a fix (2 commits):

* 
https://github.com/cython/cython/commit/be3b178296975b976107f41a6383291701e0297f
* 
https://github.com/cython/cython/commit/8d177f4aa51a663e8c51de3210ccb329d7629d36

The Cython master branch was fixed as well: see 
https://github.com/cython/cython/issues/4153

--

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2021-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 3d16fc90ce36acaa846ee88bdd124f84d49395b3 by Miss Islington (bot) 
in branch '3.10':
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466)
https://github.com/python/cpython/commit/3d16fc90ce36acaa846ee88bdd124f84d49395b3


--

___
Python tracker 

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



[issue45246] the sorted() documentation should refer to operator

2021-09-20 Thread Dimitri Papadopoulos Orfanos


Change by Dimitri Papadopoulos Orfanos :


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

___
Python tracker 

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-09-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a856364cc920d8b16750fd1fadc902efb509754c by Serhiy Storchaka in 
branch 'main':
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
https://github.com/python/cpython/commit/a856364cc920d8b16750fd1fadc902efb509754c


--

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2021-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26870
pull_request: https://github.com/python/cpython/pull/28471

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2021-09-20 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5e2c32e08ed77081cabd9d51f0589f81c1572732 by Victor Stinner in 
branch 'main':
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466)
https://github.com/python/cpython/commit/5e2c32e08ed77081cabd9d51f0589f81c1572732


--

___
Python tracker 

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



[issue21627] Concurrently closing files and iterating over the open files directory is not well specified

2021-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue as "not a bug". If you disagree, please comment the issue :-)

Steven Stewart-Gallus:
> In the code FD_DIR is "/proc/self/fd" on Linux. I'm not sure this code
> is correct. This seems as if it would have the same problems as
> iterating over a list and modifying it at the same time.

I don't understand the initial issue. What makes you think that the current 
code is not reliable? Python is using this code for years, and so far, nobody 
reported any crash on this code.

You didn't report a crash, you only wrote that you suspect that there is a bug. 
Can you prove that the current Python code is wrong? Did you look at the 
implementation of readdir() in the Linux glibc for example?

About close() vs marking file descriptor non inheritable, I'm not convinced 
that marking file descriptors is faster or more reliable. On many operating 
systems, _Py_set_inheritable() requires 2 syscalls (get flags, set flags), 
whereas close() is a single syscall: calling close() is faster.

---

Python now has a _Py_closerange() function which supports:

* Linux closerange() syscall, calling the glibc closerange() function
* FreeBSD closefrom() function
* Solaris fdwalk() function

On Linux, _posixsubprocess still iterates /proc/self/pid/ if this directory can 
be opened, even if the closerange() function is available. I'm not sure which 
option is the safest or the fastest. 

By the way, Steven Stewart-Gallus did mention his operating system.

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



[issue45027] Allow basicConfig to configure any logger, not just root

2021-09-20 Thread Vinay Sajip


Vinay Sajip  added the comment:

> This selectively _disables_ a logger. That isn't the same thing as 
> selectively _enabling_ only the loggers you want to enable.

Your earlier comment referred to getting unwanted messages from third-party 
loggers. Suppressing the messages implies disabling them in some way.

> That's fair enough, but why make people do the above (which is somewhat 
> unintuitive)

That's your opinion, but it doesn't seem that this view is widespread. We 
provide basicConfig() for simple configuration and dictConfig() for more 
elaborate requirements; dictConfig() was reviewed by Python developers in PEP 
391 and accepted.

> I could also publish this as a separate package on PyPI

By all means, do that. As I've already said, I've no wish to add yet another 
way of configuring logging. If your PyPI package gains wide adoption, we can 
always revisit this.

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



  1   2   >