[issue32642] add support for path-like objects in sys.path

2022-03-12 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue46961] Caching/interning of small ints sometimes fails

2022-03-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe the issue is the usage of the x_divrem function.

x_divrem always returns fresh ints, never cached small ints. This behavior is 
relied upon in the long_true_divide function, as it mutates the returned 
quotient at the line """x->ob_digit[0] = low & ~(2U*mask-1U);""".

The other uses of x_divrem account for this when handling the *quotient*, but 
apparently missed checking for small ints in the *remainder*.

uses of x_divrem:
- long_divrem
- uses maybe_small_long on quotient
- doesn't check if remainder is small < oops
- long_rem
- throws away quotient
- doesn't check if remainder is small < oops
- long_true_divide
- modifies the quotient
- throws away remainder


Possible patches to fix it:

1) Modify long_divrem and long_rem to check for small remainders, in addition 
to the small-quotient checks they already do.
2) Modify x_divrem to check for small remainders, but still always return fresh 
quotients.
3) Modify x_divrem to return cached quotients and remainders, and modify 
long_true_divide to make a copy before mutating.

I'd lean towards #1, since that quotient check already exists.
In #2, the mismatch of checking/not checking between quotient/remainder would 
be confusing.
In #3, an extra int allocation gets added to integer true divide, which isn't 
ideal.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue47001] deadlock in ctypes?

2022-03-12 Thread Rocco Matano


New submission from Rocco Matano :

When using ctypes under Windows, I have observed a baffling behavior which I am 
not sure if it is the result of a bug in ctypes, or is simply due to false 
expectations on my part.

Environment:
 - Windows 10 Pro, 21H1, 19043.1586, x64
 - Python versions 3.6 up to 3.10, x64
 
What I was trying to do was to enumerate all the icons in the resource section 
of an executable file. The Windows-API for such a case is EnumResourceNamesW, 
which requires the pointer to a callback function as an argument. I wanted to 
hide the details of the corresponding code so that a user of that code does not 
have to deal with ctypes directly and can supply a regular Python function for 
the callback. So I added an extra level of indirection.

When I ran my code, I was surprised to observe that the program was stuck. 
After several tries, I found a solution that differed from the original code 
only in one small detail: Use different types when describing the C callback.

Below is a self contained sample that can be used to show the successful case 
as well as to trigger the blocking. Unfortunately it is quit long. 


import sys
import ctypes
from ctypes.wintypes import HMODULE, LPVOID, LPWSTR, BOOL

# context structure that is used to use regular python functions as callbacks
# where external C code expects C callbacks with a certain signature.
class CallbackContext(ctypes.Structure):
_fields_ = (
("callback", ctypes.py_object),
("context", ctypes.py_object),
)

CallbackContextPtr = ctypes.POINTER(CallbackContext)

# quote from
# 
https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nc-libloaderapi-enumresnameprocw
#
# BOOL Enumresnameprocw(
#   [in, optional] HMODULE hModule,
#  LPCWSTR lpType,
#  LPWSTR lpName,
#   [in]   LONG_PTR lParam
# )
# Note that the arguments lpType and lpName are declared as pointers to strings.


if len(sys.argv) > 1 and sys.argv[1].lower() == "fail":
# Declaring them as pointers to strings in the ctypes prototype does NOT 
work.
EnumResNameCallback_prototype = ctypes.WINFUNCTYPE(
BOOL,
HMODULE,
LPWSTR,
LPWSTR,
CallbackContextPtr
)
else:
# Declaring them as void pointers does work!
EnumResNameCallback_prototype = ctypes.WINFUNCTYPE(
BOOL,
HMODULE,
LPVOID,
LPVOID,
CallbackContextPtr
)

# this is the ctypes callback function that mimics the required C call signature
@EnumResNameCallback_prototype
def EnumResNameCallback(hmod, typ, name, ctxt):
cbc = ctxt.contents
return cbc.callback(hmod, typ, name, cbc.context)

kernel32 = ctypes.windll.kernel32

EnumResourceNames = kernel32.EnumResourceNamesW
EnumResourceNames.restype = BOOL
EnumResourceNames.argtypes = (
HMODULE,
LPWSTR,
EnumResNameCallback_prototype,
CallbackContextPtr
)

# Get a module handle for an executable that contains icons
GetModuleHandle = kernel32.GetModuleHandleW
GetModuleHandle.restype = HMODULE
GetModuleHandle.argtypes = (LPWSTR,)

hmod = GetModuleHandle(sys.executable)
if hmod == 0:
raise ctypes.WinError()

RT_GROUP_ICON = ctypes.cast(14, LPWSTR)

# this is the 'regular' callback function that does not have to care about
# the C call signature
def enum_callback(hmod, typ, name, unused_context):
print(hmod, typ, name)
return True

cbc = CallbackContext(enum_callback, None)
rcbc = ctypes.byref(cbc)

print("Trying to enumerate icons.")
print("In the case of failure, this WILL BLOCK indefinitely!")
EnumResourceNames(hmod, RT_GROUP_ICON, EnumResNameCallback, rcbc)

--
components: ctypes
messages: 415029
nosy: rocco.matano
priority: normal
severity: normal
status: open
title: deadlock in ctypes?
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



[issue47000] Make encoding="locale" uses locale encoding even in UTF-8 mode is enabled.

2022-03-12 Thread Inada Naoki


New submission from Inada Naoki :

Currently, `encoding="locale"` is just shortcut of 
`encoding=locale.getpreferredencoding(False)`.

`encoding="locale"` means that "locale encoding should be used here, even if 
Python default encoding is changed to UTF-8".

I am not sure that UTF-8 mode becomes the default or not.
But some user want to use UTF-8 mode to change default encoding in their Python 
environments without waiting Python default encoding changed.

So I think `encoding="locale"` should use real locale encoding (ACP on Windows) 
regardless UTF-8 mode is enabled or not.

Currently, UTF-8 mode affects to `_Py_GetLocaleEncoding()`. So it is difficult 
that make encoding="locale" ignores UTF-8 mode.
Is it safe to use `locale.getlocale(locale.LC_CTYPE)[1] or "UTF-8"`?

--
components: Unicode
messages: 415028
nosy: ezio.melotti, methane, vstinner
priority: normal
severity: normal
status: open
title: Make encoding="locale" uses locale encoding even in UTF-8 mode is 
enabled.
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



[issue46999] test_multiprocessing_fork running without any timeout

2022-03-12 Thread Matthias Klose


New submission from Matthias Klose :

the test_multiprocessing_fork test is a bit unreliable, at least on both the 
Debian and Ubuntu test infrastructures, sometimes running for 100+ hours.  When 
running locally, I cannot reproduce these issues.  Note that the test and build 
infrastructure is usually limited to 4-6 cores and 20GB of RAM (including 
swap). What else could be an issue for these hangs?

How can this test reliably timeout?  I know it takes a few hours on slow 
architectures even when succeeding.

--
components: Tests
messages: 415027
nosy: doko
priority: normal
severity: normal
status: open
title: test_multiprocessing_fork running without any timeout

___
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-12 Thread Jeremiah Pascual


Jeremiah Pascual  added the comment:

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

Created a pull request (31816).

--

___
Python tracker 

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



[issue46846] functools.partial objects should set __signature__ and _annotations__

2022-03-12 Thread Graham Dumpleton


Change by Graham Dumpleton :


--
nosy: +grahamd

___
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-12 Thread Larry Hastings


Larry Hastings  added the comment:

You make a good point.  I filed a separate bug (#46846) suggesting that partial 
objects should set their own annotations and signature.  I agree that objects 
performing such magic should take care of these details themselves, rather than 
requiring the inspect module to have workarounds based on deep knowledge of 
these other modules' inner workings.

--

___
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-12 Thread Graham Dumpleton


Graham Dumpleton  added the comment:

I am still working through this and thinking about implications, but my first 
impression is that the functools.partial object should provide an attribute 
(property) __signature__ which yields the correct result.

When you think about it, any user who wants to implement a function wrapper 
using a class to do so rather than using functools.update_wrapper(), has to 
implement __signature__ if the wrapper is a signature changing decorator. So 
why shouldn't Python itself follow the same mechanism that is forced on users 
in their own wrappers.

If functools.partial were to implement __signature__, then the part of PEP 362 
where it says:

> If the object is an instance of functools.partial, construct a new Signature 
> from its partial.func attribute, and account for already bound partial.args 
> and partial.kwargs

becomes redundant as the code to deal with it is localised within the 
functools.partial implementation by virtue of __signature__ on that type rather 
than having a special case in inspect.signature().

If this was seen as making more sense, one might even argue that FunctionType 
and the bound variant could implement __signature__ and so localise things to 
those implementations as well, which would further simplify inspect.signature().

This would set a good precedent going forward that if any special callable 
wrapper objects are added to the Python core in the future, that they implement 
__signature__, rather than someone thinking that further special cases could be 
added to inspect.signature() to deal with them.

I have yet to do some actual code experiments so might have more thoughts on 
the matter later.

--

___
Python tracker 

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



[issue46998] Allow subclassing Any at runtime

2022-03-12 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +AlexWaygood, gvanrossum, kj

___
Python tracker 

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



[issue46998] Allow subclassing Any at runtime

2022-03-12 Thread Shantanu


Change by Shantanu :


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

___
Python tracker 

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



[issue46998] Allow subclassing Any at runtime

2022-03-12 Thread Shantanu


New submission from Shantanu :

Discussed on typing-sig at 
https://mail.python.org/archives/list/typing-...@python.org/thread/GULRKYI7XOB3FLAEFC6OYSTBS5FIA5PU/

--
components: Library (Lib)
messages: 415023
nosy: JelleZijlstra, hauntsaninja
priority: normal
severity: normal
status: open
title: Allow subclassing Any at runtime
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



[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

3.9 segfaults.

(gdb) bt
#0  bytearray_ass_subscript (self=, index=0x77e118f0, 
values=0x76f918b0) at Objects/bytearrayobject.c:640
#1  0x00536302 in _PyEval_EvalFrameDefault (tstate=, 
f=0x999a80, throwflag=) at Python/ceval.c:1990
#2  0x00534775 in _PyEval_EvalFrame (throwflag=0, f=0x999a80, 
tstate=0x93de90) at ./Include/internal/pycore_ceval.h:40

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



[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
components: +Interpreter Core
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



[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

Inspired by Guido's comment in 
https://github.com/python/cpython/pull/31834/files#r825352900, I found that 
there are some places in bytearrayobject.c where we can write to free'd memory 
if we encounter an object with a sneaky __index__ method:

$ cat basneak.py 
ba = bytearray([0 for _ in range(1)])

class sneaky:
def __index__(self):
ba.clear()
return 1

ba[-1] = sneaky()
$ valgrind ./python basneak.py 
==87894== Memcheck, a memory error detector
==87894== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==87894== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==87894== Command: ./python basneak.py
==87894== 
==87894== Invalid write of size 1
==87894==at 0x49B70F: bytearray_ass_subscript (bytearrayobject.c:632)
==87894==by 0x488E03: PyObject_SetItem (abstract.c:211)


In bytearray_setitem(), we first do bounds checking, and then call 
_getbytevalue() to get the numeric value of the argument.

I think there's a similar bug in bytearray_ass_subscript().

--
messages: 415021
nosy: JelleZijlstra, gvanrossum
priority: normal
severity: normal
status: open
title: Invalid memory write in bytearray

___
Python tracker 

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



[issue43215] Document Happy Eyeballs arguments of asyncio.open_connection

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue43215] Document Happy Eyeballs arguments of asyncio.open_connection

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 3543ddb4c4ebc26fb2d6c67a97e66f5267876f72 by Illia Volochii in 
branch 'main':
bpo-43215: Document Happy Eyeballs args of asyncio.open_connection (GH-24525)
https://github.com/python/cpython/commit/3543ddb4c4ebc26fb2d6c67a97e66f5267876f72


--

___
Python tracker 

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



[issue44318] Asyncio classes missing __slots__

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

1. Guido van Rossum explicitly designed asyncio to *don't* use slots.
2. Changing it produces potential backward incompatibility issues.

Very many stdlib classes don't have slots, as already mentioned.
The default is really the reverse: no slots.

Closing.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue45993] Main branch of CPython does not build anymore on macOS

2022-03-12 Thread Ned Deily


Ned Deily  added the comment:

@Andrei, see Issue46975.

--
nosy: +ned.deily

___
Python tracker 

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



[issue46986] Upgrade ensurepip bundled setuptools to 60.9.3

2022-03-12 Thread Ned Deily


Ned Deily  added the comment:

We should probably include this update in the next round of releases.

--
nosy: +lukasz.langa, ned.deily, pablogsal
priority: normal -> release blocker

___
Python tracker 

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



[issue46985] Upgrade ensurepip bundled pip to 22.0.4

2022-03-12 Thread Ned Deily


Ned Deily  added the comment:

We should probably include this update in the next round of releases.

--
nosy: +lukasz.langa, ned.deily, pablogsal
priority: normal -> release blocker

___
Python tracker 

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



[issue46918] The vulnerability is included in /lib/python3.9/ensurepip after python 3.9.2 is installed.

2022-03-12 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46907] Update Windows and MacOS installer to SQLite 3.38.1

2022-03-12 Thread Ned Deily


Ned Deily  added the comment:

https://sqlite.org/releaselog/3_38_1.html

--
title: Update Windows and MacOS installer to SQLite 3.38.0. -> Update Windows 
and MacOS installer to SQLite 3.38.1

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

If the cancellation message should be kept it needs improvements anyway, the 
single message doesn't work well with multiple `.cancel()` calls.

I can imagine a 'CancelledError(*msgs)' and 'raise exc.drop_msg(msg)' as a 
function equivalent of task cancellation counter and `.cancel()` / 
`.uncancel()` pairing. A similar to MultiError, some sort of.

The counter is easier to understand I guess.

Both multi-message and counter require new APIs, timeout() can be adapted to 
any solution.

--

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-03-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Before we land GH-31840 we should have a somewhat more public discussion (e.g. 
on python-dev or maybe in Async-SIG, https://discuss.python.org/c/async-sig/20; 
or at least here) about deprecating the cancel message. I'm all for it but 
certainly Chris Jerdonek (who wrote the original code, see bpo-31033) needs to 
have a say, and from a comment on GH-19951 it looks Yury Selivanov also really 
liked it.

--

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2022-03-12 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I'm in support of adding Path support for sys.path, but I also agree with Eric, 
there are innumerable consumers of sys.path beyond importlib. and since 
pathlib.Path isn't a str, it would likely introduce incompatibility. On the 
other hand, users introducing Path objects to sys.path could be warned that 
although importlib supports Path objects, other consumers may not, and that 
support for it in importlib isn't endorsement of the use of those types and the 
consequences aren't necessarily supported.

As an aside, it's too bad a Path object couldn't have been a str subclass (as 
it is for [path](https://pypi.org/project/path), which would have made problems 
like this one much safer to solve.

--
nosy: +jaraco

___
Python tracker 

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



[issue45279] avoid redundant _commit_removals pending_removals guard

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue25292] [asyncio] ssl socket gets into broken state when client exits during handshake

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

asyncio ssl support was rewritten from scratch.
If you still observe the problem, please open a new issue.

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



[issue41696] asyncio.run interacts surprisingly with debug mode

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue40227] SSLError is not passed to the client during handshake

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

asyncio ssl support was rewritten from scratch.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The usage of get_event_loop() outside of a loop is deprecated since Python 3.10

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40454] DEBUG kw to asyncio.run overrides DEBUG mode set elsewhere

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Fixed by #41696

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



[issue40487] Unexpected exception handler behavior in Jupyter when returning task objects created with create_task

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

tasks are not awaited, this is the problem.
The reproducer is not correct.
Closing.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40251] selectors.KqueueSelector hangs on EOF, unlike other selectors

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Using selectors with blocked files looks weird at least. Should we care?

--

___
Python tracker 

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



[issue40967] asyncio.Task.all_tasks() and asyncio.Task.current_task() must be removed in 3.9

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-03-12 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
nosy: +uriyyo
nosy_count: 8.0 -> 9.0
pull_requests: +29939
pull_request: https://github.com/python/cpython/pull/27553

___
Python tracker 

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



[issue44799] typing.get_type_hints() raises TypeError for a variable annotated by dataclasses.InitVar

2022-03-12 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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



[issue42760] inspect.iscoroutine returns False for asynchronous generator methods

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue37529] Mimetype module duplicates

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 
3.8, Python 3.9

___
Python tracker 

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



[issue37529] Mimetype module duplicates

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset d9db07a3100105768ba83ffd67991e78452bb22e by andrei kulakov in 
branch 'main':
bpo-37529: Add test for guessing extensions (GH-28243)
https://github.com/python/cpython/commit/d9db07a3100105768ba83ffd67991e78452bb22e


--
nosy: +asvetlov

___
Python tracker 

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



[issue35392] Create asyncio/sockutils.py

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I support the idea but we have no PR yet.
The request is not very strong.
Anyway, if you still want such change -- please recreate an issue.

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



[issue32396] Implement method to write/read to serials without blocking on windows with asyncio

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

No activity, closing.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue28464] BaseEventLoop.close should shutdown executor before marking itself closed

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

loop.shutdown_default_executor() exists for it, asyncio.run() calls the method

--
nosy: +asvetlov
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25230] asyncio/Windows: Unix datagram sockets not supported

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Implemented a long time ago, closing

--
nosy: +asvetlov
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue22476] asyncio task chapter confusion about 'task', 'future', and 'schedule'

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Docs were rewritten from scratch in Python 3.8, they are much better now.

--
nosy: +asvetlov
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-12 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

In issue45979 E. Paine suggested to drop support of Tcl/Tk older than 8.5.12 
(8.5.12 was released on 2012-07-27 and 8.6.0 on 2012-12-20). Tkinter tests 
contain workarounds and special cases for older versions of Tcl/Tk, many of 
them can be removed. Also some Python and C code of tkinter can be simplified.

--
components: Library (Lib), Tests
messages: 414999
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Drop support of Tcl/Tk older than 8.5.12
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



[issue44604] [Enhancement] Asyncio task decorator to provide interface to define async DAGs (similar to dask's delayed interface)

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

TaskGroup has landed, aiodag is present on pypi.
Closing.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44221] ImportError: sys.meta_path is None, Python is likely shutting down

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Reproducer is missing

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



[issue28534] Replace asynchat

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Superseded by #28533

--
nosy: +asvetlov
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Remove asyncore, asynchat and smtpd modules

___
Python tracker 

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



[issue32181] runaway Tasks with Task.cancel() ignored.

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue41879] Outdated description of async iterables in documentation of async for statement

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue44373] make Event an Awaitable

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Please re-read the rejection reason: 
https://bugs.python.org/issue33544#msg316962

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44795] asyncio.run does not allow for graceful shutdown of main task

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Please use TaskGroup from Python 3.11 for structural concurrency.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40977] asyncio.trsock.TransportSocket says some APIs will be prohibited in 3.9

2022-03-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Fixed in Python 3.10

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39951] Ignore specific errors when closing ssl connections

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: backport needed -> 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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-03-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 31143 simplified some code without changing the common API:

 Objects/genericaliasobject.c | 46 
++
 1 file changed, 14 insertions(+), 32 deletions(-)
 Lib/_collections_abc.py | 63 
+--
 1 file changed, 9 insertions(+), 54 deletions(-)

PR 27511 will simplify it even more:

 Objects/genericaliasobject.c | 60 
++--
 1 file changed, 18 insertions(+), 42 deletions(-)

(Lib/typing.py will be simplified too, even if this does not reduce the number 
of lines).

--

___
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-12 Thread Ken Jin


Ken Jin  added the comment:


New changeset af2277e461aee4eb96affd06b4af25aad31c81ea by Matthew Rahtz in 
branch 'main':
bpo-43224: Implement PEP 646 changes to genericaliasobject.c (GH-31019)
https://github.com/python/cpython/commit/af2277e461aee4eb96affd06b4af25aad31c81ea


--

___
Python tracker 

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



[issue46995] Make Task.set_name() mandatory for third-parties

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue46995] Make Task.set_name() mandatory for third-parties

2022-03-12 Thread Andrew Svetlov


New submission from Andrew Svetlov :

The method was introduced by Python 3.8

Let's raise DeprecationWarning if third-party task implementation doesn't 
support it. Convert the depreciation into a strict error in Python 3.13

--
components: asyncio
messages: 414990
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Make Task.set_name() mandatory for third-parties
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



[issue46987] Remove _PySys_GetObjectId / _PySys_GetObjectId

2022-03-12 Thread Oleg Iarygin


Oleg Iarygin  added the comment:

> ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: 
> _PySys_GetObjectId(_stdin)  // borrowed ref

All three occurences look like this [1] for two years (see git blame):

#ifndef Py_LIMITED_API
  _PySys_GetObjectId(_stdin)  // borrowed ref
#else
  PySys_GetObject("stdin") // borrowed ref
#endif

So everything is fixed already.

[1]: https://github.com/h2oai/datatable/search?q=_PySys_GetObjectId

--
nosy: +arhadthedev

___
Python tracker 

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



[issue46994] Accept explicit contextvars.Context in asyncio create_task() API

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue46994] Accept explicit contextvars.Context in asyncio create_task() API

2022-03-12 Thread Andrew Svetlov


New submission from Andrew Svetlov :

Now asyncio creates a new context copy on task creation.

It is the perfect behavior *by default* and should stay as is.

However, sometimes passing an explicit context into a task and using back the 
context modified by task code is desired.

The most obvious use-case is testing: both unittest and pytest have multi-phase 
test initialization (asyncSetUp() methods and async fixtures correspondingly).  
If asyncSetUp() updates context variable -- test code expects to see this 
change.

Currently, unittest runs the setup-test-cleanup chain in a single task and uses 
an internal queue to push a new coroutine for execution and get results back. 
It works but is cumbersome.

Another solution is to create a task per test execution step and wrap the task 
creation with Context.run(). The problem is in getting the updated context 
back. A task creates a context copy on starting, thus the modified context is 
stored in the task internal attribute only. To get it back a trampoline async 
function should be used, e.g.

async def wrapper(coro):
try:
return await coro
finally:
context = contextvars.copy_context()
# store the context copy somewhere

Again, it looks more complicated as it should be.

The proposal is: 
1. Add 'context' keyword-only argument to asyncio.create_task() and 
loop.create_task().
2. Use this context if explicitly passed, create a copy of the current context 
otherwise.

The proposal is backward-compatible. Low-level API (call_soon(), call_later() 
etc.) already accept 'context' argument.

The attached PR demonstrates how the proposed API simplifies 
unittest.IsolatedAsyncioTestCase internals.

--
components: asyncio
messages: 414988
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Accept explicit contextvars.Context in asyncio create_task() API
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



[issue46944] Use FASTCALL calling convention in generator.throw

2022-03-12 Thread Kumar Aditya


Change by Kumar Aditya :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> performance

___
Python tracker 

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



[issue46953] use FASTCALL for __import__ builtin

2022-03-12 Thread Kumar Aditya


Change by Kumar Aditya :


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



[issue46993] Speed up bytearray creation from list and tuple

2022-03-12 Thread Kumar Aditya


New submission from Kumar Aditya :

The attached PR speeds up bytearray creation from list and tuple.

Benchmark (uses pyperf):
-
import pyperf

runner = pyperf.Runner()
runner.timeit(name="bench bytearray",
  stmt="bytearray([42]*1)",)
-

Results:

-
Mean +- std dev: [base] 74.8 us +- 5.5 us -> [patch] 53.2 us +- 3.3 us: 1.41x 
faster
-

--
components: Interpreter Core
messages: 414987
nosy: gvanrossum, kumaraditya303
priority: normal
pull_requests: 29935
severity: normal
status: open
title: Speed up bytearray creation from list and tuple
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



[issue46981] Empty typing.Tuple

2022-03-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If for repr(Tuple[()]), it is no longer needed.

--

___
Python tracker 

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



[issue46981] Empty typing.Tuple

2022-03-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46987] Remove _PySys_GetObjectId / _PySys_GetObjectId

2022-03-12 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
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-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The idea looks interesting.
The devil in the details I guess.
I'm curious what is the memory and performance penalty.
Waiting for the PR as the discussion starting point.

--

___
Python tracker 

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



[issue42238] Deprecate suspicious.py?

2022-03-12 Thread Julien Palard


Julien Palard  added the comment:

News: 

Hitting 3 months without a true positive from `make suspicious`, looks like 
sphinxlint starting to take over properly, I hope to close this issue soon 
(like in a few months maybe).

Also sphinxlint attracted some contributors [1] \o/

[1] https://github.com/sphinx-contrib/sphinx-lint

--

___
Python tracker 

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2022-03-12 Thread Kevin Locke


Change by Kevin Locke :


--
nosy: +kevinoid
nosy_count: 10.0 -> 11.0
pull_requests: +29932
pull_request: https://github.com/python/cpython/pull/23172

___
Python tracker 

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