[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

Actually the OS will always trust the length has already contained the last NUL.

The test I did in this issue: https://github.com/rust-lang/rust/issues/69061 
showed that:

1. OS trusted the input length was set correctly, both `sun_len` and the length 
of `struct sockaddr_un`.
2. The `struct sockaddr_un` and length will be copied without changed to the 
other programs.
3. It could be reproduced by the Rust dev team. So it shouldn't be a problem in 
the testcase itself.

Maybe we could discuss this on the Github's PR page? I am very sure that it 
could be reproduced.

--

___
Python tracker 

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



[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-24 Thread Stanley


Stanley  added the comment:

Then perhaps saying that it's *never* equal is too strong, and instead we just 
say it's *not* equal. Not too sure how to phrase the behavior difference 
between `==` and `is` though, if that's something that should be noted.

--

___
Python tracker 

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This was an intentional decision.  It is documented and tested.  The rationale 
is that is keeps choices() internally consistent so that choices with equal 
weights produces the same result as if no weights are specified.

For anyone who wants an alternative, it is trivial just call choice() in a list 
comprehension:

   [choice(seq) for i in range(k)]

Another thought is that choices() is more performant than calling choice() in a 
loop.  This matters because one of the principal use cases for choices() in 
bootstrapping where choices() can be called many times.

Lastly, we are strongly averse to changing the algorithms after they are 
published because it impacts reproducible research where people need to be able 
to recreate their random selections for a given seed.

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Tim Peters


Tim Peters  added the comment:

Definitely a duplicate, and I doubt Mark or Raymond will change their mind.

One observation: while floats are not uniformly dense in [0, 1), random() 
results are uniformly spaced. Each is of the form I / 2**53 for an integer I in 
range(2**53).

--
nosy: +tim.peters

___
Python tracker 

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



[issue46864] Deprecate ob_shash in BytesObject

2022-03-24 Thread Inada Naoki


Inada Naoki  added the comment:

OK. Cache efficiency is dropped from motivations list.
Current motivations are:

* Memory saving (currently, 4 BytesObject (= 32 bytes of ob_shash) per code 
object.
* Make bytes objects immutable
  * Share objects among multi interpreters.
  * CoW efficiency.

I close this issue for now, because this issue is just for making direct access 
of ob_shash deprecated.

After Python 3.12 become beta, we will reconsider about we should remove 
ob_shash or keep it.

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Possible duplicate of https://bugs.python.org/issue44080

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Mark Bell


Mark Bell  added the comment:

To give two more consequences of `random.choices` using floating point 
arithmetic:

1) When doing `random.choices([A, B, C], weights=[2**55, 1, 1])` the cumulative 
weight to bisect for is selected using `floor(random() * (2**55 + 1 + 1 + 
0.0))`. Since this is always even, it is impossible for `B` to be chosen.

2) When doing `random.choices([A, B], weights=[2**54, 1])` although the 
`cum_weights` is [18014398509481984, 18014398509481985] the `total` used by 
`random.choices` is `cum_weights[-1] + 0.0`. Due to floating point rounding 
this is 18014398509481984.0 and so is actually smaller than `cum_weights[-1]`. 
Therefore it is impossible for `B` to be chosen.

--

___
Python tracker 

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



[issue47114] random.choice and random.choices have different distributions

2022-03-24 Thread Mark Bell


New submission from Mark Bell :

The docstring for `random.choices` indicates that
```
import random
random.choices(population, k=1)
```
should produce a list containing one item, where each item of `population` has 
equal likelihood of being selected. However `random.choices` draws elements for 
its sample by doing `population[floor(random() * len(population)]` and so 
relies on floating point numbers. Therefore not each item is equally likely to 
be chosen since floats are not uniformly dense in [0, 1] and this problem 
becomes worse as `population` becomes larger. 

Note that this issue does not apply to `random.choice(population)` since this 
uses `random.randint` to choose a random element of `population` and performs 
exact integer arithmetic. Compare 
https://github.com/python/cpython/blob/main/Lib/random.py#L371 and 
https://github.com/python/cpython/blob/main/Lib/random.py#L490

Could `random.choices` fall back to doing `return [choice(population) for _ in 
_repeat(None, k)]` if no weights are given? Similarly, is it also plausible to 
only rely on `random.randint` and integer arithmetic if all of the (cumulative) 
weights given to `random.choices` are integers?

--
components: Library (Lib)
messages: 415981
nosy: Mark.Bell
priority: normal
severity: normal
status: open
title: random.choice and random.choices have different distributions
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



[issue39622] KeyboardInterrupt is ignored when await asyncio.sleep(0)

2022-03-24 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +30184
pull_request: https://github.com/python/cpython/pull/32105

___
Python tracker 

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



[issue11339] annotation for class being defined

2022-03-24 Thread Irit Katriel

Irit Katriel  added the comment:

This looks like PEP 673 – Self Type.

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2022-03-24 Thread Maciej Olko

Maciej Olko  added the comment:

After the Jinja version 3.1.0 release today [1], documentation builds fail for 
all stable branches. Sphinx in versions pinned on those branches fails with 
ImportError. [2]

Backporting 14a4fce457033412278ca9a056787db424310dc3 to 3.10 and 3.9 fixes the 
problem for them (build is successful with 4.2.0). For 3.8 and 3.7 pinning down 
Jinja is required (docs don't build smoothly with 4.2.0 for those branches).

Could some core developer help with the backports?

I am starting to work on PRs with pins for 3.8 and 3.7.


[1] https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0
[2] % sphinx-build --version  
Traceback (most recent call last):
  File "…/cpython/Doc/./venv/bin/sphinx-build", line 5, in 
from sphinx.cmd.build import main
  File "…/cpython/Doc/venv/lib/python3.9/site-packages/sphinx/cmd/build.py", 
line 25, in 
from sphinx.application import Sphinx
  File "…/cpython/Doc/venv/lib/python3.9/site-packages/sphinx/application.py", 
line 42, in 
from sphinx.registry import SphinxComponentRegistry
  File "…/cpython/Doc/venv/lib/python3.9/site-packages/sphinx/registry.py", 
line 24, in 
from sphinx.builders import Builder
  File 
"…/cpython/Doc/venv/lib/python3.9/site-packages/sphinx/builders/__init__.py", 
line 26, in 
from sphinx.util import import_object, logging, rst, progress_message, 
status_iterator
  File "…/cpython/Doc/venv/lib/python3.9/site-packages/sphinx/util/rst.py", 
line 22, in 
from jinja2 import environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' 
(…/cpython/Doc/venv/lib/python3.9/site-packages/jinja2/__init__.py)

--
resolution: fixed -> 
status: closed -> open
versions:  -Python 3.11, Python 3.6

___
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-03-24 Thread Matthew Rahtz


Change by Matthew Rahtz :


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

___
Python tracker 

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



[issue47113] PermissionError on pip uninstall

2022-03-24 Thread Christian Heimes


Christian Heimes  added the comment:

pip is maintained by a different group. Please report pip issues at 
https://github.com/pypa/pip .

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

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

I managed to reproduce the bug.py crash with main branch up to commit 
12c0012cf97d21bc637056983ede0eaf4c0d9c33 .

--
Added file: 
https://bugs.python.org/file50700/bug.py_asyncio_cpustressed-crash.log

___
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-03-24 Thread miss-islington


miss-islington  added the comment:


New changeset 8a0a9e5b1928fab7d9819c8d6498ef5c0b9383af by Christian Heimes in 
branch 'main':
bpo-40280: Add wasm32-emscripten and wasm32-wasi SOABI (GH-32095)
https://github.com/python/cpython/commit/8a0a9e5b1928fab7d9819c8d6498ef5c0b9383af


--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

bisect of main for bug.py with each local python builds get me to commit 
b127e70a8a682fe869c22ce04c379bd85a00db67 "bpo-46070: Fix asyncio initialization 
guard (GH-30423)" as the one that fixed bug.py most of the time.

At times I can make bug.py segfault be it on python 3.9, 3.10 or main branch. 
It is pretty hard (I can have a batch of 200 runs without an issue) but seems 
easier to reproduce with a CPU stressed, then I can have two segfaults in a 
batch of 50 runs.

Bash:
for i in {1..50}; do ./python  ../python-crash-kodi/bug.py ; done
or sh:
for i in `seq 1 50`; do ./python  ../python-crash-kodi/bug.py ; done

with:
stress -c `nproc --all` at the same time.

--

___
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-03-24 Thread Matthew Rahtz


Matthew Rahtz  added the comment:

Ooh, thanks for the reminder! I'll start drafting this now.

--
nosy: +matthew.rahtz

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-03-24 Thread Jack O'Connor


Jack O'Connor  added the comment:

I did reply to that point above with some baseless speculation, but now I can 
back up my baseless speculation with unscientific data :)

https://gist.github.com/oconnor663/aed7016c9dbe5507510fc50faceaaa07

According to whatever `powerstat -R` measures on my laptop, running 
hardware-accelerated SHA-256 in a loop for a minute or so takes 26.86 Watts on 
average. Doing the same with AVX-512 BLAKE3 takes 29.53 Watts, 10% more. 
Factoring in the 4.69x difference in throughput reported by those loops, the 
overall energy/byte for BLAKE3 is 4.27x lower than SHA-256. This is my first 
time running a power benchmark, so if this sounds implausible hopefully someone 
can catch my mistakes.

--

___
Python tracker 

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



[issue47077] test_asyncio ignores exception in _ProactorBasePipeTransport.__del__: RuntimeError('Event loop is closed')

2022-03-24 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Perhaps the proactor should just silently skip protocol events if the event 
loop is closed.
Selector-based event loops do it implicitly already.

--

___
Python tracker 

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



[issue47062] Implement asyncio.Runner context manager

2022-03-24 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue47062] Implement asyncio.Runner context manager

2022-03-24 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 4119d2d7c9e25acd4f16994fb92d656f8b7816d7 by Andrew Svetlov in 
branch 'main':
bpo-47062: Implement asyncio.Runner context manager (GH-31799)
https://github.com/python/cpython/commit/4119d2d7c9e25acd4f16994fb92d656f8b7816d7


--

___
Python tracker 

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



[issue21873] Tuple comparisons with NaNs are broken

2022-03-24 Thread Andreas Kloeckner


Change by Andreas Kloeckner :


--
nosy: +inducer

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

While bisecting main branch I did not only get segfaults but also exceptions, 
namely:

$ ./python  ../python-crash-kodi/sqlite3_crash.py 
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 81, in register_adapters_and_converters
register_adapter(datetime.datetime, adapt_datetime)
KeyError: 'isoformat'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'timepart_full'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'day'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'month'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'year'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'timepart'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File 
"/home/prahal/Projects/WIP/libreelec/cpython_bisect/Lib/sqlite3/dbapi2.py", 
line 83, in register_adapters_and_converters
register_converter("timestamp", convert_timestamp)
KeyError: 'datepart'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File "", line 688, in _load_unlocked
KeyError: 'convert_timestamp'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File "", line 688, in _load_unlocked
KeyError: 'convert_date'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File "", line 688, in _load_unlocked
KeyError: 'adapt_datetime'
Exception ignored deletion of interned string failed:
Traceback (most recent call last):
  File "", line 688, in _load_unlocked
KeyError: 'adapt_date'


The 3.10 branch bisect pointed to one commit that fix the crash after 3.10.1 
which is 72c260cf0c71eb01eb13100b751e9d5007d00b70 [3.10] bpo-46006: Revert 
"bpo-40521: Per-interpreter interned strings (GH-20085)" (GH-30422) (GH-30425) 
which makes sense regarding main branch logs. It is commit 
35d6540c904ef07b8602ff014e520603f84b5886 in the main branch.

What remains to be seen is why "bpo-46070: _PyGC_Fini() untracks objects 
(GH-30577)" looks fine in the main branch (though it has no effect on the 
import crash) and not in 3.9 and 3.10 branch.
Mind in the main branch "bpo-46006: Revert "bpo-40521: Per-interpreter interned 
strings (GH-20085)" (GH-30422)" was already applied when "bpo-46070: 
_PyGC_Fini() untracks objects (GH-30577)" went in so it was also unrelated to 
the fix of the initial report.

--

___
Python tracker 

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



[issue46841] Inline bytecode caches

2022-03-24 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 2f49b97cc5426087b46515254b9a97a22ee8c807 by Irit Katriel in 
branch 'main':
bpo-46841: remove no-longer-used macro UPDATE_PREV_INSTR_OPARG (GH-32100)
https://github.com/python/cpython/commit/2f49b97cc5426087b46515254b9a97a22ee8c807


--

___
Python tracker 

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



[issue22722] inheritable pipes are unwieldy without os.pipe2

2022-03-24 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as this seems abandoned.

Buck, if you want to bring it up again and explain the use case, please reopen 
this issue, create a new issue or post to python-ideas.

--
nosy: +iritkatriel
resolution:  -> rejected
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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

It looks like the length would be short by one in Python before this change, 
meaning binding or connecting to a non-anonymous named AF_UNIX socket 
potentially loses the last character of the path name intended to be bound? 
Depending on if the OS uses the length or trusts a null termination?

That should be an observable behavior change.

It also suggests that fixing this could break code that has been working around 
this bug forever by adding an extra character when binding or connecting to a 
non-anonymous AF_UNIX socket?  Is that true?  In what circumstances is this 
practically observed?

--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Bug filing tip for ty/zonyitoo: Describe the problem in the text when filing 
the bug. Include its consequences and how it is observed in practice.

A bug filed just saying "look at this code, this is wrong" does not communicate 
a need for anyone to spend time on an issue or help others find an existing 
issue describing misbehavior they may be seeing.

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



[issue47113] PermissionError on pip uninstall

2022-03-24 Thread Zombo


New submission from Zombo :

I can install a package:

pip install brotli

but if I try to remove, it fails:

PS D:\Desktop> pip uninstall -y brotli
Found existing installation: Brotli 1.0.9
Uninstalling Brotli-1.0.9:
  Successfully uninstalled Brotli-1.0.9
ERROR: Exception:
Traceback (most recent call last):
  File "C:\python\lib\site-packages\pip\_internal\cli\base_command.py", 
line 167, in exc_logging_wrapper
status = run_func(*args)
  File "C:\python\lib\site-packages\pip\_internal\commands\uninstall.py", 
line 102, in run
uninstall_pathset.commit()
  File "C:\python\lib\site-packages\pip\_internal\req\req_uninstall.py", 
line 420, in commit
self._moved_paths.commit()
  File "C:\python\lib\site-packages\pip\_internal\req\req_uninstall.py", 
line 273, in commit
save_dir.cleanup()
  File "C:\python\lib\site-packages\pip\_internal\utils\temp_dir.py", line 
173, in cleanup
rmtree(self._path)
  File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
326, in wrapped_f
return self(f, *args, **kw)
  File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
406, in __call__
do = self.iter(retry_state=retry_state)
  File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
362, in iter
raise retry_exc.reraise()
  File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
195, in reraise
raise self.last_attempt.result()
  File "concurrent\futures\_base.py", line 439, in result
  File "concurrent\futures\_base.py", line 391, in __get_result
  File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
409, in __call__
result = fn(*args, **kwargs)
  File "C:\python\lib\site-packages\pip\_internal\utils\misc.py", line 124, 
in rmtree
shutil.rmtree(dir, ignore_errors=ignore_errors, 
onerror=rmtree_errorhandler)
  File "shutil.py", line 747, in rmtree
  File "shutil.py", line 617, in _rmtree_unsafe
  File "shutil.py", line 615, in _rmtree_unsafe
PermissionError: [WinError 5] Access is denied: 
'C:\\Windows\\Temp\\pip-uninstall-fi5xmcvd\\_brotli.cp310-win_amd64.pyd'

whats strange is that after the failure, I can go back and manually remove the 
folder with no problem:

PS D:\Desktop> python.exe
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.rmtree('C:\\Windows\\Temp\\pip-uninstall-fi5xmcvd')

--
messages: 415965
nosy: 89z
priority: normal
severity: normal
status: open
title: PermissionError on pip uninstall
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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

3.10 branch is fixed if I revert e6bb17fe29713368e1fd93d9ac9611017c4f570c 
bpo-46070: _PyGC_Fini() untracks objects (GH-30577). Be it if I revert it atop 
current head 9006b4471cc4d74d0cbf782d841a330b0f46a3d0 or if I test the commit 
before e6bb17fe29713368e1fd93d9ac9611017c4f570c was merged.

As this made no sense with regards to this bug report history that this fix 
broke the branch, I tried v3.10.1 which lacks this fix. Vanilla is broken too. 
Also applying the "_PyGC_Fini untracks objects" upon 3.10.1 does not fix the 
test case crash.

I am puzzled. Will try to bisect the commit that fixed the testcase in the 3.10 
branch before "_PyGC_Fini untracks objects" was merged and after 3.10.1.

--

___
Python tracker 

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



[issue46841] Inline bytecode caches

2022-03-24 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +iritkatriel
nosy_count: 5.0 -> 6.0
pull_requests: +30182
pull_request: https://github.com/python/cpython/pull/32100

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

I did 3.9 branch bisect and commit 52937c26adc35350ca0402070160cf6dc838f359 
bpo-46070: _PyGC_Fini() untracks objects (GH-30577) (GH-30580) is the one that 
broke 3.9 . While with my main branch builds this commit is fine, it is not for 
the 3.9 branches.

Proceeding with 3.10 branch bisect of first bad commit and redoing main branch 
first good commit.

--

___
Python tracker 

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



[issue47112] RuntimeError: expected scalar type Long but found Int

2022-03-24 Thread Zachary Ware


Zachary Ware  added the comment:

This appears to be an issue with either your code or the third-party PyTorch 
package.  You'll have better luck asking about this in a forum specific to 
PyTorch, or perhaps the `Users` category of discuss.python.org.

--
nosy: +zach.ware
resolution:  -> third party
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue47112] RuntimeError: expected scalar type Long but found Int

2022-03-24 Thread Ramsey Thomson


New submission from Ramsey Thomson :

Line 2846 of ~\anaconda3\lib\site-packages\torch\nn\functional.py in 
cross_entropy(input, target, weight, size_average, ignore_index, reduce, 
reduction, label_smoothing) results in > RuntimeError: expected scalar type 
Long but found Int
The above is called from line 1150 of 
~\anaconda3\lib\site-packages\torch\nn\modules\loss.py in forward(self, input, 
target) which in turn is called from line 1102 of 
~\anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, 
*input, **kwargs)

--
components: Library (Lib)
messages: 415961
nosy: Ramsey
priority: normal
severity: normal
status: open
title: RuntimeError: expected scalar type Long but found Int
type: compile error
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



[issue46841] Inline bytecode caches

2022-03-24 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


--
nosy: +penguin_wwy
nosy_count: 4.0 -> 5.0
pull_requests: +30181
pull_request: https://github.com/python/cpython/pull/32099

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-03-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

You missed the key "And certainly more efficient in terms of watt-secs/byte" 
part.

--

___
Python tracker 

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



[issue35905] macOS build docs need refresh (2019)

2022-03-24 Thread Battant


Battant  added the comment:

Hello,

I tried to configure my installation according your instructions

Her's step I follow
export CPPFLAGS="-I$(brew --prefix sqlite3)/include -I$(brew --prefix 
zlib)/include"export LDFLAGS="-L$(brew --prefix sqlite3)/lib -L$(brew --prefix 
zlib)/lib"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
python3.10 pip-run -m jaraco.develop -- -m jaraco.develop.macos-build-python
/opt/homebrew/Cellar/python@3.10/3.10.2/bin/python3.10: can't open file ' 
.../cpytonpip-run': [Errno 2] No such file or directory


in the cpython directory :
run commands

export CPPFLAGS="-I$(brew --prefix sqlite3)/include -I$(brew --prefix 
zlib)/include"
export LDFLAGS="-L$(brew --prefix sqlite3)/lib -L$(brew --prefix zlib)/lib
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
./configure -with-pydebug 
--with-tcltk-includes="-I/Library/Frameworks/Tcl.framework/Headers 
-I/Library/Frameworks/Tk.framework/Headers" 
--with-tcltk-libs="/Library/Frameworks/Tcl.framework/Tcl 
/Library/Frameworks/Tk.framework/Tk" --enable-optimizations
make clean
make -j8


gcc -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/zlib/lib 
-fno-semantic-interposition -fprofile-instr-generate -Wl,-stack_size,100  
-framework CoreFoundation -o python.exe Programs/python.o libpython3.10d.a -ldl 
  -framework CoreFoundation
gcc -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/zlib/lib 
-fno-semantic-interposition -fprofile-instr-generate -Wl,-stack_size,100  
-framework CoreFoundation -o Programs/_testembed Programs/_testembed.o 
libpython3.10d.a -ldl   -framework CoreFoundation
Undefined symbols for architecture arm64:
  "_libintl_bindtextdomain", referenced from:
Undefined symbols for architecture arm64:
  "_libintl_bindtextdomain", referenced from:
  __locale_bindtextdomain_impl in libpython3.10d.a(_localemodule.o)
  __locale_bindtextdomain_impl in libpython3.10d.a(_localemodule.o)
  "_libintl_dcgettext", referenced from:
  "_libintl_dcgettext", referenced from:
  __locale_dcgettext_impl in libpython3.10d.a(_localemodule.o)
  __locale_dcgettext_impl in libpython3.10d.a(_localemodule.o)
  "_libintl_dgettext", referenced from:
  "_libintl_dgettext", referenced from:
  __locale_dgettext_impl in libpython3.10d.a(_localemodule.o)
  __locale_dgettext_impl in libpython3.10d.a(_localemodule.o)
  "_libintl_gettext", referenced from:
  "_libintl_gettext", referenced from:
  __locale_gettext_impl in libpython3.10d.a(_localemodule.o)
  __locale_gettext_impl in libpython3.10d.a(_localemodule.o)
  "_libintl_setlocale", referenced from:
  "_libintl_setlocale", referenced from:
  __locale_setlocale_impl in libpython3.10d.a(_localemodule.o)
  _locale_decode_monetary in libpython3.10d.a(_localemodule.o)
  __locale_setlocale_impl in libpython3.10d.a(_localemodule.o)
  _locale_decode_monetary in libpython3.10d.a(_localemodule.o)
  "_libintl_textdomain", referenced from:
  "_libintl_textdomain", referenced from:
  __locale_textdomain_impl in libpython3.10d.a(_localemodule.o)
  __locale_textdomain_impl in libpython3.10d.a(_localemodule.o)
ld: symbol(s) not found for architecture arm64
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [Programs/_testembed] Error 1
make[3]: *** Waiting for unfinished jobs
make[3]: *** [python.exe] Error 1
make[2]: *** [build_all_generate_profile] Error 2
make[1]: *** [profile-gen-stamp] Error 2
make: *** [profile-run-stamp] Error 2


could you help me please to fixe this issus

Best regards

Battant

--
nosy: +Battant

___
Python tracker 

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



[issue46864] Deprecate ob_shash in BytesObject

2022-03-24 Thread Brandt Bucher


Brandt Bucher  added the comment:

Just a note: as of this week (GH-31888), we no longer use bytes objects to 
store bytecode. Instead, the instructions are stored as part of the 
PyCodeObject struct.

(Of course, we still use bytes objects for the various exception handling and 
debugging tables attached to code objects, but these are very cold fields by 
comparison.)

Not to say this work isn't worthwhile, but it probably isn't worth doing for 
`co_code` *alone*.

--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

By "It is fixed in main branch commit 12c0012cf97d21bc637056983ede0eaf4c0d9c33 
." I mean that this commit is good not that this commit fixes the issue.

--

___
Python tracker 

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



[issue26362] Approved API for creating a temporary file path

2022-03-24 Thread Irit Katriel


Irit Katriel  added the comment:

> So no, while unresolved, this bug report should not be closed.

This is not a bug report, it's a feature request, and there is enough 
resistance in the discussion to reject it (according to the Status Quo Wins a 
Stalemate principle).

What may be unresolved is the problem you were trying to solve with the new 
feature you requested. Rather than arguing for this particular solution, I 
would suggest that you start a discussion about the problem and possible 
solutions (the python-ideas list is one place where you could bring it up).

--
nosy: +iritkatriel
resolution:  -> rejected
stage: needs patch -> 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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not the socket programming expert. It just happened that I fixed some bugs 
here. But according to the manpage 
https://man7.org/linux/man-pages/man7/unix.7.html the address length should 
include the terminating NUL: offsetof(struct sockaddr_un, sun_path) + 
strlen(sun_path) + 1. So the fix is correct.

--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-03-24 Thread Alban Browaeys


Alban Browaeys  added the comment:

sqlite3_crash.py does not crashes on python 3.9 below and equal 3.9.9 and 
python main branch 12c0012cf97d21bc637056983ede0eaf4c0d9c33. I confirm it 
crashes on python 3.9.10, 3.9.11, 3.10 branch commit 
9006b4471cc4d74d0cbf782d841a330b0f46a3d0 .
It is fixed in main branch commit 12c0012cf97d21bc637056983ede0eaf4c0d9c33 .

Currently bisecting both 3.9.9 to 3.9.10 and 3.10 to 3.11 main branch for bad 
to good.

The patches in this bug report are already merged in the 3.10 branch which 
crash.

I cannot reproduce win_py399_crash_reproducer.py which I used as a basis for 
this test case.
The backtrace is the same as the ones from the crashes of the kodi addons (me 
Jellyfin Kodi addon), which is the initial report .
This looks like importing sqlite3 in threads plays badly.

I can reproduce on aarch64 (Odroid C2) LibreElec and builds of cpython on 
Debian stable x86_64 (the extensive testing of the broken interpreters is done 
on x86_64 Debian stable bullseye with a cpython clone and running from 
builddir).

--
nosy: +prahal
Added file: https://bugs.python.org/file50699/sqlite3_crash.py

___
Python tracker 

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



[issue37430] [doc] range is not a built-in function

2022-03-24 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: range is not a built-in function -> [doc] range is not a built-in 
function
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Christian Heimes


Christian Heimes  added the comment:

We have a dedicated team of volunteers that triage incoming tickets. They 
assign tickets and ping experts. It looks like nobody triaged your submissions 
because nobody understood it. Your ticket did not contain an explanation and 
the link now goes to an unrelated line in the code.

That is the reason I asked you to provide detailed information on the ticket. 
We have over 7,000 open tickets and over 1,600 open PRs. Your issue got lost in 
the noise.

--

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-03-24 Thread Jack O'Connor


Jack O'Connor  added the comment:

> Truncated sha512 (sha512-256) typically performs 40% faster than sha256 on 
> X86_64.

Without hardware acceleration, yes. But because SHA-NI includes only SHA-1 and 
SHA-256, and not SHA-512, it's no longer a level playing field. OpenSSL's 
SHA-512 and SHA-512/256 both get about 797 MB/s on my machine.

--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-03-24 Thread Christian Heimes


Christian Heimes  added the comment:

sha1 should be considered broken anyway and sha256 does not perform well on 
64bit systems. Truncated sha512 (sha512-256) typically performs 40% faster than 
sha256 on X86_64. It should get you close to the performance of BLAKE3 SSE4.1 
on your system.

--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

Oh, it should also occurs on Linux, I should correct that.

--
nosy:  -christian.heimes

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

More about the tests:

The error will only shows on BSD systems, for example macOS.

Here are some tests done with C and Rust:

https://github.com/rust-lang/rust/issues/69061

If both the servers and clients are written in Python, you won't notice this 
bug because the original code ignored the length of sockaddr_un and use the 
sun_path as a C string (NUL terminated string).

--

___
Python tracker 

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



[issue37665] threading.TIMEOUT_MAX integer overflow on 32-bit builds with threading.Thread.join

2022-03-24 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> undefined behaviour: signed integer overflow in threadmodule.c

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-03-24 Thread Jack O'Connor


Jack O'Connor  added the comment:

> Hardware accelerated SHAs are likely faster than blake3 single core.

Surprisingly, they're not. Here's a quick measurement on my recent ThinkPad 
laptop (64 KiB of input, single-threaded, TurboBoost left on), which supports 
both AVX-512 and the SHA extensions:

OpenSSL SHA-256: 1816 MB/s
OpenSSL SHA-1:   2103 MB/s
BLAKE3 SSE2: 2109 MB/s
BLAKE3 SSE4.1:   2474 MB/s
BLAKE3 AVX2: 4898 MB/s
BLAKE3 AVX-512:  8754 MB/s

The main reason SHA-1 and SHA-256 don't do better is that they're fundamentally 
serial algorithms. Hardware acceleration can speed up a single instance of 
their compression functions, but there's just no way for it to run more than 
one instance per message at a time. In contrast, AES-CTR can easily parallelize 
its blocks, and hardware accelerated AES does beat BLAKE3.

> And certainly more efficient in terms of watt-secs/byte.

I don't have any experience measuring power myself, so take this with a grain 
of salt: I think the difference in throughput shown above is large enough that, 
even accounting for the famously high power draw of AVX-512, BLAKE3 comes out 
ahead in terms of energy/byte. Probably not on ARM though.

--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

Sorry Heimes. I just don't know who is responsible for this code, which is very 
very old.

--

___
Python tracker 

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



[issue28948] Facing issue while running Python 3.6.0rc1 windows x86-64 web based installer

2022-03-24 Thread Irit Katriel


Irit Katriel  added the comment:

This was reported for 3.6 and there was not enough information to figure out 
what the problem is. I am closing it because it's unlikely that anyone will be 
do anything about this unless it is reported again for a current Python 
version, and with more information.

--
nosy: +iritkatriel
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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Christian Heimes


Christian Heimes  added the comment:

Antoine, Serhiy, please take a look. You are the last developers that touched 
the AF_UNIX socket path code.

Ty, why are you pinging me on this issue or on the PR? I'm neither familiar 
with that code nor responsible for it.

--
components: +Extension Modules -Library (Lib)
nosy: +pitrou, serhiy.storchaka
type: behavior -> resource usage
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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

Ping Heimes.

This is a huge bug that exists for a very long time, please consider merge it 
and fix it in the next relesae.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread ty


ty  added the comment:

I think I have already provided enough information about this bug.

The `len_ret` was the length of `sockaddr_un`, which should include the 
terminated NUL in the `sun_path`. But the original implementation only use  
`path.len + offsetof(struct sockaddr_un, sun_path)`.

References:

1. https://man7.org/linux/man-pages/man7/unix.7.html  The Address format 
section.

2. The `SUN_LEN` macro in *BSD systems, https://man.cx/unix(4)

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



[issue47111] ENUM TypeError using mixing

2022-03-24 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue17246] inspect.getargvalues fails if arg name is not bound to a value

2022-03-24 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy -patch

___
Python tracker 

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



[issue47083] The __complex__ method is missing from the complex, float, and int built-in types

2022-03-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10, mark.dickinson

___
Python tracker 

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



[issue47111] ENUM TypeError using mixing

2022-03-24 Thread Benyamin Guedj


New submission from Benyamin Guedj :

when trying to implement mixing with enum

```python
from typing import Tuple
from enum import Enum
class Blah(Tuple[str, ...], Enum):
val = ('a', 'b')
```


>>> from typing import Tuple
>>> from enum import Enum
>>> class Blah(Tuple[str, ...], Enum):
... val = ('a', 'b')
...
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 
150, in __prepare__
member_type, first_enum = metacls._get_mixins_(cls, bases)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 
574, in _get_mixins_
member_type = _find_data_type(bases) or object
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 
562, in _find_data_type
raise TypeError('%r: too many data types: %r' % (class_name, data_types))
TypeError: 'Blah': too many data types: [, ]


note:
  the same code work on python 3.7, 3.9, 3.10



I have checked the source code of enum of 3.8

https://github.com/python/cpython/blob/3.8/Lib/enum.py

and it's not the same as the other version 

https://github.com/python/cpython/blob/3.9/Lib/enum.py

--
components: Library (Lib)
messages: 415942
nosy: benyamin621
priority: normal
severity: normal
status: open
title: ENUM TypeError using mixing
type: crash
versions: Python 3.8

___
Python tracker 

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



[issue40465] Deprecate the optional *random* argument to random.shuffle()

2022-03-24 Thread STINNER Victor


STINNER Victor  added the comment:

commit 70a071d9e1d65f8c168b4b96a18c86d5230789c5
Author: Raymond Hettinger 
Date:   Tue May 4 01:55:40 2021 -0700

bpo-40465: Remove random module features deprecated in 3.9 (GH-25874)

--
nosy: +vstinner

___
Python tracker 

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



[issue40465] Deprecate the optional *random* argument to random.shuffle()

2022-03-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 12c0012cf97d21bc637056983ede0eaf4c0d9c33 by Tomáš Hrnčiar in 
branch 'main':
bpo-40465: Document random module changes in 3.11 What's new (#31818)
https://github.com/python/cpython/commit/12c0012cf97d21bc637056983ede0eaf4c0d9c33


--

___
Python tracker 

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



[issue47110] Refactor bytearray strip methods

2022-03-24 Thread Pieter Eendebak


Change by Pieter Eendebak :


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

___
Python tracker 

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



[issue47110] Refactor bytearray strip methods

2022-03-24 Thread Pieter Eendebak


New submission from Pieter Eendebak :

The bytearray strip, lstrip and rstrip methods contain a lot of duplicated code.

--
components: Interpreter Core
messages: 415939
nosy: pieter.eendebak
priority: normal
severity: normal
status: open
title: Refactor bytearray strip methods
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



[issue47107] Navigation bar in python3103.chm is broken

2022-03-24 Thread stephan


stephan  added the comment:

Good idea with the html files,

thank you

(by the way I still love the chm because its compact and fast)

--

___
Python tracker 

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



[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-24 Thread Thomas Fischbacher


Thomas Fischbacher  added the comment:

Addendum

Serhiy, I agree that my assessment was incorrect.
It actually is unittest/mock.py that has quite a few 'raise AssertionError' 
that are not coming from an 'assert' keyword statement.

At a deeper level, the problem here is as follows:

Every programming language has to make an awkward choice: either it excludes 
some authors ("must be forklift certified"), or it adds a lot of bureaucratic 
scaffolding to have some mechanisms that allow code authors to enforce API 
contracts (as if this would help to "keep out the tide" of unprincipled code 
authors), or it takes a more relaxed perspective - as also Perl did - of "we 
are all responsible users" / "do not do this because you are not invited, not 
because the owner has a shotgun". I'd call this third approach quite reasonable 
overall, but then the understanding is that "everybody treats documentation as 
binding and knows how to write good documentation".

After all, we need to be able to reason about code, and in order to do that, it 
matters to have guarantees such as for example: "Looking up a nonexistent key 
for a mapping by evaluating the_mapping[the_key] can raise an exception, and 
when it does, that exception is guaranteed to be an instance of KeyError".

Unfortunately, Python on the one hand emphasizes "responsible behavior" - i.e. 
"people know how to write and read documentation, and the written documentation 
creates a shared understanding between its author and reader", but on the other 
hand is often really bad at properly documenting its interfaces. If I had to 
name one thing that really needs fixing with Python, it would be this.

--

___
Python tracker 

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



[issue47107] Navigation bar in python3103.chm is broken

2022-03-24 Thread Steve Dower


Steve Dower  added the comment:

Thanks for the report. This is a duplicate of issue47051 (and also no longer 
applies to 3.11 because we've removed the CHM file completely and now ship all 
the HTML files).

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Windows v3.10.3 .chm file (in python310\doc) page headings are 
messed up and spread out over several lines. Also the font has changed from the 
former san serif font to a smaller and harder to read serif font.
versions: +Python 3.10 -Python 3.11

___
Python tracker 

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



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

2022-03-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30179
pull_request: https://github.com/python/cpython/pull/32095

___
Python tracker 

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



[issue47109] Old ctypes.macholib tests are ignored by python -m test

2022-03-24 Thread Oleg Iarygin


Change by Oleg Iarygin :


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

___
Python tracker 

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



[issue47109] Old ctypes.macholib tests are ignored by python -m test

2022-03-24 Thread Oleg Iarygin


New submission from Oleg Iarygin :

Some tests for `ctypes.macholib.dyld` and all tests for `ctypes.macholib.dylib` 
and `ctypes.macholib.framework` are located outside of expected `ctypes.test` 
module and were not ported from `assert` to `unittest` facilities. This causes 
the following problems:

- the tests aren't run by `python -m test` so they are effectively dead
- an end user can run them by `python -m ctypes.macholib.dyld`, `python -m 
ctypes.macholib.dylib`, and `python -m ctypes.macholib.framework`
- they are available even if a user chose to install CPython without tests

--
components: Tests
messages: 415935
nosy: arhadthedev
priority: normal
severity: normal
status: open
title: Old ctypes.macholib tests are ignored by python -m test
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-24 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> We cannot guarantee that NAN never equal to anything, because we can 
> create an object equal to it. For example mock.ANY

Sure. I don't expect that mock.ANY or other weird objects should obey 
the IEEE-754 rules. But we're talking numeric comparisons here, not 
arbitrary objects which may do arbitrary things in their `__eq__` 
method.

The documentation for the math module assumes we're talking about 
sensible, standard numeric values that don't play strange tricks on the 
caller. Look at the first function documented:

math.ceil(x)
Return the ceiling of x, the smallest integer greater than or equal to 
x. If x is not a float, delegates to x.__ceil__(), which should return 
an Integral value.

class MyWeirdFloat(float):
def __ceil__(self):
return -1

math.ceil(MyWeirdFloat(25.9))  # Returns -1 instead of the ceiling.

Does the documentation really need to cover every imaginable weird 
class? I don't think so. Let's keep it simple. NANs compared unequal 
with all numeric values which directly or indirectly obey IEEE-754, 
which includes floats.

--

___
Python tracker 

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



[issue47108] asyncio-stream does not document exceptions

2022-03-24 Thread Christian Bodt

New submission from Christian Bodt :

reader.read() might raise ConnectionResetError and possibly other exceptions, 
but this is not explained in the documentation.

See this stacktrace example:

Traceback (most recent call last):
  File "D:\Dropbox\repos\wxasync\src\examples\server.py", line 23, in 
handle_connection
data = await reader.read(100)
  File "C:\Python-3.9\lib\asyncio\streams.py", line 684, in read
await self._wait_for_data('read')
  File "C:\Python-3.9\lib\asyncio\streams.py", line 517, in _wait_for_data
await self._waiter
  File "C:\Python-3.9\lib\asyncio\proactor_events.py", line 280, in 
_loop_reading
data = fut.result()
  File "C:\Python-3.9\lib\asyncio\windows_events.py", line 812, in _poll
value = callback(transferred, key, ov)
  File "C:\Python-3.9\lib\asyncio\windows_events.py", line 461, in finish_recv
raise ConnectionResetError(*exc.args)
ConnectionResetError: [WinError 64] Le nom réseau spécifié n’est plus disponible

--
assignee: docs@python
components: Documentation
messages: 415933
nosy: christian.bodt, docs@python
priority: normal
severity: normal
status: open
title: asyncio-stream does not document exceptions
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



[issue27817] tkinter string variable misinterpreted as boolean

2022-03-24 Thread Irit Katriel


Irit Katriel  added the comment:

This problem was reported for 2.7 without a manageable reproducer. I suggest we 
close it because it's unlikely that anyone will want to investigate this now 
unless it's reported again for a supported python version.

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue47107] Navigation bar in python3103.chm is broken

2022-03-24 Thread stephan


stephan  added the comment:

added screenshot

--
Added file: https://bugs.python.org/file50698/2022-03-24_python3.10.3.png

___
Python tracker 

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



[issue47107] Navigation bar in python3103.chm is broken

2022-03-24 Thread stephan


New submission from stephan :

As you see in 2022-03-24_python3.10.3.png
the navigation bar in python3103.chm is broken.

In 2022-03-24_python3.10.2.png you see the same 
the same for python3102.chm.

I suppose it would make sense:
- to hide this navigation bar when you create a chm
- to have a file download of the html docs as zip file for offline
  working (like in the djangoproject.com)

--
assignee: docs@python
components: Documentation, Windows
files: 2022-03-24_python3.10.3.png
messages: 415930
nosy: docs@python, paul.moore, stephan, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Navigation bar in python3103.chm is broken
versions: Python 3.11
Added file: https://bugs.python.org/file50697/2022-03-24_python3.10.3.png

___
Python tracker 

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



[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-24 Thread Charlie Zhao


Charlie Zhao  added the comment:

> "Due to the requirements of the `IEEE-754 standard 
> `_, math.nan and float('nan') are 
> never equal to any other value, including themselves. Use math.isnan to test 
> for NANs."

It seems to me, Steven's description is clear enough to tell us that "Be 
careful if you want to compare NANs with others". 

One thing to emphasize is that neither `is` nor `==` is a best practice, just 
like slateny's example, we should be wary of the difference between 
`float('nan')` and `math.nan`.

Adding an example to the docs would be a good way to let everyone know the 
difference and use `math.isnan` instead of `is` and `==` to test for NANs.

--
nosy: +CharlieZhao

___
Python tracker 

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



[issue22608] test_socket fails with sem_init: Too many open files

2022-03-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that it is a FreeBSD-only issue. We need to test on FreeBSD (ulimit -n can 
be used for this) to check whether it was fixed in issue45212.

--
status: pending -> open

___
Python tracker 

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



[issue20291] Argument Clinic should understand *args and **kwargs parameters

2022-03-24 Thread colorfulappl


Change by colorfulappl :


--
pull_requests: +30177
pull_request: https://github.com/python/cpython/pull/32092

___
Python tracker 

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



[issue46864] Deprecate ob_shash in BytesObject

2022-03-24 Thread Inada Naoki

Inada Naoki  added the comment:

> I guess not much difference in benchmarks.
> But if put a bytes object into multiple dicts/sets, and len(bytes_key) is 
> large, it will take a long time. (1 GiB 0.40 seconds on i5-11500 DDR4-3200)
> The length of bytes can be arbitrary,so computing time may be very different.

I don't think calculating hash() for large bytes is not so common use case.
Rare use cases may not justify adding 8bytes to basic types, especially users 
expect it is compact.

Balance is important. Microbenchmark for specific case doesn't guarantee the 
good balance.
So I want real world examples. Do you know some popular libraries that are 
depending on hash(bytes) performance?


> Is it possible to let code objects use other types? In addition to ob_hash, 
> maybe the extra byte \x00 at the end can be saved.

Of course, it is possible. But it needs large refactoring around code, 
including pyc cache file format.
I will try it before 3.13.

--

___
Python tracker 

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



[issue47106] test_asyncio: test_shutdown_cleanly() failed with timeout (10 seconds) on slow x86 Gentoo Non-Debug with X 3.x

2022-03-24 Thread STINNER Victor


New submission from STINNER Victor :

test_shutdown_cleanly() of test_asyncio failed on x86 Gentoo Non-Debug with X 
3.x with a timeout of 10 seconds:
https://buildbot.python.org/all/#/builders/58/builds/1958

asyncio uses a default timeout of 60 seconds for a TLS handshake, but the test 
takes makes 6x shorter: use a timeout of 10 seconds, I'm not sure why.

To support slow buildbots, I would suggest to use *longer* timeout than the 
default, not *shorter* timeouts.

test_ssl uses various values for the TLS timeout:

* 1.0 second
* 10.0 seconds
* 40.0 seconds
* 60.0 seconds

Would it be possible to make these values more consistent?

You may want to use on of test.support timeout which has a value depending on 
regrtest --timeout parameter: on slow buildbots, these values are larger.

* LOOPBACK_TIMEOUT
* SHORT_TIMEOUT
* LONG_TIMEOUT
* INTERNET_TIMEOUT
* Documentation: 
https://docs.python.org/dev/library/test.html#test.support.LOOPBACK_TIMEOUT

I would recommend using SHORT_TIMEOUT.

x86 Gentoo Non-Debug with X 3.x uses "--timeout=2100" option:

"0:00:00 load avg: 2.89 Run tests in parallel using 2 child processes (timeout: 
35 min, worker timeout: 40 min)"


Logs:

0:35:34 load avg: 3.13 Re-running test_asyncio in verbose mode (matching: 
test_shutdown_cleanly)
test_shutdown_cleanly (test.test_asyncio.test_ssl.TestSSL) ... Warning -- 
Uncaught thread exception: AssertionError
Exception in thread test-server:
Traceback (most recent call last):
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1706, in _run
self._handle_client(conn)
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1717, in _handle_client
self._prog(TestSocketWrapper(sock))
^^^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1183, in server
sock.unwrap()
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/ssl.py", 
line 1321, in unwrap
s = self._sslobj.shutdown()
^^^
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/threading.py",
 line 1031, in _bootstrap_inner
self.run()
^^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1675, in run
self._run()
^^^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1714, in _run
self._test._abort_socket_test(ex)
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 163, in _abort_socket_test
self.fail(ex)
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/unittest/case.py",
 line 671, in fail
raise self.failureException(msg)

AssertionError: The read operation timed out
ERROR

Stderr:
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/threading.py:1033:
 ResourceWarning: unclosed 
  self._invoke_excepthook(self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/asyncio/selector_events.py:834:
 ResourceWarning: unclosed transport <_SelectorSocketTransport fd=27>
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

==
ERROR: test_shutdown_cleanly (test.test_asyncio.test_ssl.TestSSL)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/contextlib.py",
 line 155, in __exit__
self.gen.throw(typ, value, traceback)
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 155, in _silence_eof_received_warning
yield
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1228, in test_shutdown_cleanly
run(client)
^^^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_asyncio/test_ssl.py",
 line 1222, in run
self.loop.run_until_complete(
^
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/asyncio/base_events.py",
 line 650, in run_until_complete
return future.result()
   

[issue46864] Deprecate ob_shash in BytesObject

2022-03-24 Thread Ma Lin

Ma Lin  added the comment:

> I posted remove-bytes-hash.patch in this issue. Would you measure how this 
> affects whole application performance rather than micro benchmarks?

I guess not much difference in benchmarks.
But if put a bytes object into multiple dicts/sets, and len(bytes_key) is 
large, it will take a long time. (1 GiB 0.40 seconds on i5-11500 DDR4-3200)
The length of bytes can be arbitrary,so computing time may be very different.

Is it possible to let code objects use other types? In addition to ob_hash, 
maybe the extra byte \x00 at the end can be saved.

--

___
Python tracker 

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