[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-08-30 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily
stage: patch review -> commit review
title: MacOS: Python binaries not portable between Catalina and Big Sur -> 
ctypes.util.find_library() does not find macOS 11+ system libraries when built 
on older macOS systems
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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +26499
pull_request: https://github.com/python/cpython/pull/28055

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26500
pull_request: https://github.com/python/cpython/pull/28056

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-08-30 Thread Irit Katriel

Irit Katriel  added the comment:

Are you suggesting that anyone who calls PyFunction_New needs to add a doc 
string assignment following the call? This is public api, so that would break 
people’s working code.

--

___
Python tracker 

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



[issue45047] Update demo files

2021-08-30 Thread Irit Katriel

Irit Katriel  added the comment:

The demos directory is described as follows:

“This directory contains a collection of demonstration scripts for
various aspects of Python programming.“

Which aspect of python programming does the rat in a maze demo cover which is 
not already covered by the existing demo scripts?

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread Georg Brandl


Change by Georg Brandl :


--
nosy: +vstinner

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2021-08-30 Thread Ruairidh MacLeod


Change by Ruairidh MacLeod :


--
nosy: +rkm

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread Georg Brandl


Change by Georg Brandl :


--
nosy: +georg.brandl

___
Python tracker 

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



[issue44919] TypedDict subtypes ignore any other metaclasses in 3.9+

2021-08-30 Thread Yurii Karabas


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


--
keywords: +patch
nosy: +uriyyo
nosy_count: 1.0 -> 2.0
pull_requests: +26501
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28057

___
Python tracker 

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



[issue45049] added cbrt() in MATH_RADIANS_METHODDEF which is missing before

2021-08-30 Thread Ayush Parikh


Change by Ayush Parikh :


--
nosy: Ayushparikh-code
priority: normal
pull_requests: 26502
severity: normal
status: open
title: added cbrt() in  MATH_RADIANS_METHODDEF which is missing before
type: enhancement

___
Python tracker 

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



[issue45047] Update demo files

2021-08-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are currently many resources in internet where you can find examples and 
demos on Python. The CPython distribution should not include every piece of 
code written by Python learner. You can publish it on GitHab, on StackOverflow, 
on more specialized resources, in your own blog, include in your book. If any 
core developer is interested in your code and wants to include it in CPython, 
they will contact you.

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



[issue45049] added cbrt() in MATH_RADIANS_METHODDEF which is missing before

2021-08-30 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

We do not need a duplicate of function declaration.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 7234e67642bc8e75f44a2e1f2ce06687b5ac72ec by Miss Islington (bot) 
in branch '3.8':
bpo-44689: ctypes.util.find_library() now finds macOS 11+ system libraries when 
built on older macOS systems (GH-27251) (GH-28054)
https://github.com/python/cpython/commit/7234e67642bc8e75f44a2e1f2ce06687b5ac72ec


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 4b55837e7c747e0f3bd2df1b5c8996ce86c6f60a by Miss Islington (bot) 
in branch '3.9':
bpo-44689: ctypes.util.find_library() now finds macOS 11+ system libraries when 
built on older macOS systems (GH-27251) (GH-28053)
https://github.com/python/cpython/commit/4b55837e7c747e0f3bd2df1b5c8996ce86c6f60a


--

___
Python tracker 

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



[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-08-30 Thread miss-islington


miss-islington  added the comment:


New changeset 41c87c41761739e90867a43de26e0f6755c80ff7 by Miss Islington (bot) 
in branch '3.10':
bpo-44689: ctypes.util.find_library() now finds macOS 11+ system libraries when 
built on older macOS systems (GH-27251)
https://github.com/python/cpython/commit/41c87c41761739e90867a43de26e0f6755c80ff7


--

___
Python tracker 

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



[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2021-08-30 Thread Mark Shannon


Change by Mark Shannon :


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



[issue45048] subprocess.run(capture_output=Bool) does the opposite of expected

2021-08-30 Thread DragonEggBedrockBreaking


DragonEggBedrockBreaking  added the comment:

Ok, thanks, I understand now.

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26503
pull_request: https://github.com/python/cpython/pull/28059

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 1f89e51fef8f4c15a719fbb3d1cec8ca7e2bc46f by Miss Islington (bot) 
in branch '3.8':
bpo-45007: Update macOS installer builds to use OpenSSL 1.1.1l (GH-28051) 
(GH-28059)
https://github.com/python/cpython/commit/1f89e51fef8f4c15a719fbb3d1cec8ca7e2bc46f


--

___
Python tracker 

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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset e6497fe698f6e87344501a68ffdea106eafcb257 by Dong-hee Na in branch 
'main':
bpo-45045: Optimize mapping patterns of structural pattern matching (GH-28043)
https://github.com/python/cpython/commit/e6497fe698f6e87344501a68ffdea106eafcb257


--

___
Python tracker 

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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

For the record,

Final benchmark with optimization build + thin LTO option.

+---+---+--+
| Benchmark | thin_lto_base | thin_lto_opt |
+===+===+==+
| bench pattern | 357 ns| 287 ns: 1.24x faster |
+---+---+--+

--

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Looks like that this happens because tests classes are decorated with 
`@hashlib_helper.requires_hashdigest('md5')`: 
https://github.com/python/cpython/blob/2a8127cafe1d196f858a3ecabf5f1df3eebf9a12/Lib/test/_test_multiprocessing.py#L4482-L4485

Tests above run fine without this decorator.
It was added in https://bugs.python.org/issue17258

The problem is that `` was treating a decorated entity as a function, not a 
class. 
https://github.com/python/cpython/blob/e6497fe698f6e87344501a68ffdea106eafcb257/Lib/test/support/hashlib_helper.py#L25
 But, it was decorating classes as well.
So, it needs to changed to respect classes.

I will make a PR shortly.

--
nosy: +sobolevn

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Wow. I hope this didn't hide any regression :-(

--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26505
pull_request: https://github.com/python/cpython/pull/28061

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington

miss-islington  added the comment:


New changeset d6cb5dd9e19210f5963ff8beadde7ca2fda71574 by Łukasz Langa in 
branch 'main':
bpo-45007: Update multissl to openssl 1.1.1l as well (GH-28044)
https://github.com/python/cpython/commit/d6cb5dd9e19210f5963ff8beadde7ca2fda71574


--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +26506
pull_request: https://github.com/python/cpython/pull/28062

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +26507
pull_request: https://github.com/python/cpython/pull/28063

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Nikita Sobolev

Nikita Sobolev  added the comment:

Looks like it did, two newly-unignored tests are failing:
https://github.com/python/cpython/pull/28060#issuecomment-908295411

пн, 30 авг. 2021 г. в 15:16, Antoine Pitrou :

>
> Antoine Pitrou  added the comment:
>
> Wow. I hope this didn't hide any regression :-(
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 8371290753bed7fbb939a51ea7ff0991ea32a89c by Christian Heimes in 
branch '3.8':
[3.8] bpo-45007: Update multissl to openssl 1.1.1l as well (GH-28044) (GH-28063)
https://github.com/python/cpython/commit/8371290753bed7fbb939a51ea7ff0991ea32a89c


--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 576803d7a8083cb25c58be08d3cb31e05d5d2f8a by Christian Heimes in 
branch '3.9':
[3.9] bpo-45007: Update multissl to openssl 1.1.1l as well (GH-28044) (GH-28062)
https://github.com/python/cpython/commit/576803d7a8083cb25c58be08d3cb31e05d5d2f8a


--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread miss-islington


miss-islington  added the comment:


New changeset dc46f4c9846ad16567ab293b405efc3ed10ab9d5 by Miss Islington (bot) 
in branch '3.10':
bpo-45007: Update multissl to openssl 1.1.1l as well (GH-28044)
https://github.com/python/cpython/commit/dc46f4c9846ad16567ab293b405efc3ed10ab9d5


--

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Nikita.

The difference between the original and the proposed in PR 28060 code is that 
in the original code the conditional was tested at the testing time, while in 
the proposed code it is tested at the loading time. I do not know what effect  
it causes on tests. If it does not matter, the code can be simpler:

   return unittest.skipIf(should_be_skipped,
  f"hash digest '{digestname}' is not available.")

But if it matters, there are two options:

1. In requires_hashdigest() raise exception if func is a class. Remove the 
decorator from classes and add it to test and setup methods or just to the 
setUpClass() classmethod.

2. In requires_hashdigest() check if func is a class, and if it is true, patch 
its test and setup methods (or just add a decorated setUpClass() classmethod).

--

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26509
pull_request: https://github.com/python/cpython/pull/28065

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 7e246a3a7b43762480ee4fe0cfb859e8e997a8c8 by Serhiy Storchaka in 
branch 'main':
bpo-41620: TestCase.run() now always return a TestResult instance (GH-28030)
https://github.com/python/cpython/commit/7e246a3a7b43762480ee4fe0cfb859e8e997a8c8


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +26508
pull_request: https://github.com/python/cpython/pull/28064

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 52bdda50d7b79e1ad7e57967850beff64c3ede92 by Łukasz Langa in 
branch '3.10':
[3.10] bpo-45007: Update to OpenSSL 1.1.1l in Windows build and CI (GH-28009) 
(GH-28039)
https://github.com/python/cpython/commit/52bdda50d7b79e1ad7e57967850beff64c3ede92


--

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Here is the implementation of the second option:

def requires_hashdigest(digestname, openssl=None, usedforsecurity=True):
def decorator(func):
if isinstance(func, type):
setUpClass = func.__dict__.get('setUpClass')
if setUpClass is None:
def setUpClass(cls):
super(func, cls).setUpClass()
setUpClass.__qualname__ = func.__qualname__ + '.setUpClass'
setUpClass.__module__ = func.__module__
else:
setUpClass = setUpClass.__func__
setUpClass = classmethod(decorator(setUpClass))
func.setUpClass = setUpClass
return func
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
if openssl and _hashlib is not None:
_hashlib.new(digestname, usedforsecurity=usedforsecurity)
else:
hashlib.new(digestname, usedforsecurity=usedforsecurity)
except ValueError:
raise unittest.SkipTest(
f"hash digest '{digestname}' is not available."
)
return func(*args, **kwargs)
return wrapper
return decorator

--

___
Python tracker 

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



[issue45007] OpenSSL 1.1.1l is released

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:

CI as well as Windows and macOS installers upgraded to use 1.1.1l all the way 
to 3.8 inclusive. Closing.

Thanks all! ✨ 🍰 ✨

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



[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fe997e1a67835a929705c8c305d41c4d7dd326e3 by Victor Stinner in 
branch '3.10':
bpo-9: faulthandler don't modify frame refcnt (GH-27850)
https://github.com/python/cpython/commit/fe997e1a67835a929705c8c305d41c4d7dd326e3


--

___
Python tracker 

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



[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

2021-08-30 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44874] Deprecate Py_TRASHCAN_SAFE_BEGIN/END

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Irit for making progress on this annoying old C API!

--
nosy: +vstinner

___
Python tracker 

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



[issue44394] [security] CVE-2013-0340 "Billion Laughs" fixed in Expat >=2.4.0: Update vendored copy to expat 2.4.1

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

I created https://python-security.readthedocs.io/vuln/expat-billion-laughs.html 
to track this vulnerability.

--

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 0c5e0aa73f6f70d16d21ad9e1eb2d0fe3a334f0a by Miss Islington (bot) 
in branch '3.9':
bpo-41620: TestCase.run() now always return a TestResult instance (GH-28030) 
(GH-28065)
https://github.com/python/cpython/commit/0c5e0aa73f6f70d16d21ad9e1eb2d0fe3a334f0a


--

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread miss-islington


miss-islington  added the comment:


New changeset 243b8de0b15061704581974c0a27db1232a43b93 by Miss Islington (bot) 
in branch '3.10':
bpo-41620: TestCase.run() now always return a TestResult instance (GH-28030)
https://github.com/python/cpython/commit/243b8de0b15061704581974c0a27db1232a43b93


--

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for the report and initial patch, Iman! ✨ 🍰 ✨  

And thanks Serhiy for pushing this across the finish line.

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Serhiy, yes, you are right. I guess, it is safe to assume that 
load-time/test-time might make a difference, especially with `_hashlib`.

I've commited your suggestion, thanks a lot for your help!

--

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2021-08-30 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +26511
pull_request: https://github.com/python/cpython/pull/28067

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2021-08-30 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

2021-08-30 Thread miss-islington


miss-islington  added the comment:


New changeset 720aef48b558e68c07937f0cc8d62a60f23dcb3d by Miss Islington (bot) 
in branch '3.9':
bpo-9: faulthandler don't modify frame refcnt (GH-27850)
https://github.com/python/cpython/commit/720aef48b558e68c07937f0cc8d62a60f23dcb3d


--

___
Python tracker 

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



[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

The bug should now be fixed in 3.9 and 3.10 branches.

The main branch should not be impacted, it has a different implementation.

Thanks for the bug report Duncan Grisby.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10

___
Python tracker 

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



[issue45021] Race condition in thread.py

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

I don't understand anything about multiprocessing, nor its API, but some people 
seem to find it useful :-D I remove myself from the nosy list ;-)

--

___
Python tracker 

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



[issue45021] Race condition in thread.py

2021-08-30 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread Irit Katriel


Change by Irit Katriel :


--
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

The following command still fails on the Python main branch on Linux:
---
$ env -i =value ./python -c 'import pprint, os; pprint.pprint(os.environ); del 
os.environ[""]'
environ({'': 'value', 'LC_CTYPE': 'C.UTF-8'})
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/vstinner/python/main/Lib/os.py", line 689, in __delitem__
unsetenv(encodedkey)

OSError: [Errno 22] Invalid argument
---

'del os.environ[""]' calls unsetenv("") which fails with EINVAL.

Python is a thin wrapper to C functions setenv() and unsetenv(), and raises an 
exception when a C function fails. It works as expected.

Python exposes the variable with an empty name which is found in the 
environment variables: again, it works as expected.

I don't see how Python could do better, since the glibc unsetenv() fails with 
EINVAL if the string is empty. It is even a documented behaviour, see the 
unsetenv() manual page:
---
ERRORS

   EINVAL name is NULL, points to a string of length 0, or contains an '=' 
character.
---

--

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

By the way:
---
The env command from GNU coreutils supports setting the environment variable 
with an empty name but not unsetting it. That's a bug.

$ env '=wibble' env |grep wibble 
=wibble
$ env '=wibble' env -u '' env
env: cannot unset `': Invalid argument
---

https://unix.stackexchange.com/questions/178522/unsetting-environment-variable-with-an-empty-name

--

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread Irit Katriel


Irit Katriel  added the comment:

I see, so intercepting the assignment is not enough. Reopening.

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

___
Python tracker 

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



[issue45042] Many multiprocessing tests are silently skipped since 3.9

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:

FYI, there seem to be two Windows-specific regressions since the tests were 
unintentionally disabled, namely test_shared_memory_basics and 
test_checksum_fodder.

Following Serhiy's advice, I elect to have those tests skipped for now on 
Windows and fix them through separate issues. We will be releasing 3.9.7 
according to schedule today.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

Attached set_unset_env.c program calls putenv("=hello world") and then 
unsetenv("").

On my Fedora 34 with glibc-2.33-20.fc34.x86_64, putenv() succeed, but 
unsetenv() fails.
---
$ gcc set_unset_env.c -g -o set_unset_env && ./set_unset_env
putenv("=hello world") -> hello world
ERROR: unsetenv("") failed: [error 22] Invalid argument
---

By the way, getenv() fails to find an environment variable if its name is 
empty: I reimplemented getenv() using the 'environ' variable for my test.

--
Added file: https://bugs.python.org/file50245/set_unset_env.c

___
Python tracker 

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



[issue17120] Mishandled _POSIX_C_SOURCE and _XOPEN_SOURCE in pyconfig.h

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

On my Fedora 34, running ./configure creates pyconfig.h with these values:

$ grep -E '_POSIX_C_SOURCE|_XOPEN_SOURCE' -B1 pyconfig.h
/* Define to activate features from IEEE Stds 1003.1-2008 */
#define _POSIX_C_SOURCE 200809L
--
/* Define to the level of X/Open that your system supports */
#define _XOPEN_SOURCE 700
--
/* Define to activate Unix95-and-earlier features */
#define _XOPEN_SOURCE_EXTENDED 1


Relevant lines in configure.ac:
---
if test $define_xopen_source = yes
then
  # X/Open 7, incorporating POSIX.1-2008
  AC_DEFINE(_XOPEN_SOURCE, 700,
Define to the level of X/Open that your system supports)

  # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
  # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
  # several APIs are not declared. Since this is also needed in some
  # cases for HP-UX, we define it globally.
  AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
Define to activate Unix95-and-earlier features)

  AC_DEFINE(_POSIX_C_SOURCE, 200809L, Define to activate features from IEEE 
Stds 1003.1-2008)
fi
---

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> At least the PyASCIIObject struct in Include/cpython/unicodeobject.h uses bit 
> fields. Various preprocessor macros like PyUnicode_IS_ASCII() and 
> PyUnicode_KIND() access this struct's bit field.

What is your use case? Which functions do you need?

You should not access directly the PyASCIIObject structure. Python provides 
many functions to access the content of a Unicode string object.

--

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

For the very specific case of os.environ.clear(), the C function clearenv() 
could be used if available.

While clearenv() is available in the glibc, it's not a POSIX function.

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread Petr Viktorin


Petr Viktorin  added the comment:

The macro PyUnicode_KIND is part of the documented public C API. It accesses 
the bit field "state.kind" directly.

--

___
Python tracker 

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



[issue14088] sys.executable generating canonical path

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

test_sys:

def test_executable(self):
# sys.executable should be absolute
self.assertEqual(os.path.abspath(sys.executable), sys.executable)

IMO the test is wrong. It must test: 
test.assertTrue(os.path.isabs(sys.executable)).

The path is not required to be normalized.

--

___
Python tracker 

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



[issue14088] sys.executable generating canonical path

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> The path is not required to be normalized.

I'm talking about the current implementation.

I'm not against making Python even better: attempt to normalize the path ;-)

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> The macro PyUnicode_KIND is part of the documented public C API.

IMO it was a mistake to expose it as part of the public C API. This is an 
implementation detail which should not be exposed. The C API should not expose 
*directly* how characters are stored in memory, but provide an abstract way to 
read and write Unicode characters.

The PEP 393 implementation broke the old C API in many ways because it exposed 
too many implementation details. Sadly, the new C API is... not better :-(

If tomorrow, CPython is modified to use UTF-8 internally (as PyPy does), the C 
API will likely be broken *again* in many (new funny) ways.

11 years after the PEP 393 (Python 3.3), we only start fixing the old C API :-( 
The work will be completed in 2 or 3 Python releases (Python 3.12 or 3.13):

* https://www.python.org/dev/peps/pep-0623/
* https://www.python.org/dev/peps/pep-0624/

The C API for Unicode strings is causing a lot of issues in PyPy which uses 
UTF-8 internally. C extensions can fail to build on PyPy if they use functions 
(macros) like PyUnicode_KIND().

--
nosy: +methane, serhiy.storchaka

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-08-30 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +26512
pull_request: https://github.com/python/cpython/pull/28068

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> In order to avoid undefined behavior, Python's C API should avoid all use of 
> bit fields.

See also the PEP 620. IMO more generally, the C API should not expose 
structures, but provide ways to access it through getter and setter functions.

See bpo-40120 "Undefined C behavior going beyond end of struct via a [1] 
arrays" which is a similar issue.

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread Petr Viktorin


Petr Viktorin  added the comment:

PyUnicode_KIND does *not* expose the implementation details to the programmer.

If the internal representation os strings is switched to use masks and shifts 
instead of bitfields, PyUnicode_KIND (and others) can be adapted to the new 
details without breaking API compatibility.
And that switch would fix this issue.

--

___
Python tracker 

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



[issue25867] os.stat raises exception when using unicode and no locale is set

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> It's doing this now, so seems like it has been fixed: % env -i ./python.exe 
> (...)

Right. It's correct to close the issue.

The PEP 540 added a UTF-8 Mode. This mode is enabled if Python is started with 
the "C" or "POSIX" locale (LC_CTYPE category). If the UTF-8 Mode is enabled, 
Python uses UTF-8 for its "filesystem" encoding:

* https://docs.python.org/dev/library/os.html#python-utf-8-mode
* 
https://docs.python.org/dev/glossary.html#term-filesystem-encoding-and-error-handler

Moreover, the PEP 538 also tries to use a UTF-8 variable of "C" and "POSIX" 
locales, which also fix this issue.

I documented how Python configures its "filesystem encoding" at:
https://docs.python.org/dev/c-api/init_config.html#c.PyConfig.filesystem_encoding

--

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> PyUnicode_KIND does *not* expose the implementation details to the programmer.

PyUnicode_KIND() is very specific to the exact PEP 393 implementation. 
Documentation of this field:
---
/* Character size:

   - PyUnicode_WCHAR_KIND (0):

 * character type = wchar_t (16 or 32 bits, depending on the
   platform)

   - PyUnicode_1BYTE_KIND (1):

 * character type = Py_UCS1 (8 bits, unsigned)
 * all characters are in the range U+-U+00FF (latin1)
 * if ascii is set, all characters are in the range U+-U+007F
   (ASCII), otherwise at least one character is in the range
   U+0080-U+00FF

   - PyUnicode_2BYTE_KIND (2):

 * character type = Py_UCS2 (16 bits, unsigned)
 * all characters are in the range U+-U+ (BMP)
 * at least one character is in the range U+0100-U+

   - PyUnicode_4BYTE_KIND (4):

 * character type = Py_UCS4 (32 bits, unsigned)
 * all characters are in the range U+-U+10
 * at least one character is in the range U+1-U+10
 */
unsigned int kind:3;
---

I don't think that PyUnicode_KIND() makes sense if CPython uses UTF-8 tomorrow.


> If the internal representation os strings is switched to use masks and shifts 
> instead of bitfields, PyUnicode_KIND (and others) can be adapted to the new 
> details without breaking API compatibility.

PyUnicode_KIND() was exposed in the *public* C API because unicodeobject.h 
provides functions as macros for best performances, and these macros use 
PyUnicode_KIND() internally.

Macros like PyUnicode_READ(kind, data, index) are also designed for best 
performances with the exact PEP 393 implementation.

The public C API should only contain PyUnicode_READ_CHAR(unicode, index): this 
macro doesn't use "kind" or "data" which are (again) specific to the PEP 393.

In the CPython implementation, we should use the most efficient code, it's fine 
to use macros accessing directly structures.

But for the public C API, I would recommend to only provide abstractions, even 
if there are a little bit slower.

--

___
Python tracker 

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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Brandt Bucher


Brandt Bucher  added the comment:

Thanks, this is awesome.

FYI, there's probably more low-hanging fruit like this scattered about the 
pattern matching implementation. It's all very new code, mostly written by one 
person ;).

(I wouldn't worry too much about the pattern compiler, though... I'm currently 
finishing up a total rewrite of that!)

--

___
Python tracker 

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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Brandt Bucher


Brandt Bucher  added the comment:

I'm also in the process of creating some pattern matching benchmarks. You might 
find them useful for benching optimizations like this in the future:

https://github.com/brandtbucher/patmaperformance

In particular, I'm curious to see the impact of this change on "patma_holdem". 
I bet it's quite good.

--

___
Python tracker 

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



[issue44019] operator.call/operator.__call__

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2.7 had apply(func, args, kwargs) which called func(*args, **kwargs).
https://docs.python.org/2.7/library/functions.html#apply

There is also functools.partial(func, *args, **kwargs)(*args2, **kwargs2) which 
calls func(*args, *args2, **kwargs, **kwargs2).
https://docs.python.org/dev/library/functools.html#functools.partial

operator.methodcaller(name, /, *args, **kwargs)(obj) calls getattr(obj, 
name)(*args, **kwargs).
https://docs.python.org/dev/library/operator.html#operator.methodcaller

I'm not convinced that operator.caller() would be useful to me. Why do you 
consider that it belongs to the stdlib? It is a common pattern? Did you see in 
this pattern in the current stdlib?

Can't you easily implement such helper function in a few lines of Python?

operator documentation says: "The operator module exports a set of efficient 
functions corresponding to the intrinsic operators of Python". I don't see how 
operator.caller() implements an existing "intrinsic operators of Python".

methodcaller() can be implemented in 4 lines of Python, as shown in its 
documentation:
---
def methodcaller(name, /, *args, **kwargs):
def caller(obj):
return getattr(obj, name)(*args, **kwargs)
return caller
---

--
nosy: +brett.cannon, rhettinger

___
Python tracker 

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



[issue44019] operator.call/operator.__call__

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

> An actual use case I had for such an operator was collecting a bunch of 
> callables in a list and wanting to dispatch them to 
> concurrent.futures.Executor.map, i.e. something like 
> `executor.map(operator.call, funcs)` (to get the parallelized version of 
> `[func() for func in funcs]`).

Can't you use functools.partial() for that?

--

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-08-30 Thread Eric Snow


Eric Snow  added the comment:

On Fri, Aug 27, 2021 at 6:29 PM Guido van Rossum  wrote:
> The plot thickens. By searching my extensive GMail archives for Jeethu Rao I 
> found
> an email from Sept. 14 to python-dev by Larry Hastings titled "Store startup 
> modules
> as C structures for 20%+ startup speed improvement?"

Thanks for finding that, Guido!

On Fri, Aug 27, 2021 at 6:37 PM Guido van Rossum  wrote:
> Either way it's a suboptimal experience for people contributing to those 
> modules. But
> we stand to gain a ~20% startup time improvement.

Agreed, and I think a solution shouldn't be too hard to reach.

On Fri, Aug 27, 2021 at 7:48 PM Larry Hastings  wrote:
> In experimenting with the prototype, I observed that simply calling stat() to 
> ensure
> the frozen .py file hadn't changed on disk lost us about half the performance 
> win
> from this approach.

Yeah, this is an approach others had suggested and I'd considered.  We
have other solutions available that don't have that penalty.

On Fri, Aug 27, 2021 at 8:08 PM Larry Hastings  wrote:
> There should be a boolean flag that enables/disables cached copies of .py 
> files from
> Lib/.  You should be able to turn it off with either an environment variable 
> or a
> command-line option, and when it's off it skips all the internal cached stuff 
> and
> uses the normal .py / .pyc machinery.
>
> With that in place, it'd be great to pre-cache all the .py files 
> automatically read in
> at startup.

Yeah, something along these lines should be good enough.

> [snip]
> But then I'm not sure this is a very good analogy--the workflow for making 
> Clinic
> changes is very different from people hacking on Lib/*.py.

Agreed.

On Fri, Aug 27, 2021 at 10:06 PM Guido van Rossum
 wrote:
> [snip]
> FWIW in my attempts to time this, it looks like the perf benefits of Eric's 
> approach are
> close to those of deep-freezing. And deep-freezing causes much more bloat of 
> the
> source code and of the resulting binary.

The question of freeze vs deep-freeze (i.e. is deep-freeze better
enough) is one we can discuss separately, and your point here is
probably the fundamental center of that discussion.  However, I don't
think it has a lot of bearing on the change proposed in this issue.

> [snip]
> I think the only solution here was hinted at in the python-dev thread from 
> 2018: have
> a command-line flag to turn it on or off (e.g. -X deepfreeze=1/0) and have a 
> policy for
> what the default for that flag should be (e.g. on by default in production 
> builds, off by
> default in developer builds -- anything that doesn't use 
> --enable-optimizations).

Agreed.

> [snip]
> it wasn't so clear that code objects should be immutable -- that realization 
> came later,
> when Greg Stein proposed making them ROM-able. That didn't work out, but the
> notion that code objects should be strictly mutable (to the python user, at 
> least)
> was born

This sounds like an interesting story.  Do you have any mailing list
links handy?  (Otherwise I can search the archives.)

> In fact, Eric's approach freezes everything in the encodings package, which 
> turns out
> to be a lot of files and a lot of code (lots of simple data tables expressed 
> in code), and
> I found that for basic startup time, it's best not to deep-freeze the 
> encodings module
> except for __init__.py, aliases.py and utf_8.py.

Yeah, this is something to consider.  FWIW, in my testing, dropping
encodings.* from the
list of frozen modules reduced the performance gains (from 20 ms to 21 ms).

-eric

--

___
Python tracker 

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



[issue45045] Optimize mapping patterns of structural pattern matching

2021-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

> https://github.com/brandtbucher/patmaperformance

Nice benchmark suite, I will take a look :)

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-30 Thread STINNER Victor


STINNER Victor  added the comment:

Is it related to https://bugs.python.org/issue41034 ?

--
nosy: +vstinner

___
Python tracker 

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



[issue45050] created unittest file analyze_text.py

2021-08-30 Thread Ayush Parikh


Change by Ayush Parikh :


--
nosy: Ayushparikh-code
priority: normal
pull_requests: 26513
severity: normal
status: open
title: created unittest file analyze_text.py
type: enhancement

___
Python tracker 

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



[issue45050] created unittest file analyze_text.py

2021-08-30 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

It is unneeded.

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 08d9e597c8ef5a2b26375ac954fdf224f5d82c3c by Serhiy Storchaka in 
branch 'main':
bpo-43913: Fix bugs in cleaning up classes and modules in unittest. (GH-28006)
https://github.com/python/cpython/commit/08d9e597c8ef5a2b26375ac954fdf224f5d82c3c


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +26514
pull_request: https://github.com/python/cpython/pull/28070

___
Python tracker 

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +26515
pull_request: https://github.com/python/cpython/pull/28071

___
Python tracker 

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-30 Thread Gregory Szorc


Gregory Szorc  added the comment:

My use case for these low-level APIs is to write tests for low-level 
string/encoding handling in my custom use of the PyPreConfig and PyConfig 
structs. I wanted to verify that exact byte sequences were turned into specific 
representations inside of Python strings. This includes ensuring that certain 
byte sequences retain their appropriate "character" width in internal storage.

I know there are alternative ways of performing this testing. But testing 
against the actual data structure used internally by CPython seemed the most 
precise since it isolates problems to the "store in Python" side of the problem 
and not "what does Python do once the data is stored."

--

___
Python tracker 

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



[issue45051] wrote optimised async_test.py for async lib

2021-08-30 Thread Ayush Parikh


Change by Ayush Parikh :


--
nosy: Ayushparikh-code
priority: normal
pull_requests: 26516
severity: normal
status: open
title: wrote optimised async_test.py for async lib
type: enhancement

___
Python tracker 

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



[issue45051] wrote optimised async_test.py for async lib

2021-08-30 Thread Zachary Ware


New submission from Zachary Ware :

Ayush, your PRs are starting to look like spam.  Please slow down and ask for 
advice on what contributions would be welcome.  We have several resources 
available for this, such as the core-mentors...@python.org mailing list, the 
discuss.python.org discussion forum, not to mention the devguide which even 
includes a more complete list of places to get help: 
https://devguide.python.org/help/

I'm closing this PR and issue; please hold off on submitting more until you 
have followed the above advice.

--
nosy: +zach.ware
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



[issue45020] Freeze all modules imported during startup.

2021-08-30 Thread Eric Snow


Eric Snow  added the comment:

On Fri, Aug 27, 2021 at 11:14 PM Larry Hastings  wrote:
> [snip] On the other hand: if we made a viable tool that could consume some 
> arbitrary
> set of .py files and produce a C file, and said C file could then be compiled 
> into a
> shared library, end users could enjoy this speedup over the subset of the 
> standard
> library their program used, and perhaps even their own source tree(s).

Yeah, that would be interesting to investigate.

On Sat, Aug 28, 2021 at 5:17 AM Marc-Andre Lemburg
 wrote:
> Eric's approach, as I understand it, is pretty much what PyRun does.
> [further details]

It's reassuring to hear that the approach is known to be viable. :)

> In fact, you save quite a bit of disk space compared to a full Python 
> installation and
> additionally benefit from the memory mapping the OS does for sharing access 
> to the
> marshal'ed byte code between processes.

That's a good point.

> That said, some things don't work with such an approach, e.g. a few packages
> include additional data files which they expect to find on disk. Since those 
> are
> not available anymore, they fail.
>
> For PyRun I have patched some of those packages to include the data in form of
> Python modules instead, so that it gets frozen as well, e.g. the Python 
> grammar files.

For stdlib modules it wouldn't be a big problem to set __file__ on
frozen modules.
Would that be enough to solve the problem?

On Sat, Aug 28, 2021 at 5:41 PM Gregory Szorc  wrote:
> When I investigated freezing the standard library for PyOxidizer, I ran into 
> a rash
> of problems. The frozen importer doesn't behave like PathFinder. It doesn't
> (didn't?) set some common module-level attributes

This is mostly fixable for stdlib modules.  Which attributes would
need to be added?  Are there other missing behaviors?

> Also, when I last looked at the CPython source, the frozen importer performed
> a linear scan of its indexed C array performing strcmp() on each entry until 
> it
> found what it was looking for. So adding hundreds of modules could result in
> sufficient overhead and justify using a more efficient lookup algorithm.
> (PyOxidizer uses Rust's HashMap to index modules by name.)

Yeah, we noticed this too.  I wasn't sure it was something to worry
about at first because we're not freezing the entire stdlib.  We're
freezing on the order of 10, plus all the (80+) encoding modules.  I
figured we could look at an alternative to that linear search
afterward if it made sense.

> * Make sure you run unit tests against the frozen modules. If you don't do 
> this, subtle differences in how the different importers behave will lead to 
> problems.

We'll do what we already do with importlib: run the tests against both
the frozen and the source modules.  Thanks for the reminder to do this
though!

On Sat, Aug 28, 2021 at 5:53 PM Gregory Szorc  wrote:
> Oh, PyOxidizer also ran into more general issues with the frozen importer in 
> that
> it broke various importlib APIs. e.g. because the frozen importer only 
> supports
> bytecode, you can't use .__loader__.get_source() to obtain the source of a 
> module.
> This makes tracebacks more opaque and breaks legitimate API consumers relying
> on these importlib interfaces.

Good point.  Supporting more of the FileLoader API on the frozen
loader is something to look into, at least for stdlib modules.

> The fundamental limitations with the frozen importer are why I implemented my
> own meta path importer (implemented in pure Rust), which is more fully 
> featured,
> like the PathFinder importer that most people rely on today. That importer is
> available on PyPI (https://pypi.org/project/oxidized-importer/) and has its 
> own API
> to facilitate PyOxidizer-like functionality
> (https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer.html) if anyone
> wants to experiment with it.

Awesome!  I'll take a look.

On Sat, Aug 28, 2021 at 6:14 PM Guido van Rossum  wrote:
> I agree that we should shore up the frozen importer -- probably in a separate 
> PR though.
> (@Eric: do you think this is worth its own bpo issue?)

Yeah.

-eric

--

___
Python tracker 

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 9827710a400848c9430ed364ed5d2d54f0926701 by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-43913: Fix bugs in cleaning up classes and modules in unittest. 
(GH-28006) (GH-28071)
https://github.com/python/cpython/commit/9827710a400848c9430ed364ed5d2d54f0926701


--

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-08-30 Thread Eric Snow


Eric Snow  added the comment:

At this point, here are the open questions I'm seeing:

+ The editing-stdlib-.py-files problem:
   * use a command-line flag to opt-out of frozen modules?
   * use a build flag to opt out (e.g. a configure flag or a new Py_NO_FROZEN 
or even Py_DEBUG)?
   * ignore frozen modules if it's a dev build?
   * (note: importlib._bootstrap and importlib._bootstrap_external must always 
be frozen, regardless of a flag)
   * accommodate users of an installed Python that sometimes edit stdlib 
modules while debugging code?
   * always emit a warning if a frozen module is ignored (in favor of the 
source module)?

+ Compatibility:
   * set __file__ (and __path__) on frozen modules?
   * store the hash of the source file for frozen modules (in the frozen .h 
files)?
   * support more of the FileLoader API on the frozen loader?

+ Penalty for too many frozen modules:
   * should we only freeze the UTF-8 encoding?
   * should we use something other than linear search for looking up frozen 
modules?

FWIW, I think the ideal mechanism for a dev build will be to opt in to using 
frozen modules (instead of the source modules).  Otherwise it is too easy for 
the unaware contributor to waste substantial time figuring out why their 
changes are not getting used.

Consequently, here's my order of preference for ignoring frozen modules:

1. use Py_DEBUG as an opt-out flag
   (if we think contributors are editing stdlib modules on a build without 
Py_DEBUG then that isn't good enough)
2. automatically skip frozen modules if it's a dev build, with an explicit 
configure flag to opt in to frozen modules

--

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-08-30 Thread Eric Snow


Eric Snow  added the comment:

> * tricks to inject hooks ASAP (e.g. coverage.py swaps the encodings module) 
> may lose their entry point

FWIW, I asked Ned Batchelder about this and he said this approach 
("fullcoverage" [1]) was added to support running coverage on the stdlib.  It 
doesn't affect other users of coverage.py.  He didn't have any info on where 
this is used currently, though I'm pretty sure we do run coverage in CI.  
Furthermore, the devguide talks about running coverage.py on the stdlib and 
initially indicates that modules imported during startup are not covered. [2]  
However, it does have a section talking about using "fullcoverage" to cover 
startup modules.

I expect that any solution we make for contributors editing stdlib source files 
will resolve the potential issue for coverage.py.


[1] https://github.com/nedbat/coveragepy/tree/master/coverage/fullcoverage
[2] https://devguide.python.org/coverage/?highlight=coverage#measuring-coverage
[3] 
https://devguide.python.org/coverage/?highlight=coverage#coverage-results-for-modules-imported-early-on

--

___
Python tracker 

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



[issue44019] operator.call/operator.__call__

2021-08-30 Thread Antony Lee


Antony Lee  added the comment:

> I'm not convinced that operator.caller() would be useful to me.

To be clear, as noted above, I have realized that the semantics I initially 
proposed (now known as "caller") are not particularly useful; the semantics I 
am proposing (and implementing in the linked PR) are `call(f, *args, **kwargs) 
== f(*args, **kwargs)`.

> I don't see how operator.caller() implements an existing "intrinsic operators 
> of Python".

Agreed; on the other hand function calling is much more intrinsic(?!)

> Can't you use functools.partial() for that?

How do you propose to do that?  Perhaps I am missing an easy solution...

--

___
Python tracker 

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread miss-islington


miss-islington  added the comment:


New changeset d65fad04fad1a73b6bb17bcb08ca6f0a24376952 by Miss Islington (bot) 
in branch '3.10':
bpo-43913: Fix bugs in cleaning up classes and modules in unittest. (GH-28006)
https://github.com/python/cpython/commit/d65fad04fad1a73b6bb17bcb08ca6f0a24376952


--

___
Python tracker 

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



[issue43398] [sqlite3] sqlite3.connect() segfaults if given a faulty Connection factory

2021-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f62763d26755260c31c717fb396550e00eb6b2a0 by Erlend Egeberg 
Aasland in branch 'main':
bpo-43398: Add test for defect connection factories (GH-27966)
https://github.com/python/cpython/commit/f62763d26755260c31c717fb396550e00eb6b2a0


--
nosy: +pablogsal
status: pending -> open

___
Python tracker 

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



[issue43398] [sqlite3] sqlite3.connect() segfaults if given a faulty Connection factory

2021-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Is something missing here?

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-08-30 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for the fix, Serhiy, and Ryan for reporting the problem! ✨ 🍰 ✨

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



[issue44895] refleak test failure in test_exceptions

2021-08-30 Thread Irit Katriel


Irit Katriel  added the comment:

I think the leak happens when we invoke GC while the recursion limit is 
exceeded. It goes way if make this change:


def recurse_in_body_and_except():
try:
recurse_in_body_and_except()
except RecursionError as e:
gc.disable()
recurse_in_body_and_except()
gc.enable()


I also added a __del__ to B and saw it being called when recursion limit is 
small (though adding the __del__ makes the leak go away. Actually just adding 
"def f(): pass" is enough to make it go away).

--

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-08-30 Thread Nikita Sobolev


New submission from Nikita Sobolev :

While working on https://github.com/python/cpython/pull/28060 we've noticed 
that 
`test.test_multiprocessing_spawn.WithProcessesTestSharedMemory.test_shared_memory_basics`
 fails on Windows:

```
==
FAIL: test_shared_memory_basics 
(test.test_multiprocessing_spawn.WithProcessesTestSharedMemory)
--
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\test\_test_multiprocessing.py", line 3794, in 
test_shared_memory_basics
self.assertEqual(sms.size, sms2.size)
^
AssertionError: 512 != 4096
```

For now it is ignored.

Related issue: https://bugs.python.org/issue45042

--
components: Tests
messages: 400646
nosy: sobolevn
priority: normal
severity: normal
status: open
title: WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-08-30 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

I would like to work on this issue.

--

___
Python tracker 

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



[issue45053] MD5SumTests.test_checksum_fodder fails on Windows

2021-08-30 Thread Nikita Sobolev


New submission from Nikita Sobolev :

While working on https://github.com/python/cpython/pull/28060 we've noticed 
that `test.test_tools.test_md5sum.MD5SumTests.test_checksum_fodder` fails on 
Windows:

```
==
FAIL: test_checksum_fodder (test.test_tools.test_md5sum.MD5SumTests)
--
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\test\test_tools\test_md5sum.py", line 41, in 
test_checksum_fodder
self.assertIn(part.encode(), out)
^
AssertionError: b'@test_1772_tmp\xc3\xa6' not found in 
b'd38dae2eb1ab346a292ef6850f9e1a0d @test_1772_tmp\xe6\\md5sum.fodder\r\n'
```

For now it is ignored.

Related issue: https://bugs.python.org/issue45042

--
components: Tests
messages: 400648
nosy: sobolevn
priority: normal
severity: normal
status: open
title: MD5SumTests.test_checksum_fodder fails on Windows
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



  1   2   >