[issue46066] Remove keyword args syntax for TypedDict definition

2022-02-03 Thread 97littleleaf11


Change by 97littleleaf11 <97littlelea...@gmail.com>:


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

___
Python tracker 

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



[issue46066] Remove keyword args syntax for TypedDict definition

2022-02-03 Thread 97littleleaf11


Change by 97littleleaf11 <97littlelea...@gmail.com>:


--
title: TypedDict alternative definition syntax with keyword args is confusing 
-> Remove keyword args syntax for TypedDict definition

___
Python tracker 

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



[issue46200] Discourage logging f-strings due to security considerations

2022-02-03 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

@rhettinger @tinchester I definitely see now that f-strings should have a place 
in logging. 
But do you agree that f-strings don't mix 100% safely with the current logger 
API?
What are your thoughts on a safer set of logger functions (see my comments 
above, https://bugs.python.org/issue46200#msg409505)

Just throwing an additional alternative out there: instead of the @overload 
approach, one could have 2 logger function families:

debugs(s: str)  # s-prefix indicates simply logging a 
string (no formatting done by logger!)
debugf(s: LiteralStr, *args, **kwargs)  # f prefix indicates logger does the 
formatting. (no formatting done by user!)

@vinay.sajip what are your thoughts on the discussion above?

--

___
Python tracker 

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



[issue20039] Missing documentation for argparse.ArgumentTypeError

2022-02-03 Thread Yassir Karroum


Change by Yassir Karroum :


--
keywords: +patch
nosy: +ukarroum
nosy_count: 6.0 -> 7.0
pull_requests: +29304
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31125

___
Python tracker 

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



[issue46631] Implement a "strict" mode for getpass.getuser()

2022-02-03 Thread Eryk Sun


New submission from Eryk Sun :

getpass.getuser() checks the environment variables LOGNAME (login name), USER, 
LNAME, and USERNAME, in that order. In Windows, LOGNAME, USER, and LNAME have 
no conventional usage. I think there should be a strict mode that restricts 
getuser() to check only USERNAME in Windows and only LOGNAME in POSIX [1]. If 
the login variable isn't defined, it should fall back on using the system API, 
based on the user ID in POSIX and the logon ID in Windows.

For the fallback in Windows, the _winapi module could implement 
GetCurrentProcessToken(), GetTokenInformation(), and LsaGetLogonSessionData(). 
For TokenStatistics, return a dict with just "AuthenticationId". For 
LsaGetLogonSessionData(), return a dict with just "UserName". 
GetCurrentProcessToken() returns a pseudohandle (-4), which should not be 
closed.

For example, assuming _winapi wraps the required functions:

def getuser(strict=False):
"""Get the username from the environment or password database.

First try various environment variables. If strict, check only LOGNAME
in POSIX and only USERNAME in Windows. As a fallback, in POSIX get the
user name from the password database, and in Windows get the user name
from the logon-session data of the current process.
"""
posix = sys.platform != 'win32'

if strict:
names = ('LOGNAME',) if posix else ('USERNAME',)
else:
names = ('LOGNAME', 'USER', 'LNAME', 'USERNAME')

for name in names:
if user := os.environ.get(name):
return user

if posix:
import pwd
return pwd.getpwuid(os.getuid())[0]

import _winapi
logon_id = _winapi.GetTokenInformation(
_winapi.GetCurrentProcessToken(),
_winapi.TokenStatistics)['AuthenticationId']
return _winapi.LsaGetLogonSessionData(logon_id)['UserName']

Like WinAPI GetUserNameW(), the above fallback returns the logon user name 
instead of the account name of the token user. As far as I know, the user name 
and the account name only differ for the builtin service account logons 
"SYSTEM" (999) and "NETWORK SERVICE" (996), for which the user name is the 
machine security principal (i.e. the machine's NETBIOS name plus "$"). The user 
name of the builtin "LOCAL SERVICE" logon (997), on the other hand, is just the 
"LOCAL SERVICE" account name, since this account lacks network access.

Unlike GetUserNameW(), the above code uses the process token instead of the 
effective token. This is like POSIX getuid(), whereas what GetUserNameW() does 
is like geteuid(). getuser() could implement an `effective` option to return 
the effective user name. In Windows this would switch to calling 
GetCurrentThreadEffectiveToken() instead of GetCurrentProcessToken().

---

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

--
components: Library (Lib), Windows
messages: 412495
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Implement a "strict" mode for getpass.getuser()
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



[issue46627] Regex hangs indefinitely

2022-02-03 Thread Tim Peters


Tim Peters  added the comment:

Introducing some kind of optional timeout is too involved to just drop in 
without significant discussion and design effort first. If you want to pursue 
this, please bring it up on the python-ideas mailing list.

My first take: it wouldn't really help, because nobody would use it until after 
it was too late ;-) So, in the absence of someone jumping on it right away, I'm 
closing this one too as "won't fix". If the idea gains traction, we can, of 
course, reopen this.

BTW, Jeffrey Friedl's book "Mastering Regular Expressions" teaches how to write 
bulletproof regexps. It's not always obvious at first glance, but it's an art 
that can be mastered.

--
nosy: +tim.peters
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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 9ce0b00fb1172e743de985eda28e3335aa95014a by Miss Islington (bot) 
in branch '3.10':
bpo-46588: fix typo in test_calltip.py  (GH-31119)
https://github.com/python/cpython/commit/9ce0b00fb1172e743de985eda28e3335aa95014a


--

___
Python tracker 

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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29303
pull_request: https://github.com/python/cpython/pull/31122

___
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-03 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
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-03 Thread Eric Snow


Eric Snow  added the comment:

(thanks Victor: 
https://mail.python.org/archives/list/python-...@python.org/message/7RMLIJHUWVBZFV747TFEHOE6LNBVQSMM/)

3rd party use of _Py_IDENTIFIER():

* blender
   + 
https://github.com/blender/blender/blob/master/source/blender/python/intern/bpy_traceback.c#L53
  - copied from core code
  - "msg", "filename", "lineno", "offset", "text", ""
  - uses _PyObject_GetAttrId()
* datatable
   + 
https://github.com/h2oai/datatable/blob/45a87337bc68576c7fb6900f524925d4fb77d6a6/src/core/python/obj.cc#L76
  - in C++ wrapper getting sys.stdout, etc. and writing to sys.stdout
  - has to hack around C++14 support
  - has a fallback under limited API
  - "stdin", "stdout", "stderr", "write"
  - uses _PySys_GetObjectId(), _PyObject_GetAttrId()
* multidict (in aiohttp)
   + 
https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/defs.h#L8
   + 
https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/istr.h#L46
   + 
https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/pair_list.h#L114
  - calling str.lower()
  - "lower"
  - uses _PyObject_CallMethodId()
* mypy (exclusively in mypyc, including in generated code!)
   + 
https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a45d4/mypyc/lib-rt/dict_ops.c#L76
   + 
https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a45d4/mypyc/lib-rt/dict_ops.c#L131
  - "setdefault", "update"
  - uses _PyObject_CallMethodIdObjArgs(), _PyObject_CallMethodIdOneArg()
   + 
https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/pythonsupport.h#L26
   + 
https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/pythonsupport.h#L109
  - "__mro_entries__", "__init_subclass__"
  - uses _PyObject_LookupAttrId(), _PyObject_GetAttrId()
   + 
https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L27
   + 
https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L47
  - "send", "throw", "close"
  - uses _PyObject_CallMethodIdOneArg(), _PyObject_GetAttrId()
   + 
https://github.com/python/mypy/blob/8c5c915a89ec0f35b3e07332c7090e62f143043e/mypyc/lib-rt/bytes_ops.c#L104
  - "join"
  - uses _PyObject_CallMethodIdOneArg()
   + 
https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a45d4/mypyc/codegen/emitwrapper.py#L326
   + 
https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L694
  - uses _PyObject_GetAttrId()
* pickle5
   + 
https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/_pickle.c#L224
   + 
https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/compat.h
  - "getattr"
  - uses _PyUnicode_FromId()
* pysqlite3
   + 
https://github.com/coleifer/pysqlite3/blob/f302859dc9ddb47a1089324dbca3873740b74af9/src/microprotocols.c#L103
   + 
https://github.com/coleifer/pysqlite3/blob/f302859dc9ddb47a1089324dbca3873740b74af9/src/microprotocols.c#L119
  - "__adapt__", "__conform__"
  - uses _PyObject_CallMethodId()
   + 
https://github.com/coleifer/pysqlite3/blob/093b88d1a58b141db8cf971c35ea1f6b674d0d02/src/connection.c#L51
   + 
https://github.com/coleifer/pysqlite3/blob/093b88d1a58b141db8cf971c35ea1f6b674d0d02/src/connection.c#L772
  - "finalize", "value", "upper", "cursor"
  - uses _PyObject_CallMethodId(), _PyObject_CallMethodIdObjArgs()
   + 
https://github.com/coleifer/pysqlite3/blob/49ce9c7a89a3c9f47ab8d32b6c4e2f7d629c1688/src/module.c#L195
  - "upper"
  - uses _PyObject_CallMethodId()
   + 
https://github.com/coleifer/pysqlite3/blob/91b2664f525b19feedfca3f0913302c6f1e8be8a/src/cursor.c#L103
  - "upper"
  - uses _PyObject_CallMethodId()
* typed_ast
   + a fork of CPython's ast code
* zodbpickle
   + a fork of CPython's pickle

All of them should be trivial to drop _Py_IDENTIFIER() without any real 
performance impact or mess.

Also, the following implies that PyPy has some sort of _Py_IDENTIFIER() 
support: 
https://github.com/benhoyt/scandir/blob/3396aa4155ffde8600a0e9ca50d5872569169b5d/_scandir.c#L51.

--

___
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-03 Thread Tim Peters


Tim Peters  added the comment:

Raised the priority back to normal.

I agree with Dennis's observation that PyDict_Next is safe, provided it's used 
as intended: it returns borrowed references, but to things that absolutely are 
legitimate at the time. In the presence of mutations, *what* it returns isn't 
defined at all, but I don't see a way for it to blow up (unless its caller 
screws up by believing it owns the references). It doesn't assume anything 
about the structure of the dict across calls.

--
nosy: +tim.peters
priority: low -> normal

___
Python tracker 

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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 663370aea5dcf9074455b45283e980c7bc353674 by Miss Islington (bot) 
in branch '3.9':
bpo-46588: fix typo in test_calltip.py  (GH-31119)
https://github.com/python/cpython/commit/663370aea5dcf9074455b45283e980c7bc353674


--

___
Python tracker 

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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +29302
pull_request: https://github.com/python/cpython/pull/31121

___
Python tracker 

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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread Terry J. Reedy


New submission from Terry J. Reedy :


New changeset 222865daabfa7a8b12ca9a5e9c23b9ce217448f1 by Caio Agiani in branch 
'main':
bpo-46588: fix typo in test_calltip.py  (GH-31119)
https://github.com/python/cpython/commit/222865daabfa7a8b12ca9a5e9c23b9ce217448f1


--
nosy: +terry.reedy

___
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-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It looks like usages of the PyDict_Next API assume the resulting references are 
borrowed and so INCREF them.

Usages of set_next do not, but should.

It should hopefully be a straightforward fix of adding INCREF/DECREFs.

--

___
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-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Marking as low priority given that ehe next loop code has been deployed without 
incident for two decades (a little less for sets and a little more for dicts).

--
priority: normal -> low

___
Python tracker 

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



[issue46588] fix typo in test_calltip.py

2022-02-03 Thread Caio Agiani


Change by Caio Agiani :


--
pull_requests: +29300
pull_request: https://github.com/python/cpython/pull/31119

___
Python tracker 

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



[issue33178] Add support for BigEndianUnion and LittleEndianUnion in ctypes

2022-02-03 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith
versions: +Python 3.11 -Python 2.7, Python 3.6

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29299
pull_request: https://github.com/python/cpython/pull/31118

___
Python tracker 

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



[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 91e888904478271c27c52c773863b41f5a8f7f30 by Miss Islington (bot) 
in branch '3.10':
bpo-14916: use specified tokenizer fd for file input (GH-31006)
https://github.com/python/cpython/commit/91e888904478271c27c52c773863b41f5a8f7f30


--

___
Python tracker 

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



[issue45380] help() appears confused about the module of typing.Annotated

2022-02-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

It looks like __metadata__ was *meant* to be a public attribute, but somehow 
overseen when the PEP and docs were written. :-(

I don't know anything about this class, really.

--

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


Jelle Zijlstra  added the comment:

I'd also be wary about making changes that introduce additional runtime checks. 
As we've seen with the PEP 612 and 646 implementations, those can impede future 
iteration on typing.

--

___
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-02-03 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, sobolevn

___
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-02-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't think that changing list[None] to list[NoneType] in the output is an 
improvement. I do appreciate the reduction in C code though!

--

___
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-03 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

It looks like this can be closed. Petr?

--
status: open -> pending

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue46566] Support -3.11-arm64 in py.exe launcher

2022-02-03 Thread Tommy Vercetti


Tommy Vercetti  added the comment:

PEP 514 looks good to me

--
nosy: +TommyVCT

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 4f76b3667d856a13107c65d44d802d0e73c3f104 by Miss Islington (bot) 
in branch '3.10':
bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)
https://github.com/python/cpython/commit/4f76b3667d856a13107c65d44d802d0e73c3f104


--

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset dc315f30f86a1dc7c4607398b379d7c0b55c7549 by Miss Islington (bot) 
in branch '3.9':
bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)
https://github.com/python/cpython/commit/dc315f30f86a1dc7c4607398b379d7c0b55c7549


--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2022-02-03 Thread Tommy Vercetti


Tommy Vercetti  added the comment:

Thank you Steve!

--

___
Python tracker 

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



[issue42926] Split compiler into code-gen, optimizer and assembler.

2022-02-03 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +29296
pull_request: https://github.com/python/cpython/pull/31114

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29297
pull_request: https://github.com/python/cpython/pull/31115

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset d1df81a730499cc6286d02afa6028a1e9c22bbbf by Terry Jan Reedy in 
branch 'main':
bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)
https://github.com/python/cpython/commit/d1df81a730499cc6286d02afa6028a1e9c22bbbf


--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2022-02-03 Thread Steve Dower


Steve Dower  added the comment:

Closing this issue, as we have others to track individual tasks.

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Eric Snow


Eric Snow  added the comment:

> This means that ThreadPoolExecutor's atexit runs before mine,
> and since I never get a chance to cancel my tasks, it deadlocks.

(assuming we want to support long-running tasks here)

With all the above in mind, there are a few things that may help.

The first that comes to mind is to have the atexit handler call 
ThreadPoolExecutor.shutdown() for each instance.

So something like this:


def _python_exit():
global _shutdown
with _global_shutdown_lock:
_shutdown = True
for executor in list(_executors):
executor.shutdown()


That would require a little refactoring to make it work.  However, the change 
is simpler if each executor has its own atexit handler:


class ThreadPoolExecutor(_base.Executor):

def __init__(self, ...):
...
threading._register_atexit(self._atexit())

def _atexit(self):
global _shutdown
_shutdown = True
self.shutdown()


The value of either approach is that you can then subclass ThreadPoolExecutor 
to get what you want:


class MyExecutor(ThreadPoolExecutor):
def shutdown(self, *args, **kwargs):
stop_my_tasks()
super().shutdown(*args, **kwwargs)




One thing I thought about was supporting a per-task finalizer instead, since 
that aligns more closely with the way ThreadPoolExecutor works.  It would only 
apply  So something like one of the following:

* ThreadPoolExecutor(finalize_task=)
* ThreadPoolExecutor.submit(finalize=)
* ThreadPoolExecutor.register_atexit()
* (classmethod) ThreadPoolExecutor.register_atexit()
* concurrent.futures.register_atexit()

(It would probably make sense to pass the list of currently running tasks to 
the callable.)

--

___
Python tracker 

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



[issue46200] Discourage logging f-strings due to security considerations

2022-02-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

In a favor of deferred substitution, the cookbook should have a recipe where 
substituted messages are logged to a file and the unsubstituted message stored 
in SQLite3 database with the parameters stored as JSON.This gives both 
human readable output and queryable, preparsed data for automated analysis.

--

___
Python tracker 

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



[issue46200] Discourage logging f-strings due to security considerations

2022-02-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Eric is absolutely right, due to function calls being 
> somewhat slow in Python the performance argument in
> practice falls in favor of f-strings.

Also f-strings can evaluate expressions in the template which is also a big win:

   f('Pending {len(req)} requests: {req[0]!r} ... {req[-1]!r}')

--
nosy: +rhettinger

___
Python tracker 

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Eric Snow


Eric Snow  added the comment:

FWIW, here's a brain dump about ThreadPoolExecutor and its atexit handler after 
having looked at the code.



First, the relationship between the objects involved:

* work item -> Future
* work item -> task (e.g. function)
* queue -> [work item]
* worker -> executor
* worker -> queue
* worker -> currently running work item
* thread -> worker
* ThreadPoolExecutor -> [thread]
* ThreadPoolExecutor -> queue
* global state -> {thread: queue}

Observations:

* a work item's future and task are not aware of each other, and operations on 
either have no effect on the other



Next, let's look at the relevant ways the objects can be used:

* publicly
   * ThreadPoolExecutor.submit(task) -> Future
   * ThreadPoolExecutor.shutdown()
   * Future.result() and Future.exception()
   * Future.cancel()
   * Future.add_done_callback()
* internally
   * queue.pop() -> work item
   * .run()
   * thread.join()
   * Future.set_running_or_notify_cancel()
   * Future.set_result() and Future.set_exception()

Observations:

* nothing interacts with a worker directly; it is waited on via its thread and 
it receives work (or None) via the queue it was given
* once a worker pops the next work item off the queue, nothing else has access 
to that work item (the original ThreadPoolExecutor().submit() caller has the 
Future, but that's it)
* there is no cancelation mechanism for tasks
* there is no simple way to interact with the queued tasks
* realistically, there is no way to interact with the currently running task
* there is no reliable way to "kill" a thread



Regarding how tasks run:

* ThreadPoolExecutor.submit(task) -> Future
* ThreadPoolExecutor.submit(task) -> work item (Future, task) -> queue
* ThreadPoolExecutor.submit(task) -> thread (worker)
* thread -> worker -> ( queue -> work item -> task )

Observations::

* the worker loop exits if the next item in the queue is None (and the executor 
is shutting down)



Now lets look more closely at the atexit handler.

* as you noted, since 3.9 it is registered with threading._register_atexit() 
instead of atexit.register()
* the threading atexit handlers run before the regular atexit handlers
* the ThreadPoolExecutor handler does not actually interact with 
ThreadPoolExecutor instances directly
* it only deals with a module-global list of (thread, [work item]) pairs, to 
which ThreadPoolExecutor instances add items as they go

The handler does the following:

1. disables ThreadPoolExecutor.submit() (for all instances)
2. (indirectly) tells each worker to stop ASAP
3. lets every pending task run (and lets every running task keep running)
4. waits until all tasks have finished

It does not:

* call any ThreadPoolExecutor.shutdown()
* otherwise deal with the ThreadPoolExecutor instances directly
* call Future.cancel() for any of the tasks
* use any timeout in step 4, so it may block forever
* notify tasks that they should finish
* deal well with any long-running (or infinite) task

ThreadPoolExecutor.shutdown() basically does the same thing.  However, it only 
does the steps above for its own tasks.  It also optionally calls 
Future.cancel() for each queued task (right before step 2).  However, all that 
does is keep any queued-but-not-running tasks from starting.  Also, you can 
optionally skips step 4.

--

___
Python tracker 

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Eric Snow


Eric Snow  added the comment:

> I'm running some long-running (possibly infinite) tasks in the thread pool,
> and I cancel them in an `atexit` callback

Alternately, perhaps ThreadPoolExecutor isn't the right fit here, as implied by 
the route you ended up going.  It seems like it's not well-suited for 
long-running (or infinite) tasks.  In that case, perhaps the concurrent.futures 
docs could be more clear about when ThreadPoolExecutor is not a good fit and 
what the alternatives are.

--

___
Python tracker 

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Eric Snow


Eric Snow  added the comment:

> I'm running some long-running (possibly infinite) tasks in the thread pool,
> and I cancel them in an `atexit` callback

To be clear, by "cancel" you are not talking about Future.cancel().  Rather, 
your handler causes all running tasks to finish (by sending a special message 
on the socket corresponding to each running task).  Is that right?

Some other things I inferred from your atexit handler:

* it does not make sure the task associated with the socket finishes (no way of 
knowing?)
* so if a task hangs while trying to stop then the running thread in the 
ThreadPoolExecutor would block shutdown forever
* similarly, if a task is stuck handling a request then it will never receive 
the special message on the socket, either blocking the send() in your handler 
or causing ThreadPoolExecutor shutdown/atexit to wait forever
* it vaguely implies a 1-to-1 relationship between sockets and *running* tasks
* likewise that pending (queued) tasks do not have an associated socket (until 
started)
* so once your handler finishes, any tasks pending in the ThreadPoolExecutor 
queue will eventually get started but never get stopped by your handler; thus 
you're back to the deadlock situation

Does all that sound right?  Most of that is relevant to some possible solutions 
I have in mind.

--
nosy: +eric.snow

___
Python tracker 

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



[issue46573] Python modules such as pyglet or pygame crash Python when tkinter message boxes are opened on MacOS.

2022-02-03 Thread Ned Deily


Ned Deily  added the comment:

Thanks, Marc and Ronald, for the analysis.

And thanks for bringing up the issue, Remy. Perhaps you can verify that 
Ronald's suggestion of importing and launching Tk before calling pyglet or 
pygame works for you and, if so, follow up with those projects to, if nothing 
else, document that requirement for their users on macOS (I would guess it 
wouldn't hurt on other platforms as well but I've guessed wrong before). In any 
case, I'm closing this issue now.

--
status: open -> closed

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset cf7cb1a2bf40516dc571d1d90c12b632dcd9b8c8 by Miss Islington (bot) 
in branch '3.9':
bpo-45975: IDLE - Remove extraneous parens (GH-31107)
https://github.com/python/cpython/commit/cf7cb1a2bf40516dc571d1d90c12b632dcd9b8c8


--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-03 Thread Steve Dower


Steve Dower  added the comment:

Posted the PR for openness, but it's not ready to merge yet.

The file that's been updated there (which unfortunately is not very Unix 
friendly) now has the SHA256 hash of our signing certificate, and I've emailed 
the file to storeops at Microsoft to request them to sign it. The signed one 
will replace classicAppCompat.sccd

The reason we need this file is because we set globally readable registry keys 
on install for PEP 514 (these appear in the appxmanifest file generated by 
PC/layout). That's not a normal app permission, and so we have to request 
special permissions to do it.

--

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 63523e7b2a631f28134b25a8063d50e08c741db6 by Miss Islington (bot) 
in branch '3.10':
bpo-45975: IDLE - Remove extraneous parens (GH-31107)
https://github.com/python/cpython/commit/63523e7b2a631f28134b25a8063d50e08c741db6


--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-03 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue46630] IDLE: Set query focus to entry box on Windows

2022-02-03 Thread Terry J. Reedy


New submission from Terry J. Reedy :

On Mac, and I presume *nix in general, query boxes open with the focus on the 
first entry box, with the cursor displayed.  One can immediate enter a line 
number, dotted module name, or whatever. On Windows, since 3.9, one must hit 
Tab or click on the entry box to set the focus.  If a blank entry is an error, 
one can even click on OK or hit Enter and the focus will move after an error 
message.

idlelib/query.py already has self.entry.focus_set.  Why did that stop working 
in 3.9?  All patches to query.py were before May 2021 and backported to 3.8.  
Perhaps the upgrade from tk 8.6.9 to 8.6.12 had an effect given the code as it 
is.  Text widgets have the same issue and Editor window has 'text.focus_set' in 
'__init__' and that works.  Whatever, moving entry.focus_set() to just after 
self.deiconify() works without affecting unittests both in Windows repository 
and 3.11 installed on macOS.

--
assignee: terry.reedy
components: IDLE
messages: 412465
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Set query focus to entry box on Windows
type: behavior

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


Serhiy Storchaka  added the comment:

It does not have a use case of T[int] in mind. It is an implementation detail 
which simplifies the code, makes runtime checks more strict and makes 
types.GenericAlias more similar to typing._GenericAlias.

For example, currently:

>>> A = List[T]
>>> B = list[T]
>>> A[None]
typing.List[NoneType]
>>> B[None]
list[None]
>>> A['X']
typing.List[ForwardRef('X')]
>>> B['X']
list['X']

With the proposed change:

>>> B[None]
list[NoneType]
>>> B['X']
list[ForwardRef('X')]

Meanless expressions like A[42], A[Final], A[Final[int]], A[ClassVar], 
A[ClassVar[int]], etc which are silently accepted will now be errors.

The code simplification (especially for the C code) is my primary goal, and the 
rest is a nice side effect. It is possible to add more strict runtime checks 
and conversions without making TypeVar and ParamSpec subscriptable, but the 
code will not be so simple.

--

___
Python tracker 

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



[issue23041] csv needs more quoting rules

2022-02-03 Thread Miha Šetina

Miha Šetina  added the comment:

Is this still on track for python 3.11?

--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-03 Thread Steve Dower


Change by Steve Dower :


--
components: +Windows
nosy: +paul.moore, tim.golden, zach.ware

___
Python tracker 

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



[issue46628] Can't install YARL

2022-02-03 Thread Paul Koning


Paul Koning  added the comment:

Thanks, I'll pass the word to the yarl and aiohttp team (both have this issue).

--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-03 Thread Steve Dower


New submission from Steve Dower :

We need to update PC/classicAppCompat.can.xml for our new certificate and email 
Microsoft to get it signed again.

--
assignee: steve.dower
messages: 412461
nosy: steve.dower
priority: normal
severity: normal
status: open
title: Cannot sideload MSIX package on Windows
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



[issue46628] Can't install YARL

2022-02-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

Ah. longintrepr.h is an internal Python file, not meant for external 
consumption. This file moved in Python 3.11. So this is still a yarl issue: 
they'll need to adjust how they read that file. But my recommendation is that 
they find another way to do what they want without including it.

See https://github.com/python/cpython/blob/main/Include/README.rst. Files in 
the cpython directory (which longintrepr.h is) are a CPython implementation 
detail, and can change or move at any time.

--

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29293
pull_request: https://github.com/python/cpython/pull/31110

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29292
pull_request: https://github.com/python/cpython/pull/31109

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 916d0d822c79933f4c420f7a36f16f3eb788646b by Terry Jan Reedy in 
branch 'main':
bpo-45975: IDLE - Remove extraneous parens (GH-31107)
https://github.com/python/cpython/commit/916d0d822c79933f4c420f7a36f16f3eb788646b


--

___
Python tracker 

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



[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston


J.B. Langston  added the comment:

Sorry, on rereading your message I guess you were referring to the extra +, not 
the [^]]. The extra + after the ) was not intentional, and after removing it, 
the regex no longer hangs.

I still think it would be nice to have a timeout setting on the regex so it 
can't hang up an entire process.

--

___
Python tracker 

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



[issue46628] Can't install YARL

2022-02-03 Thread Paul Koning


Paul Koning  added the comment:

The only dependency mentioned by the yarl documentation is multidict and 
installing that makes no difference.  I see I can tell yarl to build a 
pure-python version to avoid compiling stuff.  If I do that it installs.  But 
what I actually wanted to do is install aiohttp, and that step fails with the 
exact same error message.

Given that it works in 3.10 but fails in 3.11a4, it does seem there is 
something about the new code that is involved here.

--

___
Python tracker 

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



[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston


J.B. Langston  added the comment:

Yes, it is supposed to match everything up to the closing ] in this substring: 

[BigTableReader(path='/data/cassandra/data/log/logEntry_202202-e68971800b2711ecaf770d5fa3f5ae87/md-112-big-Data.db')]

Quoting from the re docs:

To match a literal ']' inside a set, precede it with a backslash, or place it 
at the beginning of the set. For example, both [()[\]{}] and []()[{}] will both 
match a parenthesis.

The docs don't specifically state the case of a negated set using ^, but I have 
used this construction many times and never had a problem with it.

Furthermore, it is not what caused the regex to hang.  That was caused by 
"(?P[^,]+)," and changing it to "(?P.+?)," fixed 
the problem.

--

___
Python tracker 

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



[issue46628] Can't install YARL

2022-02-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

It looks like you're missing dependencies required to compile yarl. Since this 
isn't a bug with Python, I'm going to close this.

I suggest you ask the yarl community for help. Their home page is 
https://github.com/aio-libs/yarl/

Good luck!

--
nosy: +eric.smith
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46524] test_peg_generator takes 8 minutes on Windows

2022-02-03 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks to Kumar for contributing Windows compiler flags side of this (the point 
of this issue).

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

___
Python tracker 

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



[issue46628] Can't install YARL

2022-02-03 Thread Paul Koning


New submission from Paul Koning :

Trying to install "aiohttp" with pip I get a compile error installing "yarl".  
I get the same error when I install just that module.  But it installs fine on 
3.10.  This is on an Apple M1 (ARM64) machine.

--
components: macOS
files: yarl.log
messages: 412453
nosy: ned.deily, pkoning, ronaldoussoren
priority: normal
severity: normal
status: open
title: Can't install YARL
type: compile error
versions: Python 3.11
Added file: https://bugs.python.org/file50602/yarl.log

___
Python tracker 

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



[issue46627] Regex hangs indefinitely

2022-02-03 Thread Matthew Barnett


Matthew Barnett  added the comment:

That pattern has:

(?P[^]]+)+

Is that intentional? It looks wrong to me.

--

___
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-03 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29291
pull_request: https://github.com/python/cpython/pull/31108

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2022-02-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +29290
pull_request: https://github.com/python/cpython/pull/31107

___
Python tracker 

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



[issue46626] expose IP_BIND_ADDRESS_NO_PORT linux socket option

2022-02-03 Thread Benjamin Peterson


New submission from Benjamin Peterson :


New changeset 1aa6be06c4cb7f04a340adb1c7b16b89803ef254 by Benjamin Peterson in 
branch 'main':
closes bpo-46626: Expose IP_BIND_ADDRESS_NO_PORT socket option. (GH-31106)
https://github.com/python/cpython/commit/1aa6be06c4cb7f04a340adb1c7b16b89803ef254


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



[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston


New submission from J.B. Langston :

The following code will cause Python's regex engine to hang apparently 
indefinitely: 

import re
message = "Flushed to 
[BigTableReader(path='/data/cassandra/data/log/logEntry_202202-e68971800b2711ecaf770d5fa3f5ae87/md-112-big-Data.db')]
 (1 sstables, 8,650MiB), biggest 8,650MiB, smallest 8,650MiB"
regex = re.compile(r"Flushed to \[(?P[^]]+)+\] \((?P[^ 
]+) sstables, (?P[^)]+)\), biggest (?P[^,]+), 
smallest (?P[^ ]+)( \((?P\d+)ms\))?")
regex.match(message)

This may be a case of exponential backtracking similar to #35915 or #30973. 
Both of these issues have been closed as Wont Fix, and I suspect my issue is 
similar. The use of commas for decimal points in the input string was not 
anticipated but happened due to localization of the logs that the message came 
from.  The regex works properly when the decimal point is a period.

I will try to rewrite my regex to address this specific issue, but it's hard to 
anticipate every possible input and craft a bulletproof regex, so something 
like this kind of thing can be used for a denial of service attack (intentional 
or not). In this case the regex was used in an automated import process and 
caused the process to back up for many hours before someone noticed.  Maybe a 
solution could be to add a timeout option to the regex engine so it will give 
up and throw an exception if the regex executes for longer than the configured 
timeout.

--
components: Regular Expressions
messages: 412450
nosy: ezio.melotti, jblangston, mrabarnett
priority: normal
severity: normal
status: open
title: Regex hangs indefinitely
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue46626] expose IP_BIND_ADDRESS_NO_PORT linux socket option

2022-02-03 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue46626] expose IP_BIND_ADDRESS_NO_PORT linux socket option

2022-02-03 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
components: Library (Lib)
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: expose IP_BIND_ADDRESS_NO_PORT linux socket option
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



[issue46072] Unify handling of stats in the CPython VM

2022-02-03 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29288
pull_request: https://github.com/python/cpython/pull/31105

___
Python tracker 

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



[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2022-02-03 Thread Géry

Change by Géry :


--
nosy: +maggyero

___
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-03 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29287
pull_request: https://github.com/python/cpython/pull/31104

___
Python tracker 

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



[issue46621] Should map(function, iterable, ...) replace StopIteration with RuntimeError?

2022-02-03 Thread Vedran Čačić

Vedran Čačić  added the comment:

Just for the record, I consider PEP 479 one of (very rare) design bugs in 
Python, and would like it reversed some day. (So anything that helps this 
outcome, including -1 on this, is welcome.)

It subverts the natural property of exceptions (that they bubble through frames 
undisturbed until caught) for no benefit at all, and it has made me write 
almost every chained generator since then in a more complex way, adding 
boilerplate code that converts inner StopIteration to return. I'm sure many 
others have done so too. Ceterum censeo PEP479em esse delendam.

--
nosy: +veky

___
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-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Presumably _PyDict_Next is also suspect.  Even the advertised "safe" calls to 
PyDict_SetItem() for existing keys would be a trigger.  Calling clear() in 
either __eq__ or __hash__ would suffice.

If the next loops are the culprint, the new challenge is figuring out how to 
fix it without wrecking code clarity and performance (and having to deprecate 
PyDict_Next() which is part of the stable ABI).

--

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2022-02-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
priority: release blocker -> 
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



[issue46285] protocol_version in http.server.test can be ignored

2022-02-03 Thread Éric Araujo

Change by Éric Araujo :


--
dependencies: +Pass the -d/--directory command-line option to 
http.server.CGIHTTPRequestHandler
versions:  -Python 3.10, Python 3.9

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2022-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset ff6948b1286c854ee77dfc0b23b9d828b36873e4 by Miss Islington (bot) 
in branch '3.10':
bpo-45773: Remove invalid peephole optimizations (GH-31066)
https://github.com/python/cpython/commit/ff6948b1286c854ee77dfc0b23b9d828b36873e4


--

___
Python tracker 

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



[issue46436] Pass the -d/--directory command-line option to http.server.CGIHTTPRequestHandler

2022-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29286
pull_request: https://github.com/python/cpython/pull/31103

___
Python tracker 

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



[issue46436] Pass the -d/--directory command-line option to http.server.CGIHTTPRequestHandler

2022-02-03 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46436] Pass the -d/--directory command-line option to http.server.CGIHTTPRequestHandler

2022-02-03 Thread miss-islington

miss-islington  added the comment:


New changeset 2d080347d74078a55c47715d232d1ab8dc8cd603 by Géry Ogam in branch 
'main':
bpo-46436: Fix command-line option -d/--directory in module http.server 
(GH-30701)
https://github.com/python/cpython/commit/2d080347d74078a55c47715d232d1ab8dc8cd603


--
nosy: +miss-islington

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2022-02-03 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46569] final note on StrEnum documentation incorrectly refers to int.__format__ instead of str.__format__

2022-02-03 Thread Ethan Furman


Change by Ethan Furman :


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



[issue46569] final note on StrEnum documentation incorrectly refers to int.__format__ instead of str.__format__

2022-02-03 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 734b1f119be6f0dcd6845c78a9e0a71d88a90b59 by Nikita Sobolev in 
branch 'main':
bpo-46569: [Enum] fix typo in `StrEnum` docs (GH-31007)
https://github.com/python/cpython/commit/734b1f119be6f0dcd6845c78a9e0a71d88a90b59


--

___
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-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The likely culprit is the set_next() loop.  Perhaps it is never safe to use 
set_next() because any lookup can callback to __eq__ which can mutate the set.

Since set_isdisjoint() method isn't a mutating method, that is the easiest 
place to start investigating.  Try disabling the exact set fast path to see if 
the issue persists.

--

___
Python tracker 

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



[issue46625] timeout option of socket.create_connection is not respected

2022-02-03 Thread Nicolas SURRIBAS


New submission from Nicolas SURRIBAS :

When passing to socket.create_connection a timeout option above (approximately) 
127 seconds, the timeout is not respected. 

Code to reproduce the issue :

import socket
from time import monotonic

print(socket.getdefaulttimeout())
start = monotonic()
try:
socket.create_connection(("1.1.1.1", 21), 300)
except Exception as exception:
print(exception)

print(monotonic() - start)

Output at execution:

None
[Errno 110] Connection timed out
129.3075186319984

Expected behavior would be that the "Connection timed out" exception is raised 
after 300 seconds, as given in argument, not 129.

Observed with Python 3.9.1

--
components: IO
messages: 412443
nosy: Nicolas SURRIBAS
priority: normal
severity: normal
status: open
title: timeout option of socket.create_connection is not respected
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset 6baa98e538b2e26f16eaaf462f99496e98d2cfb1 by Miro Hrončok in 
branch 'main':
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" 
(GH-31098)
https://github.com/python/cpython/commit/6baa98e538b2e26f16eaaf462f99496e98d2cfb1


--

___
Python tracker 

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



[issue45885] Specialize COMPARE_OP

2022-02-03 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 674ab66ebdf06f187e193a3d7bde13b71ba0f9af by Dennis Sweeney in 
branch 'main':
bpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)
https://github.com/python/cpython/commit/674ab66ebdf06f187e193a3d7bde13b71ba0f9af


--

___
Python tracker 

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



[issue38119] resource tracker destroys shared memory segments when other processes should still have valid access

2022-02-03 Thread timka


timka  added the comment:

On the long run: Maybe this could solve some win32api problems?

https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

--
nosy: +timka

___
Python tracker 

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



[issue44863] Allow TypedDict to inherit from Generics

2022-02-03 Thread Thomas Grainger


Thomas Grainger  added the comment:

there's a thread on typing-sig for this now: 
https://mail.python.org/archives/list/typing-...@python.org/thread/I7P3ER2NH7SENVMIXK74U6L4Z5JDLQGZ/#I7P3ER2NH7SENVMIXK74U6L4Z5JDLQGZ

--
nosy: +graingert

___
Python tracker 

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Simon Arlott


Simon Arlott  added the comment:

Another way to do this is to call threading.main_thread().join() in another 
thread and do the shutdown cleanup when it returns.

The main thread is stopped at shutdown just before the 
threading._threading_atexits are called.

--
nosy: +sa

___
Python tracker 

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



[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Miro Hrončok

Miro Hrončok  added the comment:

Proposed the revert at https://github.com/python/cpython/pull/31098

--

___
Python tracker 

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



[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Miro Hrončok

Change by Miro Hrončok :


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

___
Python tracker 

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



[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Miro Hrončok

New submission from Miro Hrončok :

In 
https://github.com/python/cpython/commit/5afa0a411243210a30526c7459a0ccff5cb88494
 the support for non-integer types was removed from random.randrange().

This change is not backward-compatible and it breaks 3rd party code, for 
example:

simplewrap: https://bugzilla.redhat.com/show_bug.cgi?id=2050093
numpy-stl: https://bugzilla.redhat.com/show_bug.cgi?id=2050092 == 
https://github.com/WoLpH/numpy-stl/issues/188

That support was only deprecated in Python 3.10 and it needs to remain 
deprecated for at least two Python releases. Please revert this change from 
Python 3.11 and wait for at least Python 3.12.

See https://www.python.org/dev/peps/pep-0387/#making-incompatible-changes

When you do remove this from Python 3.12, please make sure to document it in 
the What's new document.

Thank you.

--
components: Library (Lib)
messages: 412436
nosy: hroncok, pablogsal, rhettinger
priority: normal
severity: normal
status: open
title: random.randrange removed support for non-integer types after just one 
release of deprecation
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



[issue42222] Modernize integer test/conversion in randrange()

2022-02-03 Thread Petr Viktorin


Petr Viktorin  added the comment:

Since this is a user-visible change in 3.11, could you add a What's New entry?

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue45380] help() appears confused about the module of typing.Annotated

2022-02-03 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue46524] test_peg_generator takes 8 minutes on Windows

2022-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

Duration of the "Tests" step of https://github.com/python/cpython/pull/30890 

* GHA win32: 14 min 11 sec (test_peg_generator: 8 min 16 sec)
* GHA win64: 21 min 2 sec (test_peg_generator: 16 min 38 sec)
* Azure win32: 9 min 34 sec (test_peg_generator: 5 min 30 sec)
* Azure win64: 13 min 56 sec (test_peg_generator: 8 min 3 sec)

Duration of the "Tests" step of https://github.com/python/cpython/pull/31096 
(which includes Gregory's change):

* GHA win32: 8 min 30 sec (test_peg_generator: 5 min 1 sec)
* GHA win64: 8 min 29 sec (test_peg_generator: 4 min 52 sec)
* Azure win32: 9 min 54 sec (test_peg_generator: 4 min 19 sec)
* Azure win64: 7 min 57 sec (test_peg_generator: 3 min 32 sec)

test_peg_generator is way faster, and the total tests duration is shorter 
especially the maximum time: 21 min (before) => 10 min (after).

--

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2022-02-03 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset e0433c1e70254d4d0357a9e14596929a04bdf769 by Brandt Bucher in 
branch 'main':
bpo-45773: Remove invalid peephole optimizations (GH-31066)
https://github.com/python/cpython/commit/e0433c1e70254d4d0357a9e14596929a04bdf769


--

___
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-02-03 Thread Julien Palard


Change by Julien Palard :


--
pull_requests: +29282
pull_request: https://github.com/python/cpython/pull/31097

___
Python tracker 

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



  1   2   >