[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Charlie Zhao


Change by Charlie Zhao :


--
pull_requests: +29913
pull_request: https://github.com/python/cpython/pull/31815

___
Python tracker 

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



[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi


Ruishi  added the comment:

I see. It's my misunderstanding. Thank you for your help!

--

___
Python tracker 

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



[issue46920] Remove code made dead long ago with #if 0

2022-03-10 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
pull_requests: +29912
pull_request: https://github.com/python/cpython/pull/31814

___
Python tracker 

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



[issue46920] Remove code made dead long ago with #if 0

2022-03-10 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
pull_requests: +29911
pull_request: https://github.com/python/cpython/pull/31813

___
Python tracker 

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



[issue46920] Remove code made dead long ago with #if 0

2022-03-10 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
pull_requests: +29910
pull_request: https://github.com/python/cpython/pull/31812

___
Python tracker 

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



[issue46920] Remove code made dead long ago with #if 0

2022-03-10 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
pull_requests: +29909
pull_request: https://github.com/python/cpython/pull/31811

___
Python tracker 

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



[issue46761] functools.update_wrapper breaks the signature of functools.partial objects

2022-03-10 Thread Larry Hastings


Larry Hastings  added the comment:

Nobody I've nosied on this issue recently has expressed any opinion on the 
matter.  I'm gonna try one more person: Graham Dumpleton, the maintainer of 
"wrapt", Python's premier function-wrapping.

Graham, care to express any opinions about this issue?  Can we fix it without 
causing widespread wailing and gnashing of teeth?  Do you think people are 
depending on the current how-can-you-describe-it-as-anything-but-broken 
behavior?

--
nosy: +grahamd

___
Python tracker 

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



[issue9182] document “--” as a way to distinguish option w/ narg='+' from positional argument in argparse

2022-03-10 Thread Stanley


Change by Stanley :


--
nosy: +slateny
nosy_count: 13.0 -> 14.0
pull_requests: +29908
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/31810

___
Python tracker 

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



[issue39829] __len__ called twice in the list() constructor

2022-03-10 Thread Inada Naoki


Inada Naoki  added the comment:

> Changes compared here: 
> https://github.com/python/cpython/compare/main...thatbirdguythatuknownot:patch-17


Looks good to me. Would you create a pull request?

--

___
Python tracker 

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



[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Charlie Zhao


Change by Charlie Zhao :


--
pull_requests: +29907
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/31808

___
Python tracker 

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



[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

This is the right place to file an issue.

Your code is incorrect; it will find only top-level functions. Functions within 
an `if` statement will be nested inside an `ast.If` node. To find all functions 
in a file, you'll need to recurse into nested nodes. For example, you could use 
`ast.walk`, an `ast.NodeVisitor`, or manually check for nodes like `ast.If`. 
Which one is best depends on your needs. For example, the first two will also 
find methods in classes. The ast module documentation has more information.

--
nosy: +Jelle Zijlstra
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



[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi


Ruishi  added the comment:

I'm not sure whether I should file this issue here or on Github and I'm not an 
expert on this so I think I cannot contribute to this but only report to you.

--

___
Python tracker 

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



[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi


New submission from Ruishi :

When I use the Python ast package to get the functions of Python files, I find 
the functions defined in the body of `if` statement cannot be recognized.

Here is my code:
with open(py_file, 'r') as f:
data = f.read()
module = ast.parse(data)
func_def = [node for node in module.body if isinstance(node, 
ast.FunctionDef)]

Here is an example of Python file:
if supports_bytes_environ:
def _check_bytes(value):
if not isinstance(value, bytes):
raise TypeError("bytes expected, not %s" % type(value).__name__)
return value

The function `_check_bytes` is not in `func_def`. I also tested 
`ast.iter_child_nodes(module)` and it also has this issue.

--
components: Parser
messages: 414886
nosy: Ruishi, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: ast.FunctionDef cannot find functions under if statement
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue46971] python takes long time when return big data

2022-03-10 Thread Hu Di


Hu Di <476658...@qq.com> added the comment:

I am currently processing large data, and the time spent by del is 
unacceptable. Is there any way to process del in parallel?

--

___
Python tracker 

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



[issue46881] Statically allocate and initialize the latin1 characters.

2022-03-10 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra
nosy_count: 5.0 -> 6.0
pull_requests: +29906
pull_request: https://github.com/python/cpython/pull/31805

___
Python tracker 

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



[issue46892] Async Call-Stack Reconstruction

2022-03-10 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

> We’d like to merge our implementation into CPython

Could you provide a link first, please?

--

___
Python tracker 

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



[issue46971] python takes long time when return big data

2022-03-10 Thread Hu Di


Hu Di <476658...@qq.com> added the comment:

thanks for your explaining, by the way, why it costs lots of time when del  
 a large array?

--

___
Python tracker 

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-10 Thread Carl Meyer


Carl Meyer  added the comment:

I've updated the PR to split `PyDict_EVENT_MODIFIED` into separate 
`PyDict_EVENT_ADDED`, `PyDict_EVENT_MODIFIED`, and `PyDict_EVENT_DELETED` event 
types. This allows callbacks only interested in e.g. added keys (case #2) to 
more easily and cheaply skip uninteresting events.

--

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


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

___
Python tracker 

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



[issue43224] Add support for PEP 646

2022-03-10 Thread Matthew Rahtz


Change by Matthew Rahtz :


--
pull_requests: +29905
pull_request: https://github.com/python/cpython/pull/31804

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 4199b7ffbbaa5fe52a4c85c8672ac6773a75ba8f by Jelle Zijlstra in 
branch '3.10':
[3.10] bpo-46198: rename duplicate tests and remove unused code (GH-30297) 
(GH-31796)
https://github.com/python/cpython/commit/4199b7ffbbaa5fe52a4c85c8672ac6773a75ba8f


--

___
Python tracker 

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-10 Thread Bernie Hackett


Change by Bernie Hackett :


--
nosy: +behackett

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 4052dd2296da2ff304b1fa787b100befffa1c9ca by Alex Waygood in 
branch 'main':
bpo-46198: Fix `test_asyncio.test_sslproto` (GH-31801)
https://github.com/python/cpython/commit/4052dd2296da2ff304b1fa787b100befffa1c9ca


--

___
Python tracker 

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



[issue46744] installers on ARM64 suggest wrong folders

2022-03-10 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +29904
pull_request: https://github.com/python/cpython/pull/31803

___
Python tracker 

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



[issue46978] Doc strings for built-in, in-place operators are misleading

2022-03-10 Thread Nicko van Someren


Change by Nicko van Someren :


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

___
Python tracker 

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



[issue46979] Spam

2022-03-10 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
components:  -Build
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: Master piece -> Spam
type: security -> 

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset f7f7838b41d45efa129a61f104136f8e12f3488a by Jelle Zijlstra in 
branch '3.9':
[3.9] bpo-46198: rename duplicate tests and remove unused code (GH-30297) 
(GH-31797)
https://github.com/python/cpython/commit/f7f7838b41d45efa129a61f104136f8e12f3488a


--

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood
nosy_count: 3.0 -> 4.0
pull_requests: +29902
pull_request: https://github.com/python/cpython/pull/31801

___
Python tracker 

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



[issue46979] Master piece

2022-03-10 Thread Bankole Jesutofunmi


New submission from Bankole Jesutofunmi :

Protection

--
components: Build, Demos and Tools
messages: 414878
nosy: Banky_1104, teoliphant
priority: normal
severity: normal
status: open
title: Master piece
type: security
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



[issue46896] add support for watching writes to selected dictionaries

2022-03-10 Thread Carl Meyer


Carl Meyer  added the comment:

Thanks for outlining the use cases. They make sense.

The current PR provides a flexible generic API that fully supports all three of 
those use cases (use cases 2 and 3 are strict subsets of use case 1.) Since the 
callback is called before the dict is modified, all the necessary information 
is available to the callback to decide whether the event is interesting to it 
or not.

The question is how much of the bookkeeping to classify events as "interesting" 
or "uninteresting" should be embedded in the core dispatch vs being handled by 
the callback.

One reason to prefer keeping this logic in the callback is that with 
potentially multiple chained callbacks in play, the filtering logic must always 
exist in the callback, regardless. E.g. if callback A wants to watch only 
keys-version changes to dict X, but callback B wants to watch all changes to 
it, events will fire for all changes, and callback A must still disregard 
"uninteresting" events that it may receive (just like it may receive events for 
dicts it never asked to watch at all.) So providing API for different "levels" 
of watching means that the "is this event interesting to me" predicate must 
effectively be duplicated both in the callback and in the watch level chosen.

The proposed rationale for this complexity and duplication is the idea that 
filtering out uninteresting events at dispatch will provide better performance. 
But this is hypothetical: it assumes the existence of perf-bottleneck code 
paths that repeatedly rebind globals. The only benchmark workload with this 
characteristic that I know of is pystone, and it is not even part of the 
pyperformance suite, I think precisely because it is not representative of 
real-world code patterns. And even assuming that we do need to optimize for 
such code, it's also not obvious that it will be noticeably cheaper in practice 
to filter on the dispatch side.

It may be more useful to focus on API. If we get the API right, internal 
implementation details can always be adjusted in future if a different 
implementation can be shown to be noticeably faster for relevant use cases. And 
if we get existing API right, we can always add new API if we have to. I don't 
think anything about the proposed simple API precludes adding 
`PyDict_WatchKeys` as an additional feature, if it turns out to be necessary.

One modification to the simple proposed API that should improve the performance 
(and ease of implementation) of use case #2 would be to split the current 
`PyDict_EVENT_MODIFIED` into two separate event types: `PyDict_EVENT_MODIFIED` 
and `PyDict_EVENT_NEW_KEY`. Then the callback-side event filtering for use case 
#2 would just be `event == PyDict_EVENT_NEW_KEY` instead of requiring a lookup 
into the dict to see whether the key was previously set or not.

--

___
Python tracker 

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46978] Doc strings for built-in, in-place operators are misleading

2022-03-10 Thread Nicko van Someren


New submission from Nicko van Someren :

Objects/typeobject.c uses slots to implement various operators and the IBSLOT 
macro is used to define slot entries for in-place binary operators. This macro 
creates a __doc__ string for the operators of the form "Return selfvalue."

This doc string is misleading since an in-place operator statement can not be 
used as an L-value, so nothing is "returned".

To fix this, the macro definition for IBSLOT should be updated to use a 
different word or phrase, such as "Compute selfvalue."

--
components: Interpreter Core
messages: 414876
nosy: nickovs
priority: normal
severity: normal
status: open
title: Doc strings for built-in, in-place operators are misleading
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



[issue43224] Add support for PEP 646

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue46969] `pip install wrapt` fails on ast.py in Python 3.11.0a6

2022-03-10 Thread Dutcho


Dutcho  added the comment:

yesterday's `wrapt *1.13.3*` still doesn't work,
but today's `wrapt *1.14.0*` works as expected

So this wasn't about Python 3.11 but about the wrapt version, which used the 
deprecated `formatargspec` from module `inspect`

--
resolution:  -> works for me
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



[issue43224] Add support for PEP 646

2022-03-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
nosy_count: 8.0 -> 9.0
pull_requests: +29901
pull_request: https://github.com/python/cpython/pull/31800

___
Python tracker 

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



[issue46976] Update macOS installer builds to use ncurses 6.3

2022-03-10 Thread Ned Deily


Ned Deily  added the comment:

Assigning to myself as this will require some installer build testing.

--
assignee:  -> ned.deily

___
Python tracker 

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



[issue46975] clang: error: linker command failed with exit code 1 (use -v to see invocation) on m1 mac

2022-03-10 Thread Ned Deily


Ned Deily  added the comment:

Without more details, this is only a guess but the messages seem to indicate 
that your build is detecting an installed version of the GNU gettext library, 
which is optional for Python builds and is not provided by default on macOS, 
and most likely that version is an Intel-only build of the package and its 
libintl shared library. Check whether you have an outdated version of gettext 
and libintl*.dylib installed somewhere, perhaps in /usr/local/, possibly via a 
third-party package manager like Homebrew or MacPorts, and either remove it or 
update it with a arm64 (or universal2 fat) build.

--

___
Python tracker 

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



[issue46913] UBSAN: test_ctypes, test_faulthandler and test_hashlib are failing

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

The crypt_r() interceptor issue was reported in January 2021 to libasan:
https://github.com/google/sanitizers/issues/1365

> I enabled the test on ASAN on test_crypt and I confirm that I get a crash on 
> calling a NULL function.

Note: I built Python with GCC ASAN (-fsanitize=address).

--

___
Python tracker 

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



[issue46977] tempfile.TemporaryDirectory fails removing dir in some edge cases related to symlinks

2022-03-10 Thread Alexandre Feblot


Change by Alexandre Feblot :


--
type:  -> crash

___
Python tracker 

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



[issue46977] tempfile.TemporaryDirectory fails removing dir in some edge cases related to symlinks

2022-03-10 Thread Alexandre Feblot


New submission from Alexandre Feblot :

```python
#!/usr/bin/env python3

import os
import tempfile

def createUnremovableDir(workdir):
print(workdir)
os.mkdir(f'{workdir}/mydir')
os.symlink('/bin/bash', f'{workdir}/mydir/mylink') # Symlink to a root 
owned file
os.chmod(f'{workdir}/mydir', 0o555)

with tempfile.TemporaryDirectory() as workdir:
createUnremovableDir(workdir)
```

Fails because `tempfile.TemporaryDirectory._rmtree` tries to execute 
os.chmod(path, 0o700) on the symlink, which by default tries to change the root 
owned file symlink target instead of the symlink itself:

```
/tmp/tmp1_dy42ef
Traceback (most recent call last):
  File "/usr/lib/python3.9/shutil.py", line 682, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'mylink'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/tempfile_demo_bug.py", line 13, in 
createUnremovableDir(workdir)
  File "/usr/lib/python3.9/tempfile.py", line 969, in __exit__
self.cleanup()
  File "/usr/lib/python3.9/tempfile.py", line 973, in cleanup
self._rmtree(self.name)
  File "/usr/lib/python3.9/tempfile.py", line 955, in _rmtree
_rmtree(name, onerror=onerror)
  File "/usr/lib/python3.9/shutil.py", line 727, in rmtree
_rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.9/shutil.py", line 664, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.9/shutil.py", line 684, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.9/tempfile.py", line 941, in onerror
resetperms(path)
  File "/usr/lib/python3.9/tempfile.py", line 936, in resetperms
_os.chmod(path, 0o700)
PermissionError: [Errno 1] Operation not permitted: 
'/tmp/tmp1_dy42ef/mydir/mylink'
```

and leaves:

```
(.venv python 3.9.9) $ find /tmp/tmp1_dy42ef -ls
   148228  4 drwx--   3 myuser myuser 4096 Mar 10 16:54 
/tmp/tmp1_dy42ef
   148229  4 drwx--   2 myuser myuser 4096 Mar 10 16:54 
/tmp/tmp1_dy42ef/mydir
   148230  0 lrwxrwxrwx   1 myuser myuser9 Mar 10 16:54 
/tmp/tmp1_dy42ef/mydir/mylink -> /bin/bash

```

This fixes it:

``` python
#!/usr/bin/env python3

import os
import tempfile

def createUnremovableDir(workdir):
print(workdir)
os.mkdir(f'{workdir}/mydir')
os.symlink('/bin/bash', f'{workdir}/mydir/mylink') # Symlink to a root 
owned file
os.chmod(f'{workdir}/mydir', 0o555)

def _rmtree(cls, name, ignore_errors=False):
def onerror(func, path, exc_info):
if issubclass(exc_info[0], PermissionError):
def resetperms(path):
try:
if os.chflags in os.supports_follow_symlinks:  # This is 
the patch
os.chflags(path, 0, follow_symlinks=False) # This is 
the patch
elif not os.path.islink(path): # This is 
the patch
os.chflags(path, 0)
except AttributeError:
pass
if os.chmod in os.supports_follow_symlinks:# This is 
the patch
os.chmod(path, 0o700, follow_symlinks=False)   # This is 
the patch
elif not os.path.islink(path): # This is 
the patch
os.chmod(path, 0o700)

try:
if path != name:
resetperms(os.path.dirname(path))
resetperms(path)

try:
os.unlink(path)
# PermissionError is raised on FreeBSD for directories
except (IsADirectoryError, PermissionError):
cls._rmtree(path, ignore_errors=ignore_errors)
except FileNotFoundError:
pass
elif issubclass(exc_info[0], FileNotFoundError):
pass
else:
if not ignore_errors:
raise

shutil.rmtree(name, onerror=onerror)

# Monkey patch the class method tempfile.TemporaryDirectory._rmtree
from types import MethodType
import shutil
tempfile.TemporaryDirectory._rmtree = MethodType(_rmtree, 
tempfile.TemporaryDirectory)

with tempfile.TemporaryDirectory() as workdir:
createUnremovableDir(workdir)

--
components: Library (Lib)
messages: 414871
nosy: afeblot
priority: normal
severity: normal
status: open
title: tempfile.TemporaryDirectory fails removing dir in some edge cases 
related to symlinks
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



[issue46913] UBSAN: test_ctypes, test_faulthandler and test_hashlib are failing

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

I enabled the test on ASAN on test_crypt and I confirm that I get a crash on 
calling a NULL function.

The Python crypt.crypt() function calls the C function crypt_r() which is 
intercepted by libasan, but the libasan implementation calls a NULL function. I 
don't know why.

$ ./configure --with-address-sanitizer --with-pydebug
$ make clean
$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" make
$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" gdb 
-args ./python -m test -v test_crypt 
(gdb) run
(...)
0:00:00 load avg: 0.53 Run tests sequentially
0:00:00 load avg: 0.53 [1/1] test_crypt

Program received signal SIGSEGV, Segmentation fault.
0x in ?? ()

(gdb) where
#0  0x in ?? ()
#1  0x7761189f in __interceptor_crypt_r.part.0 () from 
/lib64/libasan.so.6
#2  0x7fffe6a40821 in crypt_crypt_impl (module=, word=0xfcb050 
 "", salt=0x6080004bc660 
"$6$d8Imx7a5WbE12iK4")
at /home/vstinner/python/main/Modules/_cryptmodule.c:44
#3  0x7fffe6a40695 in crypt_crypt (module=, args=0x62901368, nargs=2) at 
/home/vstinner/python/main/Modules/clinic/_cryptmodule.c.h:58
(...)

$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" 
./python -m test -v test_crypt 
(...)
0:00:00 load avg: 0.56 Run tests sequentially
0:00:00 load avg: 0.56 [1/1] test_crypt
Fatal Python error: Segmentation fault

Current thread 0x7f367c6c77c0 (most recent call first):
  File "/home/vstinner/python/main/Lib/crypt.py", line 82 in crypt
  File "/home/vstinner/python/main/Lib/crypt.py", line 94 in _add_method
  File "/home/vstinner/python/main/Lib/crypt.py", line 105 in 
  File "", line 241 in _call_with_frames_removed
  File "", line 931 in exec_module
  File "", line 690 in _load_unlocked
  File "", line 1149 in _find_and_load_unlocked
  File "", line 1178 in _find_and_load
  File "/home/vstinner/python/main/Lib/test/test_crypt.py", line 6 in 
  (...)

--

___
Python tracker 

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



[issue46976] Update macOS installer builds to use ncurses 6.3

2022-03-10 Thread Ned Deily


New submission from Ned Deily :

The python.org macOS installers include a private copy of the ncurses library; 
it has not been updated from 5.9 in a long time. The current upstream version 
is 6.3 and includes bug and security fixes; we should update to it.

--
components: macOS
messages: 414869
nosy: ned.deily, ronaldoussoren
priority: high
severity: normal
stage: needs patch
status: open
title: Update macOS installer builds to use ncurses 6.3
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



[issue46973] Provide make target to regenerate autoconf files with container

2022-03-10 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 434ffb7f1f86e6b0cdfad3ede59993934d86e464 by Christian Heimes in 
branch 'main':
bpo-46973: Add regen-configure make target (GH-31792)
https://github.com/python/cpython/commit/434ffb7f1f86e6b0cdfad3ede59993934d86e464


--

___
Python tracker 

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



[issue46913] UBSAN: test_ctypes, test_faulthandler and test_hashlib are failing

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

Current status of tests skipped on ASAN, MSAN and UBSAN.

Only ASAN (1):

* _test_multiprocessing.py:76:if support.check_sanitizer(address=True):

ASAN and MSAN (10):

* test___all__.py:14:if support.check_sanitizer(address=True, memory=True):
* test_concurrent_futures.py:35:if support.check_sanitizer(address=True, 
memory=True):
* test_crypt.py:7:if check_sanitizer(address=True, memory=True):
* test_decimal.py:5510:@unittest.skipIf(check_sanitizer(address=True, 
memory=True),
* test_idle.py:5:if check_sanitizer(address=True, memory=True):
* test_peg_generator/__init__.py:7:if support.check_sanitizer(address=True, 
memory=True):
* test_tix.py:7:if check_sanitizer(address=True, memory=True):
* test_tk.py:6:if check_sanitizer(address=True, memory=True):
* test_tools/__init__.py:10:if support.check_sanitizer(address=True, 
memory=True):
* test_ttk_guionly.py:6:if check_sanitizer(address=True, memory=True):

Only UB (1):

* test_hashlib.py:68:SKIP_SHA3 = support.check_sanitizer(ub=True)

--

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

> Remove code handling missing NAN and infinity: float("nan"), float("inf"), 
> math.nan and math.inf are always available.

The code to support missing NaN was already removed by:

New changeset 1b2611eb0283055835e5df632a7a735db8c894b8 by Victor Stinner in 
branch 'main':
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
https://github.com/python/cpython/commit/1b2611eb0283055835e5df632a7a735db8c894b8

In fact, math.inf is already always available in Python 3.10 and older. There 
was no "#ifdef" for missing infinity support. In Python 3.10, math.inf is 
implemented as:

static double
m_inf(void)
{
#ifndef PY_NO_SHORT_FLOAT_REPR
return _Py_dg_infinity(0);
#else
return Py_HUGE_VAL;
#endif
}

--

___
Python tracker 

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-46917: math.nan is now always available (GH-31793)

Technically, it was already the case in practice: see bpo-46656 for the 
rationale and the history of Py_NAN.

--

___
Python tracker 

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



[issue46656] Remove the Py_NO_NAN macro: require NAN to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-46656: Remove Py_NO_NAN macro (GH-31160)

Change documented by:

New changeset 7854012077009b9f364f198a8ae38b546ec58313 by Victor Stinner in 
branch 'main':
bpo-46917: math.nan is now always available (GH-31793)
https://github.com/python/cpython/commit/7854012077009b9f364f198a8ae38b546ec58313

--

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7854012077009b9f364f198a8ae38b546ec58313 by Victor Stinner in 
branch 'main':
bpo-46917: math.nan is now always available (GH-31793)
https://github.com/python/cpython/commit/7854012077009b9f364f198a8ae38b546ec58313


--

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-46906 "Add PyFloat_(Pack|Unpack)(2|4|8) to the public C API": the 
implementation supports non-IEEE 754 formats. Once the public C API is added, 
support for non-IEEE 754 formats should be removed.

--

___
Python tracker 

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



[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

(assigning to myself to remind myself to see the backports through)

--
assignee: docs@python -> Jelle Zijlstra

___
Python tracker 

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



[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 8a207e0321db75f3342692905e342f1d5e1add54 by Charlie Zhao in 
branch 'main':
bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs 
(GH-31349)
https://github.com/python/cpython/commit/8a207e0321db75f3342692905e342f1d5e1add54


--

___
Python tracker 

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



[issue46975] clang: error: linker command failed with exit code 1 (use -v to see invocation) on m1 mac

2022-03-10 Thread Battant


New submission from Battant :

Hello,

Here is my configuration

mac os 12.2.1
mac m1 pro 2021

step to reproduce
1. on mac m1, clone cpython repository main branch
run
./confugure
make
Actual result :
gcc   -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   -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)
make[3]: *** [python.exe] Error 1
make[3]: *** Waiting for unfinished jobs
make[3]: *** [Programs/_testembed] 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 fix this issus ?

Best regards

Battant

--
components: macOS
messages: 414859
nosy: Battant, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: clang: error: linker command failed with exit code 1 (use -v to see 
invocation) on m1 mac
type: compile error
versions: Python 3.11

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
pull_requests: +29900
pull_request: https://github.com/python/cpython/pull/31797

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-03-10 Thread Alex Grönholm

Alex Grönholm  added the comment:

Yeah, I'm still interested. I'll create a new BPO when I have something.

--

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
pull_requests: +29899
pull_request: https://github.com/python/cpython/pull/31796

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-03-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Good think I forgot to close the issue. ;-)

--

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-03-10 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The implementation has landed, docs are still required.

--

___
Python tracker 

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 6c83c8e6b56b57a8a794e7b6c07837be4ce3bb97 by Nikita Sobolev in 
branch 'main':
bpo-46198: rename duplicate tests and remove unused code (GH-30297)
https://github.com/python/cpython/commit/6c83c8e6b56b57a8a794e7b6c07837be4ce3bb97


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-03-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm closing this, the asyncio.timeout() context manager has been merged. Thanks 
Andrew!

@agronholm you said you were interested in tweaking the cancellation behavior 
some more. If you're still interested, let's discuss that in a separate bpo 
(please +nosy me if you create one).

--

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-03-10 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset f537b2a4fb86445ee3bd6ca7f10bc9d3a9f37da5 by Andrew Svetlov in 
branch 'main':
bpo-46771: Implement asyncio context managers for handling timeouts (GH-31394)
https://github.com/python/cpython/commit/f537b2a4fb86445ee3bd6ca7f10bc9d3a9f37da5


--

___
Python tracker 

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



[issue35677] Do not automount in stat() by default

2022-03-10 Thread Pádraig Brady

Pádraig Brady  added the comment:

I think this change is not needed as fstatat() implies AT_NO_AUTOMOUNT since 
Linux 4.11
The fstatat(2) man page is confusing, and I've attempted to clarify with the 
patch attached to:
https://lists.gnu.org/archive/html/coreutils/2022-03/msg00014.html

--
nosy: +pixelbeat

___
Python tracker 

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



[issue45767] Fix types for dev_t processing in posix module

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 31794 supports NODEV and checks for integer overflows.

--

___
Python tracker 

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



[issue45767] Fix types for dev_t processing in posix module

2022-03-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29898
pull_request: https://github.com/python/cpython/pull/31794

___
Python tracker 

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 32bf3597922ac3f613989582afa2bff43bea8a2f by Matt Bogosian in 
branch 'main':
bpo-46581: Propagate private vars via _GenericAlias.copy_with (GH-31061)
https://github.com/python/cpython/commit/32bf3597922ac3f613989582afa2bff43bea8a2f


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46974] set function for lists on numbers, sometimes sorts elements from smallest to largest, and sometimes not

2022-03-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is expected behavior. A set has no defined order. If you convert a set to 
a list, and you want some specific order, you'll need to sort it yourself.

--
nosy: +eric.smith
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



[issue46974] set function for lists on numbers, sometimes sorts elements from smallest to largest, and sometimes not

2022-03-10 Thread PiTeR


New submission from PiTeR :

set function for lists on numbers, sometimes sorts elements from smallest to 
largest, and sometimes not
to find this bug, sometimes you need to display the result several times
example code:
def tupla():
import random
ilosc = random.randint(0,49)
n=0
lista=[]
i=0
while True:
n = random.randint(1,100)
lista.append(n)
i=i+1
if i==ilosc-1:
break
lista = set(lista)
list(lista)
print(lista)

--
components: Windows
files: bug_1.PNG
messages: 414848
nosy: paul.moore, pio.paluchowski, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: set function for lists on numbers, sometimes sorts elements from 
smallest to largest, and sometimes not
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50666/bug_1.PNG

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29897
pull_request: https://github.com/python/cpython/pull/31793

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9b51fd5d137b662c940f072297b30815f37f105b by Victor Stinner in 
branch 'main':
bpo-46917: Require IEEE 754 to build Python (GH-31790)
https://github.com/python/cpython/commit/9b51fd5d137b662c940f072297b30815f37f105b


--

___
Python tracker 

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



[issue46973] Provide make target to regenerate autoconf files with container

2022-03-10 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue46973] Provide make target to regenerate autoconf files with container

2022-03-10 Thread Christian Heimes


New submission from Christian Heimes :

CPython stores auto-generated autoconf files (configure, aclocal.m4, 
pyconfig.h.in) in git. The files must be regenerated with very specific 
versions of autotools 2.69 + runtimestate patch, autoarchive, and pkg-config's 
m4 macros. I provide a container image based on Alpine 3.13 for automation and 
CI.

Let's add a build target to make it easier for contributors to regenerate the 
files and utilize the container images. The command needs a container runtime 
(podman, docker), though.

--
assignee: christian.heimes
components: Build
messages: 414846
nosy: brett.cannon, christian.heimes, gregory.p.smith
priority: normal
severity: normal
status: open
title: Provide make target to regenerate autoconf files with container
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



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

2022-03-10 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset de554d6e02228b840eb6bffaf7d406c0ef368d5f by Christian Heimes in 
branch 'main':
bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)
https://github.com/python/cpython/commit/de554d6e02228b840eb6bffaf7d406c0ef368d5f


--

___
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-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy:  -serhiy.storchaka

___
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-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Eric. The existing documentation looks pretty clear to me. Any 
exception can be raised explicitly, no need to repeat this.

And unittest.TestCase methods do not raise AssertionError. They raise 
TestCase.failureException, which by default is set to AssertionError. It is 
specified in the corresponding module documentation.

--
nosy: +serhiy.storchaka
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



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

2022-03-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

> I would argue that "The reference documentation for X states that it gets 
> raised under condition Y" generally should be understood as "this is a 
> guarantee that also includes the guarantee that it is not raised under other 
> conditions in correctly written code".

That's definitely not the case in Python, though.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue46971] python takes long time when return big data

2022-03-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

This is expected. Your timing measures the time for garbage collection of the 
large arrays in addition to the time for the result to be returned.

In the line `result = myfunc()`, the name `result` gets rebound to the value of 
`myfunc()`. That means that `result` is unbound from whatever it was previously 
bound to, and the old value then gets garbage collected.

You can test this by adding a "del result" line as the last line inside the 
"for" loop block.

--
nosy: +mark.dickinson
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



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

2022-03-10 Thread Thomas Fischbacher


Thomas Fischbacher  added the comment:

The documentation of exceptions in the reference is one of the places that 
makes the life of users substantially harder than it ought to be, since the 
documentation appears to not have been written with the intent to give 
guarantees that users can expect correctly written code to follow.

I would argue that "The reference documentation for X states that it gets 
raised under condition Y" generally should be understood as "this is a 
guarantee that also includes the guarantee that it is not raised under other 
conditions in correctly written code".

Other languages often appear to be somewhat stricter w.r.t. interpreting the 
reference documentation as binding for correct code - and for Python, having 
this certainly would help a lot when writing code that can give binding 
guarantees.

--

___
Python tracker 

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



[issue39829] __len__ called twice in the list() constructor

2022-03-10 Thread Jeremiah Pascual


Jeremiah Pascual  added the comment:

Matt's idea leads to some speedups when implemented correctly (pardon me but I 
have no idea how to use pyperf):

list({}): Mean +- std dev: [orig] 109 ns +- 1 ns -> [modif] 103 ns +- 1 ns: 
1.06x faster
list({1: 2}): Mean +- std dev: [orig] 125 ns +- 1 ns -> [modif] 118 ns +- 1 ns: 
1.05x faster
list({(1, 2, 3): 4}): Mean +- std dev: [orig] 125 ns +- 1 ns -> [modif] 118 ns 
+- 1 ns: 1.05x faster
list((3, 3, 4)): Mean +- std dev: [orig] 89.2 ns +- 4.5 ns -> [modif] 82.9 ns 
+- 4.6 ns: 1.08x faster
list(()): Mean +- std dev: [orig] 70.1 ns +- 0.8 ns -> [modif] 65.5 ns +- 0.8 
ns: 1.07x faster
list({0, 1, 2, ...}): Mean +- std dev: [orig] 74.7 us +- 3.6 us -> [modif] 67.6 
us +- 1.6 us: 1.11x faster
list({9, 3}): Mean +- std dev: [orig] 131 ns +- 2 ns -> [modif] 126 ns +- 4 ns: 
1.04x faster
list(set()): Mean +- std dev: [orig] 115 ns +- 6 ns -> [modif] 110 ns +- 2 ns: 
1.05x faster
list([]): Mean +- std dev: [orig] 73.2 ns +- 5.5 ns -> [modif] 67.8 ns +- 3.4 
ns: 1.08x faster
list([1, 2, 1, 1]): Mean +- std dev: [orig] 93.5 ns +- 9.8 ns -> [modif] 87.9 
ns +- 8.6 ns: 1.06x faster
list([1, 2, 1, 2, 1, 2]): Mean +- std dev: [orig] 93.0 ns +- 3.1 ns -> [modif] 
87.0 ns +- 2.7 ns: 1.07x faster

Benchmark hidden because not significant (3): list({0: 0, 1: ...}), list((4, 5, 
1, ...)), list([4, 1, 3, ...])

Geometric mean: 1.05x faster

Changes compared here: 
https://github.com/python/cpython/compare/main...thatbirdguythatuknownot:patch-17

--
nosy: +Crowthebird

___
Python tracker 

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-10 Thread Mark Shannon


Mark Shannon  added the comment:

There are three kinds of changes that we might want to watch (that I can think 
of right now):

1. Any change.
   Rather coarse and potentially expensive. Used by Cinder.
2. A new key being added (or a change to the keys version as a proxy).
   Useful for detect shadowing of builtins by module globals, would save the 
keys version check for the module dict in `LOAD_GLOBAL_BUILTINS` and a version 
check in some `LOAD_METHOD` specializations.
3. The value corresponding to a particular key.
   With this we could effectively convert both `LOAD_GLOBAL` specializations 
into a constant, given an effective way to de-optimize.


One way to support the three cases above would be to replace the dict version 
with a pointer to a data structure describing what it watched.
If the pointer is `NULL`, then nothing is being watched.
The data structure would need 2 bits to cover cases 1 and 2, and 1 bit (or 
byte) for each key in the dict keys (or case 1 could be implemented by setting 
all the bits for case 3).

--

___
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-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

The documentation doesn't say that assert statements are the only place 
AssertionError is raised, so I don't think it's incorrect.

> From this, one can infer the guarantee "the -O flag will suppress 
> AssertionError exceptions from being raised".

I don't think that follows from what the documentation says. It's only talking 
about assert statements.

This is equivalent to StopIteration: it is commonly raised by exhausting 
iterators, but it can be raised elsewhere. Or KeyError: the docs say "Raised 
when a mapping (dictionary) key is not found in the set of existing keys", but 
I've raised them in my own code.

> An assert[{add reference to `assert` definition}] statement fails, or a unit 
> testing related assert{...}() callable detects an assertion violation.

I think that's also misleading, and not an improvement. Why focus just on 
testing? It can certainly be raised elsewhere.

If anything, I think maybe add a note at the top of the list of Concrete 
Exceptions saying these are common ways these exceptions are raised, but they 
can be raised elsewhere. But I'm -0 on such a change.

--
nosy: +eric.smith

___
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-10 Thread Thomas Fischbacher


New submission from Thomas Fischbacher :

The Python reference says:

(1) https://docs.python.org/3/library/exceptions.html#concrete-exceptions

exception AssertionError
Raised when an assert statement fails.

(2) https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement

"assert ..." is equivalent to "if __debug__: ..."

>From this, one can infer the guarantee "the -O flag will suppress 
>AssertionError exceptions from being raised".

However, there is code in the Python standard library that does a direct "raise 
AssertionError" (strictly speaking, in violation of (1)), and it is just 
reasonable to assume that other code following the design of that would then 
also want to do a direct "raise AssertionError".

This happens e.g. in many methods defined in: unittest/mock.py

The most appropriate fix here may be to change the documentation to not say:

===
exception AssertionError
Raised when an assert statement fails.
===

but instead:

===
exception AssertionError
An assert[{add reference to `assert` definition}] statement fails, or a unit 
testing related assert{...}() callable detects an assertion violation.
===

--
messages: 414837
nosy: tfish2
priority: normal
severity: normal
status: open
title: Documentation: Reference says AssertionError is raised by `assert`, but 
not all AssertionErrors are.

___
Python tracker 

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



[issue46971] python takes long time when return big data

2022-03-10 Thread Hu Di


New submission from Hu Di <476658...@qq.com>:

it takes a long time when python return big data.
generally, when a function return something, it only take less than 1e-5 second,
but when the result is big, like np.random.rand(2048,3,224,224), the time cost 
will increase to 0.1-0.2 second

--
Added file: https://bugs.python.org/file50665/python_performance_issue.py

___
Python tracker 

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



[issue46971] python takes long time when return big data

2022-03-10 Thread Hu Di


Change by Hu Di <476658...@qq.com>:


--
components: Interpreter Core
nosy: HumberMe
priority: normal
severity: normal
status: open
title: python takes long time when return big data
type: performance
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



[issue35164] socket.getfqdn and socket.gethostbyname fail on MacOS

2022-03-10 Thread Sorin Sbarnea


Sorin Sbarnea  added the comment:

Maybe I should mention that my networking is configured only with values 
received from the DHCP server, which includes 2 DNS servers, one ipv4 an done 
ipv6, both of them being the local router and *1* search domain, which is a 
real domain (not local).

--

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


Change by Christian Heimes :


--
pull_requests: +29895
pull_request: https://github.com/python/cpython/pull/31791

___
Python tracker 

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



[issue35164] socket.getfqdn and socket.gethostbyname fail on MacOS

2022-03-10 Thread Sorin Sbarnea


Sorin Sbarnea  added the comment:

I am able to reproduce this bug with Python 3.10 on MacOS 12.2 too, and I 
happen to have some extra insights about what happens, see 
https://github.com/tox-dev/tox/issues/2375

Basically the culprit is a reverse-dns query (PTR) that takes 30s to return, 
causing that very long delay. It appears that mDNSResponder is able to cache 
the result for some time but not very long, so it will happen again.

In my particular case that PTR query is an .ip6.arpa one and there is no ipv4 
query made at all.

I was not able to identify any similar delay while calling `scutil --get 
HostName` or `hostname`, but `socket.getfqdn()` does reproduce it reliably.

Interestingly, it seems that the delay is at least sometimes 15s, maybe the 
delay of 30s I observed on tox was caused by two calls.

Anyway, I am more than interested in finding a solution for this issue. Such a 
delays can be a real dealbreaker even for cli tools.

--
versions: +Python 3.10, 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



[issue45033] Calls to PyErr_PrintEx in destructors cause calling async functions to incorrectly return None

2022-03-10 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue44035] Regenerating the configure script fails even if dependencies are satisfied

2022-03-10 Thread Christian Heimes


Christian Heimes  added the comment:

PS: You have to use the "269" tag to get the correct container image. The 
"latest" image was outdated and I removed it.

docker run -v (pwd):/src quay.io/tiran/cpython_autoconf:269

--

___
Python tracker 

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



[issue45319] Possible regression in __annotations__ descr for heap type subclasses

2022-03-10 Thread Larry Hastings


Larry Hastings  added the comment:

I only did my experiments with the _wrappers.c Christian gave me.  If that's 
not the shipping version of wrapt, and wrapt doesn't exhibit this behavior in 
3.10, then that's good.  I agree you can wait to address this behavior until it 
affects code you actually plan to ship.

--

___
Python tracker 

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



[issue46917] Require IEEE 754 floating point to build Python 3.11

2022-03-10 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45319] Possible regression in __annotations__ descr for heap type subclasses

2022-03-10 Thread Graham Dumpleton


Graham Dumpleton  added the comment:

Let me try and summarise what I do understand about this.

The existing wrapt code as written and its tests, work fine for Python 2.7 and 
3.6-3.11. No special case handling is done in tests related to checking 
annotations that I can remember.

The only reason this issue came up is because Christian tried to convert wrapt 
C code to only use the limited API and stable ABI, and as a result the existing 
test suite then started to fail for newer versions of Python (3.10+) on tests 
related to annotations, because the way the limited API and stable ABI for 
Python 3.10+ didn't behave the same as it did in older versions.

So if wrapt doesn't change to use the limited API and stable ABI then wrapt 
doesn't need to make any changes as it all seems to work fine when using the 
older APIs.

For the time being therefore at least it seems wrapt doesn't need to make any 
changes, since switching to the limited API and stable ABI is not a confirmed 
direction yet, and can't be done anyway until at least Python 2.7 support is 
dropped, and perhaps some Python 3.X version support as well.

--

___
Python tracker 

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What about mix-ins or abstract base classes?

class VecMixin:
def length(self):
return math.hypot(*self)

class Vec2D(NamedTuple, VecMixin):
x: float
y: float

class Vec3D(NamedTuple, VecMixin):
x: float
y: float
z: float

Currently you need to use the following trick to get a similar result:

class Vec2D(NamedTuple):
x: float
y: float

class Vec2D(Vec2D, VecMixin):
pass

--

___
Python tracker 

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