[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread hydroflask


hydroflask  added the comment:

Was reviewing the code and noticed that a double-free was introduced in the 
recent changes:

https://github.com/python/cpython/blob/dd76b3f7d332dd6eced5cbc2ad2adfc397700b3d/Modules/_ctypes/callbacks.c#L192

That line should have been removed in 
https://github.com/python/cpython/commit/b5527688aae11d0b5af58176267a9943576e71e5
 but it was missed!

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread hydroflask


hydroflask  added the comment:

Another bug, the array returned by alloca() should be zero-initialized. If an 
early return happens because of an intermediate error, Py_DECREF() will be 
called on uninitialized memory. Also it should be Py_XDECREF() I think.

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread hydroflask


hydroflask  added the comment:

Ignore the previous comment :)

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +29434
pull_request: https://github.com/python/cpython/pull/31272

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-11 Thread Christoph Reiter


Christoph Reiter  added the comment:

Sorry if off topic, but I noticed that CPython doesn't deprecate macros in 
code, while with gcc/clang it's possible to show compiler warnings for them 
using some pragma magic:

$ gcc a.c
a.c: In function 'main':
a.c:29:13: warning: Deprecated pre-processor symbol
   29 | PySomethingDeprecated (0);
  | ^~
a.c:30:13: warning: Deprecated pre-processor symbol: replace with 
"SomethingCompletelyDifferent"
   30 | PySomethingDeprecated2 (42);
  | ^~~~

Here is how glib implements this for example: 
https://gist.github.com/lazka/4749c74249a3918a059d944040aca4a3

Maybe that makes getting rid of them easier in the long run?

--
nosy: +lazka

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread Dong-hee Na


Dong-hee Na  added the comment:

> Was reviewing the code and noticed that a double-free was introduced in the 
> recent changes:

Thanks, that looks like my mistake

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread hydroflask


hydroflask  added the comment:

Easy one to make, might be worth adding a test that would have exercised that 
code path.

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-11 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 0ac5372bf6b937ed44a8f9c4e402d024fcd80870 by Dong-hee Na in branch 
'main':
bpo-46323: Fix double-free issue for borrowed refs (GH-31272)
https://github.com/python/cpython/commit/0ac5372bf6b937ed44a8f9c4e402d024fcd80870


--

___
Python tracker 

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



[issue46717] Raising exception multiple times leaks memory

2022-02-11 Thread Irit Katriel


Irit Katriel  added the comment:

"raise exc" adds the current frame to the traceback of exc. If you want to 
clear the previous traceback before raising you can do that with

raise exc.with_traceback(None)

--
resolution:  -> not a bug

___
Python tracker 

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



[issue46709] test_urllib: testInterruptCaught() has a race condition and fails randomly

2022-02-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue42698] Deadlock in pysqlite_connection_dealloc()

2022-02-11 Thread hydroflask


hydroflask  added the comment:

Any update on this? I know you wanted to repro but even in the absence of the 
repro, I think calling sqlite3_close() without releasing the GIL is 
error-prone. If there is no immediate plan to make this change you may close 
the issue :)

--

___
Python tracker 

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



[issue42698] Deadlock in pysqlite_connection_dealloc()

2022-02-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> Any update on this?

I was unable to reproduce this last time we visited this issue, but I'll give 
it another try.

> If there is no immediate plan to make this change you may close the issue :)

I do not want to close it until I can a) either prove that it is _not_ an 
issue, or b) prove that it _is_ an issue _and_ we've got a fix :)

--

___
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-02-11 Thread Charlie Zhao


Charlie Zhao  added the comment:

Indeed, if you use Python keywords or other invalid Python names as keys of 
TypedDict, we must use the equivalent forms as follows: 

```
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'in': str})  # OK

Point2D = TypedDict('Point2D', x=int, y=int, in=str)  # Error
```

Maybe we should add this to the docs.


And, it seems that adding examples for inheritance and attributes of TypedDict 
would make the docs clearer.

Would you mind if I submit a PR for those changes. :)

--
nosy: +CharlieZhao

___
Python tracker 

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



[issue46711] test_logging: test_post_fork_child_no_deadlock() failed with timeout on AMD64 Arch Linux Asan Debug 3.10

2022-02-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 1.0 -> 2.0
pull_requests: +29436
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31274

___
Python tracker 

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



[issue39355] The Python library will not compile with a C++2020 compiler because the code uses the reserved “module” keyword

2022-02-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> There will be huge changes for this issue as this keyword has been used in a 
> lot of places.

It should be sufficient to change only the exposed headers; that is Include/*.h 
and Include/cpython/*.h. We should also change the AC tool, since that may be 
used by external projects.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue39355] The Python library will not compile with a C++2020 compiler because the code uses the reserved “module” keyword

2022-02-11 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue39355] The Python library will not compile with a C++2020 compiler because the code uses the reserved “module” keyword

2022-02-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> There will be huge changes for this issue as this keyword has been used in a 
> lot of places.

For external extension modules, it should be sufficient to change only the 
exposed headers; that is Include/*.h and Include/cpython/*.h. We should also 
change the AC tool, since that may be used by external projects.

--

___
Python tracker 

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



[issue46709] test_urllib: testInterruptCaught() has a race condition and fails randomly

2022-02-11 Thread Kumar Aditya


Kumar Aditya  added the comment:

Same issue as https://bugs.python.org/issue46465, PR 
https://github.com/python/cpython/pull/30826 fixes this.

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 8b8673fe940c4ebc4512bff5af180b66def3d1ae by Petr Viktorin in 
branch '3.10':
[3.10] bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696) 
(GH-31262)
https://github.com/python/cpython/commit/8b8673fe940c4ebc4512bff5af180b66def3d1ae


--

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue44525] Implement CALL_FUNCTION adaptive interpreter optimizations

2022-02-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +sobolevn
nosy_count: 4.0 -> 5.0
pull_requests: +29437
pull_request: https://github.com/python/cpython/pull/31273

___
Python tracker 

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



[issue43216] Removal of @asyncio.coroutine in Python 3.11

2022-02-11 Thread Kumar Aditya


Kumar Aditya  added the comment:

Can this be closed now?

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue43216] Removal of @asyncio.coroutine in Python 3.11

2022-02-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Closed.
Thanks for the reminder!

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



[issue46718] Feature: iptertools: add batches

2022-02-11 Thread Марк Коренберг

New submission from Марк Коренберг :

I want a new function introduced in intertools. Something like this, but more 
optimal, and in C:

===
from itertools import chain, islice
from typing import Iterable, TypeVar

T = TypeVar('T')  # pylint: disable=invalid-name


def batches(items: Iterable[T], num: int) -> Iterable[Iterable[T]]:
items = iter(items)
while True:
try:
first_item = next(items)
except StopIteration:
break
yield chain((first_item,), islice(items, 0, num - 1))
===

Splits big arrays to iterable chunks of fixed size (except the last one). 
Similar to `group_by`, but spawns new iterable group based on the group size.

For example, when passing many record to a database, passing one by one is 
obviously too slow. Passing all the records at once may increase latency. So, a 
good solution is to pass, say, 1000 records in one transaction. The smae in 
REST API batches.

P.S. Yes, I saw solution  
https://docs.python.org/3/library/itertools.html#itertools-recipes `def 
grouper`, but it is not optimal for big `n` values.

--
components: Library (Lib)
messages: 413061
nosy: socketpair
priority: normal
severity: normal
status: open
title: Feature: iptertools: add batches
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-11 Thread Kumar Aditya


Kumar Aditya  added the comment:

Since it was reverted as it was beta period, Can this be committed again as 
3.11 is in alpha currently?  @asvetlov

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread STINNER Victor


STINNER Victor  added the comment:

> It also adds a precondition that's not feasible public API, which this was 
> meant to become

Do you plan to make the function public? It would be nice!

--

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-11 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +29438
pull_request: https://github.com/python/cpython/pull/31275

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> Do you plan to make the function public? It would be nice!

See https://github.com/python/cpython/pull/31081

--

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-11 Thread Kumar Aditya


Kumar Aditya  added the comment:

I created a draft PR by rebasing the old implementation of 3.10 for 3.11 so we 
can investigate the build-bots failure and fix them so this can be committed 
for 3.11.

See https://github.com/python/cpython/pull/31275

--

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-11 Thread Christian Heimes


Change by Christian Heimes :


--
nosy:  -christian.heimes

___
Python tracker 

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



[issue46337] urllib.parse: Allow more flexibility in schemes and URL resolution behavior

2022-02-11 Thread Éric Araujo

Éric Araujo  added the comment:

I remember a discussion about this years ago.
urllib is a module that pre-dates the idea of universal parsing for URIs, where 
the delimiters (like ://) are enough to determine the parts of a URI and give 
them meaning (host, port, user, path, etc).
Backward compat for urllib is always a concern; someone said at the time that 
it could be good to have a new module for modern, generic parsing, but that 
hasn’t happened.  Maybe a new parse function, or new parameter to the existing 
one, could be easier to add.

--
nosy: +brett.cannon, eric.araujo, lukasz.langa, orsenthil
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



[issue46718] Feature: itertools: add batches

2022-02-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +rhettinger, tim.peters
title: Feature: iptertools: add batches -> Feature: itertools: add batches

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-11 Thread Kumar Aditya


Change by Kumar Aditya :


--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue46718] Feature: itertools: add batches

2022-02-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For large n, I don't think a C implementation would do much better than your 
Python version where most of the work is done by chain() and islice() which are 
already in C.  The best that could be done is to eliminate the overhead of 
chain() which is likely about a third of the cost.

For smaller n, the grouper recipe is already very close to optimal.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue46709] test_urllib: testInterruptCaught() has a race condition and fails randomly

2022-02-11 Thread STINNER Victor


STINNER Victor  added the comment:

Oops, I forgot about my own bpo-46465. I failed to find it when I searched for 
"test_urllib".

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Regression caused by CALL_FUNCTION specialization for C 
function calls

___
Python tracker 

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



[issue46465] Regression caused by CALL_FUNCTION specialization for C function calls (test_urllib fails when run multiple times)

2022-02-11 Thread STINNER Victor


Change by STINNER Victor :


--
title: Regression caused by CALL_FUNCTION specialization for C function calls 
-> Regression caused by CALL_FUNCTION specialization for C function calls 
(test_urllib fails when run multiple times)

___
Python tracker 

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



[issue46719] Call not visited in ast.NodeTransformer

2022-02-11 Thread David Castells-Rufas


New submission from David Castells-Rufas :

If I create a class derived from ast.NodeTransformer and implement the 
visit_Call.
When run on the below code, the visit_Call function is only called once (for 
the print function, and not for ord). It looks like calls in function arguments 
are ignored.

def main():
print(ord('A'))


On the other hand, on the following code it correctly visits both functions 
(print and ord).

def main():
c = org('A')
print(c)

--
components: Library (Lib)
messages: 413069
nosy: davidcastells
priority: normal
severity: normal
status: open
title: Call not visited in ast.NodeTransformer
type: behavior
versions: Python 3.10, 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



[issue46119] Update bundled pip to 21.3.1 and setuptools to 59.7.0

2022-02-11 Thread Kumar Aditya


Change by Kumar Aditya :


--
resolution:  -> out of date
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



[issue46719] Call not visited in ast.NodeTransformer

2022-02-11 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> It looks like calls in function arguments are ignored.

Please share a small, self-contained reproducer.

>From what I can assume by this message, the problem is that you are not 
>calling self.generic_visit(node) on the first call you are handling. If you 
>don't call visit/generic_visit on the rood node that you are handling 
>(print(ord('A')), then it will never visit ord('A') in a standalone fashion.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2022-02-11 Thread Éric Araujo

Éric Araujo  added the comment:

Both active PRs have comments pointing out issues, that’s why this is still 
open.  A clean fix with unit tests and no regression is needed.

--
nosy: +eric.araujo
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

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



[issue33436] Add an interactive shell for Sqlite3

2022-02-11 Thread Diego Ramirez


Diego Ramirez  added the comment:

Do we still want to do this? See 
https://discuss.python.org/t/titling-sqlite3-table-columns-with-number/13656/3.

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



[issue46720] Add support of path-like objects to multiprocessing.set_executable for Windows to match Unix-like systems

2022-02-11 Thread Géry

New submission from Géry :

Any [path-like object](https://docs.python.org/3/glossary.html) can be passed 
to `multiprocessing.set_executable`, i.e. objects with `str`, `bytes`, or 
`os.PathLike` type.

For instance these work (tested on MacOS with all start methods: ‘spawn’, 
‘fork’, and ‘forkserver’):

- `multiprocessing.set_executable(sys.executable)` (`str`);
- `multiprocessing.set_executable(sys.executable.encode())` (`bytes`);
- `multiprocessing.set_executable(pathlib.Path(sys.executable))` 
(`os.PathLike`).

This is because the ‘fork’ start method does not exec any program in the 
subprocess, the ‘spawn’ start method converts its path argument to `bytes` with 
`os.fsencode` before passing to 
[`_posixsubprocess.fork_exec`](https://github.com/python/cpython/blob/v3.10.2/Lib/multiprocessing/util.py#L452-L455),
 and the ‘forkserver’ start method spawns a server process (like with the 
‘spawn’ start method) which then forks itself at each request (like the ‘fork’ 
start method):

```
return _posixsubprocess.fork_exec(
args, [os.fsencode(path)], True, passfds, None, None,
-1, -1, -1, -1, -1, -1, errpipe_read, errpipe_write,
False, False, None, None, None, -1, None)
```

Linux (and other Unix-like systems) uses the same code than MacOS for the three 
start methods so it should work for it too.

However I have not tested this on Windows which uses the function 
[`_winapi.CreateProcess`](https://github.com/python/cpython/blob/v3.10.2/Lib/multiprocessing/popen_spawn_win32.py#L73-L75)
 for the ‘spawn’ start method (the only start method available on this OS) but 
I noticed that no conversion to `str` (not to `bytes` this time, since [the 
function expects 
`str`](https://github.com/python/cpython/blob/v3.10.2/Modules/_winapi.c#L1049)) 
of the path argument with `os.fsdecode` (not `os.fsencode` this time) is 
performed before passing it to the function:

```
hp, ht, pid, tid = _winapi.CreateProcess(
python_exe, cmd,
None, None, False, 0, env, None, None)
```

So on Windows only `str` path can be passed to 
`multiprocessing.set_executable`. This PR fixes this to be on a par with 
Unix-like systems which accept any path-like objects.

--
components: Library (Lib)
messages: 413073
nosy: maggyero
priority: normal
severity: normal
status: open
title: Add support of path-like objects to multiprocessing.set_executable for 
Windows to match Unix-like systems
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



[issue46720] Add support of path-like objects to multiprocessing.set_executable for Windows to match Unix-like systems

2022-02-11 Thread Géry

Change by Géry :


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

___
Python tracker 

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



[issue46705] Memory optimization for set.issubset

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue18032.

--

___
Python tracker 

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

If the argument of set.issuperset() is not a set, it is first converted to a 
set. It is equivalent to the following code:

if not isinstance(other, (set, frozenset)):
other = set(other)
# The following is equivalent to:
# return set.issubset(other, self)
for x in other:
if x not in self
return False
return True

Two drawbacks of this algorithm:

1. It creates a new set, which takes O(len(other)) time and consumes 
O(len(set(other))) memory.
2. It needs to iterate other to the end, even if the result is known earlier.

The proposed PR straightforward the code. The C code is now larger, but it no 
longer need additional memory, performs less operations and can stop earlier.

--
components: Interpreter Core
messages: 413075
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize set.issuperset() for non-set argument
type: performance
versions: Python 3.11

___
Python tracker 

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The new code is similar to the code of set.isdisjoint(), so we can share the 
code if generalize it.

--

___
Python tracker 

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



[issue46722] Different behavior for functiools.partial between inspect.isfunction() and other inspect.is*function()

2022-02-11 Thread Iliya Zinoviev

New submission from Iliya Zinoviev :

1) isfunction() returns `True` for partial object only when one passes `func` 
attribute of it.
2) For instance, `isgeneratorfunction()` and `iscoroutinefunction()` for 
partial obj work with passing partial obj as well as with passing `func` attr 
of this obj, when obj is partially applied generator function or partially 
applied coroutine function respectively.

I offer to unify behavior for handling partial object for 
r'inspect.is*function()' by the next way:
1) Add `functools._unwrap_partial()` to `inspect.isfunction()` as well as it 
were done in other r'inspect.is*function()'.

P.S.I'm ready to deal with this issue.  

Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0]
Type 'copyright', 'credits' or 'license' for more information

Operating System: Manjaro Linux
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.4.176-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 11.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520

--
components: Library (Lib)
files: isfuncs_behavior.py
messages: 413077
nosy: IliyaZinoviev
priority: normal
severity: normal
status: open
title: Different behavior for functiools.partial between inspect.isfunction() 
and other inspect.is*function()
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50621/isfuncs_behavior.py

___
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-02-11 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Please do submit a PR! Agree that more examples of inheritance and attributes 
would be useful.

Note that we're about to deprecate the keyword argument syntax (issue46066).

--

___
Python tracker 

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Use-after-free by mutating set during set operations

___
Python tracker 

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



[issue45490] [C API] PEP 670: Convert macros to functions in the Python C API

2022-02-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e0bcfd0e4db193743d4bafc48d10f15ae9ed7b2b by Victor Stinner in 
branch 'main':
bpo-45490: Rename static inline functions (GH-31217)
https://github.com/python/cpython/commit/e0bcfd0e4db193743d4bafc48d10f15ae9ed7b2b


--

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-11 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

@eric.snow great to hear about this update! I'll start looking at some of the 
techniques that we talked about to improve performance, I'm optimistic that 
we'll be able to close down the gap to 2%.

--

___
Python tracker 

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



[issue40379] multiprocessing's default start method of fork()-without-exec() is broken

2022-02-11 Thread Michał Górny

Michał Górny  added the comment:

After updating PyPy3 to use Python 3.9's stdlib, we hit very bad hangs because 
of this — literally compiling a single file with "parallel" compileall could 
hang.  In the end, we had to revert the change in how Python 3.9 starts workers 
because otherwise multiprocessing would be impossible to use:

https://foss.heptapod.net/pypy/pypy/-/commit/c594b6c48a48386e8ac1f3f52d4b82f9c3e34784

This is a very bad default and what's even worse is that it often causes 
deadlocks that are hard to reproduce or debug.  Furthermore, since "fork" is 
the default, people are unintentionally relying on its support for passing 
non-pickleable projects and are creating non-portable code.  The code often 
becomes complex and hard to change before they discover the problem.

Before we managed to figure out how to workaround the deadlocks in PyPy3, we 
were experimenting with switching the default to "spawn".  Unfortunately, we've 
hit multiple projects that didn't work with this method, precisely because of 
pickling problems.  Furthermore, they were surprised to learn that their code 
wouldn't work on macOS (in the end, many people perceive Python as a language 
for writing portable software).

Finally, back in 2018 I've made one of my projects do parallel work using 
multiprocessing.  It gave its users great speedup but for some it caused 
deadlocks that I couldn't reproduce nor debug.  In the end, I had to revert it. 
 Now that I've learned about this problem, I'm wondering if this wasn't 
precisely because of "fork" method.

--
nosy: +mgorny

___
Python tracker 

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



[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects

2022-02-11 Thread Dennis Sweeney


Change by Dennis Sweeney :


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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 204946986feee7bc80b233350377d24d20fcb1b8 by Petr Viktorin in 
branch 'main':
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
https://github.com/python/cpython/commit/204946986feee7bc80b233350377d24d20fcb1b8


--

___
Python tracker 

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



[issue46720] Add support of path-like objects to multiprocessing.set_executable for Windows to match Unix-like systems

2022-02-11 Thread Géry

Change by Géry :


--
type:  -> enhancement

___
Python tracker 

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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

It's in public API, adding it to limited is still pending.

--

___
Python tracker 

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



[issue46337] urllib.parse: Allow more flexibility in schemes and URL resolution behavior

2022-02-11 Thread Lincoln Auster


Lincoln Auster  added the comment:

> Maybe a new parse function, or new parameter to the existing one,
> could be easier to add.

If I'm understanding you right, that's what this (and the PR) is - an
extra optional parameter to urllib.parse to supplement the existing
(legacy?) hard-coded list.

--

___
Python tracker 

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



[issue46722] Different behavior for functiools.partial between inspect.isfunction() and other inspect.is*function()

2022-02-11 Thread Iliya Zinoviev


Change by Iliya Zinoviev :


Added file: https://bugs.python.org/file50622/isfuncs_behavior.py

___
Python tracker 

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



[issue46722] Different behavior for functiools.partial between inspect.isfunction() and other inspect.is*function()

2022-02-11 Thread Iliya Zinoviev


Change by Iliya Zinoviev :


Removed file: https://bugs.python.org/file50622/isfuncs_behavior.py

___
Python tracker 

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-11 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 4a66615ba736f84eadf9456bfd5d32a94cccf117 by Dennis Sweeney in 
branch 'main':
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
https://github.com/python/cpython/commit/4a66615ba736f84eadf9456bfd5d32a94cccf117


--

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-11 Thread Eric Snow


Eric Snow  added the comment:

On Fri, Feb 11, 2022 at 1:36 AM Christoph Reiter  wrote:
> Sorry if off topic, but I noticed that CPython doesn't deprecate macros in 
> code, while with gcc/clang it's possible to show compiler warnings for them 
> using some pragma magic:
> [snip]
> Maybe that makes getting rid of them easier in the long run?

That's a good question.  We do have Py_DEPRECATED() (in
Include/pyport.h), which is used for symbols.  I'm not sure anyone has
given much thought to deprecating macros, but it's probably worth
considering.  I recommend that you post something about this to
python-...@python.org.

FWIW, here are other explanations of how to deprecate macros:

* 
https://stackoverflow.com/questions/57478368/what-is-the-best-way-to-mark-macro-as-deprecated/57479189#57479189
* 
https://stackoverflow.com/questions/2681259/how-to-deprecate-a-c-pre-processor-macro-in-gcc/29297970#29297970

--

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread Alex Waygood


Change by Alex Waygood :


--
pull_requests: +29441
pull_request: https://github.com/python/cpython/pull/31281

___
Python tracker 

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



[issue46723] SimpleQueue.put_nowait() documentation error

2022-02-11 Thread Antony Cardazzi


New submission from Antony Cardazzi :

SimpleQueue.put_nowait(item) documentation says it is equivalent to 
SimpleQueue.put(item) when it's actually equivalent to Simple que.put(item, 
block=False)

--
assignee: docs@python
components: Documentation
messages: 413087
nosy: antonycardazzi, docs@python
priority: normal
severity: normal
status: open
title: SimpleQueue.put_nowait() documentation error
type: behavior

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-11 Thread Saul Shanabrook


New submission from Saul Shanabrook :

I noticed that in Python 3.10, and also in main, a certain control flow 
construct produces some very odd bytecode (showing on main but same on python 
3.10 tags):

```
./python.exe -c 'import dis; dis.dis("while not (a < b < c): pass")'
  0 RESUME   0

  1   2 LOAD_NAME0 (a)
  4 LOAD_NAME1 (b)
  6 SWAP 2
  8 COPY 2
 10 COMPARE_OP   0 (<)
 12 POP_JUMP_IF_FALSE   11 (to 22)
 14 LOAD_NAME2 (c)
 16 COMPARE_OP   0 (<)
 18 POP_JUMP_IF_TRUE28 (to 56)
 20 JUMP_FORWARD 1 (to 24)
>>   22 POP_TOP
>>   24 LOAD_NAME0 (a)
 26 LOAD_NAME1 (b)
 28 SWAP 2
 30 COPY 2
 32 COMPARE_OP   0 (<)
 34 POP_JUMP_IF_FALSE   23 (to 46)
 36 LOAD_NAME2 (c)
 38 COMPARE_OP   0 (<)
 40 POP_JUMP_IF_FALSE   12 (to 24)
 42 LOAD_CONST   0 (None)
 44 RETURN_VALUE
>>   46 POP_TOP
 48 EXTENDED_ARG   255
 50 EXTENDED_ARG 65535
 52 EXTENDED_ARG 16777215
 54 JUMP_FORWARD 4294967280 (to 8589934616)
>>   56 LOAD_CONST   0 (None)
 58 RETURN_VALUE
```

The last JUMP_FORWARD has a rather larger argument! This was the minimal 
example I could find to replicate this.

However, this is an example of some runnable code that also encounters it:

```
a = b = c = 1
while not (a < b < c):
if c == 1:
c = 3
else:
b = 2
print(a, b, c)
```

This actually executes fine, but I notice that when it's executing it does 
execute that very large arg, but that the `oparg` to JUMP_FORWARD ends up being 
negative! By adding some tracing, I was able to see that the `oparg` variable 
in the `TARGET(JUMP_FORWARD)` case is `-32`.

I am not sure if this is a bug or intended behavior. It does seem a bit odd to 
have this unnecessarily large argument that ends up turning into a negative 
jump! But the behavior seems fine.

At the least, maybe `dis` should be modified so that it properly sees this as a 
negative jump and debugs it properly? I am happy to submit a PR to modify `dis` 
to handle this case, but I also wanted to flag that maybe it's a bug to being 
with.

--
components: Interpreter Core
messages: 413088
nosy: saulshanabrook
priority: normal
severity: normal
status: open
title: Odd Bytecode Generation in 3.10
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



[issue39355] The Python library will not compile with a C++2020 compiler because the code uses the reserved “module” keyword

2022-02-11 Thread Hasan


Change by Hasan :


--
pull_requests: +29442
pull_request: https://github.com/python/cpython/pull/31282

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-11 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Seems that this is allowed since the PEG parser rewrite:

for x in *a, *b:
print(x)

but I cannot find anywhere were we discussed this. I am not sure if we should 
keep it or treat it as a bug and fix it.

--
components: Parser
messages: 413089
nosy: BTaskaya, gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Unpacking without parentheses is allowed since 3.9
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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Since this was already allowed in 3.9 and 3.10 stable relases, and since it is 
consistent with the RHS of an assignment (something = *a, *b); I'd lean towards 
keeping it (and maybe fixing the old parser's grammar to reflect that) and 
documenting this.

--

___
Python tracker 

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I'd lean towards keeping this syntax:
- It's already been out for two releases, so there's user code out there 
relying on it. (In fact we found out about this because somebody complained 
that Black's parser couldn't handle this code.)
- The syntax isn't obviously confusing and the meaning is clear.
- It's not hard to parse; it was easy to adjust Black's parser to allow it.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

+1 (what Jelle said)

--
nosy: +erlendaasland

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-11 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46713] Provide a C implementation of collections.abc.KeysView and friends

2022-02-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Some thoughts:

* Other than set operations, most of the pure python code in the dict view ABCs 
are fast pass throughs.  There is no point in rewriting these in C:

def __contains__(self, key):
return key in self._mapping

def __iter__(self):
yield from self._mapping

def __len__(self):
return len(self._mapping)

* For the set operations, the pure python code has only a simple for-loop and 
contains test.  There isn't much fat to be cut:

def __ge__(self, other):
if not isinstance(other, Set):
return NotImplemented
if len(self) < len(other):
return False
for elem in other:
if elem not in self:
return False
return True

* Possibly the eval-loop overhead can be eliminated with Python by using 
itertools:

def __ge__(self, other):
if not isinstance(other, Set):
return NotImplemented
if len(self) < len(other):
return False
for elem in filterfalse(self.__contains__, other):
return False
return True

* That leaves the question of why the dict views are so much faster (presuming 
that the posted timings are representative).  I haven't looked in detail, but 
the first candidate that comes to mind is that dictviews_to_set() has a fast 
path for exact dicts.  That lets it bypass the mapping proxy and exploit the 
fast path in PySet_New for exact dicts.  That fast path reuses the stored hash 
values and exploits knowing that the input has no duplicates.  Off-hand, I 
don't see how that can generalize to the arbitrary mappings supports by the 
view ABCs.  

* Summary:  A first look, it doesn't seem like a C rewrite of the view ABCs 
would bear fruit.

--

___
Python tracker 

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



[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-02-11 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

It occurred to be that we do need to add the __call__ to KW_ONLY, but for a 
different reason than this bpo:

If you call get_type_hints on a dataclass with a KW_ONLY parameter when PEP 563 
is enabled, the entire call will fail if KW_ONLY isn't callable(). This can 
also happen if you stringize KW_ONLY without PEP 563. I made a bpo to suggest 
removing the callable() check entirely, but it's waiting discussion currently: 
https://bugs.python.org/issue46644

My feeling is you probably wanted to wait on making changes of this kind for 
the 5.11 PEP 563 et al decision to play out, but on the other hand I think the 
KW_ONLY (and similar __call__ method for InitVar this patch already adds) 
change would likely be backportable so we may want to make them anyway for that 
purpose. Do you have an opinion on this?

This patch might be backportable to mirror https://bugs.python.org/issue46491 
but I don't have a strong opinion on that.

--

___
Python tracker 

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-02-11 Thread Andreas H.


Change by Andreas H. :


--
pull_requests: +29443
pull_request: https://github.com/python/cpython/pull/31283

___
Python tracker 

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-11 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46713] Provide a C implementation of collections.abc.KeysView and friends

2022-02-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

- arbitrary mappings supports by the view ABCs
+ arbitrary mappings supported by the view ABCs

- A first look,
+ At first glance,

--

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-11 Thread Saul Shanabrook


Change by Saul Shanabrook :


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

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e0bc8ee945af96f9395659bbe3cc30b082e7a361 by Alex Waygood in 
branch 'main':
bpo-46483: [doc] pathlib classes no longer support parameterized generics 
(GH-31281)
https://github.com/python/cpython/commit/e0bc8ee945af96f9395659bbe3cc30b082e7a361


--

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29447
pull_request: https://github.com/python/cpython/pull/31287

___
Python tracker 

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-11 Thread miss-islington


miss-islington  added the comment:


New changeset 1f5fe9962f768c8bfd4ed06a22532d31d3424dc9 by Miss Islington (bot) 
in branch '3.10':
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
https://github.com/python/cpython/commit/1f5fe9962f768c8bfd4ed06a22532d31d3424dc9


--

___
Python tracker 

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let's just document it for 3.11.

--

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread miss-islington


miss-islington  added the comment:


New changeset a7c1cc41696740bb528f4d24816c59e38b8be345 by Miss Islington (bot) 
in branch '3.9':
bpo-46483: [doc] pathlib classes no longer support parameterized generics 
(GH-31281)
https://github.com/python/cpython/commit/a7c1cc41696740bb528f4d24816c59e38b8be345


--

___
Python tracker 

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread miss-islington


miss-islington  added the comment:


New changeset f2fbfbe0ec57ec39b3099dae62571a48d5fe8729 by Miss Islington (bot) 
in branch '3.10':
bpo-46483: [doc] pathlib classes no longer support parameterized generics 
(GH-31281)
https://github.com/python/cpython/commit/f2fbfbe0ec57ec39b3099dae62571a48d5fe8729


--

___
Python tracker 

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



[issue46355] [C API] Document PyFrameObject and PyThreadState changes and explain how to port code to Python 3.11

2022-02-11 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland
nosy_count: 4.0 -> 5.0
pull_requests: +29448
pull_request: https://github.com/python/cpython/pull/31288

___
Python tracker 

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Will prepare a PR

--

___
Python tracker 

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



[issue46072] Unify handling of stats in the CPython VM

2022-02-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 2.0 -> 3.0
pull_requests: +29449
pull_request: https://github.com/python/cpython/pull/31289

___
Python tracker 

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



[issue46614] Add option to output UTC datetimes as "Z" in `.isoformat()`

2022-02-11 Thread Matt Wozniski


Matt Wozniski  added the comment:

> I feel like "If the offset is 00:00, use Z" is the wrong rule to use 
> conceptually

This is a really good point that I hadn't considered: `+00:00` and `Z` are 
semantically different, and just because a datetime has a UTC offset of 0 
doesn't mean it should get a `Z`; `Z` is reserved specifically for UTC.

It seems like the most semantically correct thing would be to only use `Z` if 
`tzname()` returns exactly "UTC". That would do the right thing for your London 
example for every major timezone library I'm aware of:

>>> datetime.datetime.now(zoneinfo.ZoneInfo("Europe/London")).tzname()
'GMT'
>>> datetime.datetime.now(zoneinfo.ZoneInfo("UTC")).tzname()
'UTC'
>>> datetime.datetime.now(datetime.timezone.utc).tzname()
'UTC'

>>> datetime.datetime.now(dateutil.tz.gettz("Europe/London")).tzname()
'GMT'
>>> datetime.datetime.now(dateutil.tz.UTC).tzname()
'UTC'

>>> datetime.datetime.now(pytz.timezone("Europe/London")).tzname()
'GMT'
>>> datetime.datetime.now(pytz.UTC).tzname()
'UTC'

I think the right rule to use conceptually is "if `use_utc_designator` is true 
and the timezone name is 'UTC' then use Z". We could also check the offset, but 
I'm not convinced we need to.

--
nosy: +godlygeek

___
Python tracker 

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



[issue46708] test_asyncio: test_sock_client_fail() changes asyncio.events._event_loop_policy

2022-02-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

Heh, I just ran into this for test_taskgroups as well. (Alas, I had debugged 
and fixed it independently before I found this. :-)

--
nosy: +gvanrossum

___
Python tracker 

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



[issue46720] Add support for path-like objects to multiprocessing.set_executable for Windows to be on a par with Unix-like systems

2022-02-11 Thread Géry

Change by Géry :


--
title: Add support of path-like objects to multiprocessing.set_executable for 
Windows to match Unix-like systems -> Add support for path-like objects to 
multiprocessing.set_executable for Windows to be on a par with Unix-like systems

___
Python tracker 

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



[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-11 Thread Eryk Sun


Eryk Sun  added the comment:

> test_call_timeout() or test_timeout() in test_subprocess.py.

These tests don't override the standard files, and they only spawn a single 
child with no descendants. I don't see why this would hang. It shouldn't be a 
problem with leaked pipe handles (see bpo-43346). It probably will need to be 
diagnosed by attaching a debugger, or offline with a dump file.

> process trees whereas terminating a parent automatically kills the children

One can use a job object to manage a child process and all of its descendants, 
including resource usage and termination. A process can belong to multiple job 
objects in Windows 8+, which is required by Python 3.9+.

For reliability, the child has to be created in a suspended state via 
CREATE_SUSPENDED. It can be resumed with ResumeThread() after adding it to the 
job with AssignProcessToJobObject().

You can try to terminate a job cleanly, which is similar in effect to sending 
SIGTERM to a process group in POSIX. In Windows, this has to be approached 
differently for console vs graphical processes.

To handle console apps, assuming the child inherits the current console, spawn 
it as a new process group via 
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP. You can request an exit by 
sending a Ctrl+Break event to the group via os.kill(p.pid, 
signal.CTRL_BREAK_EVENT) [1]. The request might be ignored, but typically the 
default handler is called, which calls ExitProcess().

To handle GUI apps, assuming the child inherits the current desktop (usually 
"WinSta0\Default"), first enumerate the top-level and message-only windows on 
the current desktop via EnumWindows() and FindWindowExW(). Use 
GetWindowThreadProcessId() to filter the list to include only windows that 
belong to the job. Post WM_CLOSE to each window in the job. A process might 
ignore a request to close. It could keep the window open or continue running in 
the background.

After an internal timeout, you can call TerminateJobObject() to kill any 
process in the job that remains alive. This is a forced and abrupt termination, 
which is similar to sending SIGKILL to a process group in POSIX.

---

[1] This usage of os.kill() is what we're stuck with. Rightfully, we should be 
using os.killpg(p.pid, signal.SIGBREAK) or os.kill(-p.pid, signal.SIGBREAK) 
(note the negative pid value).

--

___
Python tracker 

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



[issue46661] Duplicate deprecation warnings in docs for asyncio

2022-02-11 Thread Guido van Rossum


Change by Guido van Rossum :


--
title: Duplicat deprecation warnings in docs for asyncio -> Duplicate 
deprecation warnings in docs for asyncio

___
Python tracker 

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



[issue46666] IDLE Add indent guide

2022-02-11 Thread primexx


primexx  added the comment:

very informative discussion. i'll just say that if it's not possible to do 
purely visually, and it can only be done by modifying the textual content, then 
it probably should not be done at all. preserving the code (and copy+paste 
integrity) is more important. maybe this is actually something to raise with Tk 
first?

--

___
Python tracker 

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



[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-11 Thread Kevin Shweh


New submission from Kevin Shweh :

This code in Thread._wait_for_tstate_lock:

try:
if lock.acquire(block, timeout):
lock.release()
self._stop()
except:
if lock.locked():
# bpo-45274: lock.acquire() acquired the lock, but the function
# was interrupted with an exception before reaching the
# lock.release(). It can happen if a signal handler raises an
# exception, like CTRL+C which raises KeyboardInterrupt.
lock.release()
self._stop()
raise

has a bug. The "if lock.locked()" check doesn't check whether this code managed 
to acquire the lock. It checks if *anyone at all* is holding the lock. The lock 
is almost always locked, so this code will perform a spurious call to 
self._stop() if it gets interrupted while trying to acquire the lock.

Thread.join uses this method to wait for a thread to finish, so a thread will 
spuriously be marked dead if you interrupt a join call with Ctrl-C while it's 
trying to acquire the lock. Here's a reproducer:


import time
import threading
 
event = threading.Event()
 
def target():
event.wait()
print('thread done')
 
t = threading.Thread(target=target)
t.start()
print('joining now')
try:
t.join()
except KeyboardInterrupt:
pass
print(t.is_alive())
event.set()


Interrupt this code with Ctrl-C during the join(), and print(t.is_alive()) will 
print False.

--
components: Library (Lib)
messages: 413106
nosy: Kevin Shweh
priority: normal
severity: normal
status: open
title: Thread spuriously marked dead after interrupting a join call
type: behavior
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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2022-02-11 Thread Ben


Change by Ben :


--
nosy: +bjs
nosy_count: 6.0 -> 7.0
pull_requests: +29450
pull_request: https://github.com/python/cpython/pull/31290

___
Python tracker 

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



[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-11 Thread Ben


Ben  added the comment:

This is a duplicate of https://bugs.python.org/issue45274
but the patch there did not fix it

I've just added a PR there (or should it go here?) that (i think) fixes this.

The issue is that the lock.locked() call just checks that *someone* has the 
lock, not that the previous acquire() is what got the lock.
If it's just that the tstate lock is held because the thread is still running,  
then it's premature to release() the lock.

--
nosy: +bjs

___
Python tracker 

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



[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-11 Thread Ben


Change by Ben :


--
nosy: +vstinner

___
Python tracker 

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



[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-11 Thread James Gerity


Change by James Gerity :


--
nosy: +SnoopJeDi

___
Python tracker 

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



  1   2   >