]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-100220: Fix error handling in make rules (GH-100328)
Michał Górny [Fri, 7 Apr 2023 18:23:59 +0000 (18:23 +0000)] 
gh-100220: Fix error handling in make rules (GH-100328)

Set `SHELL = /bin/sh -e` to ensure that complex recipes fail on the first error rather than incorrectly reporting success.

Co-authored-by: Zachary Ware <zach@python.org>
2 years agogh-103225: Fixed zero lineno issue for pdb (#103265)
Tian Gao [Fri, 7 Apr 2023 17:57:46 +0000 (10:57 -0700)] 
gh-103225: Fixed zero lineno issue for pdb (#103265)

Co-authored-by: Artem Mukhin <ortem00@gmail.com>
2 years agogh-74690: Add more tests for runtime-checkable protocols (#103347)
Alex Waygood [Fri, 7 Apr 2023 17:21:19 +0000 (18:21 +0100)] 
gh-74690: Add more tests for runtime-checkable protocols (#103347)

2 years agogh-103193: Celebrate performance improvements to `inspect.getattr_static` in 'What...
Alex Waygood [Fri, 7 Apr 2023 17:14:50 +0000 (18:14 +0100)] 
gh-103193: Celebrate performance improvements to `inspect.getattr_static` in 'What's New in Python 3.12' (#103349)

2 years agoGH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-102813)
AN Long [Fri, 7 Apr 2023 11:56:00 +0000 (19:56 +0800)] 
GH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-102813)

2 years agobpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895)
Nikita Sobolev [Fri, 7 Apr 2023 10:43:41 +0000 (13:43 +0300)] 
bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-102213: Revert "gh-102213: Optimize the performance of `__getattr__` (GH-102248...
Nikita Sobolev [Fri, 7 Apr 2023 09:22:36 +0000 (12:22 +0300)] 
gh-102213: Revert "gh-102213: Optimize the performance of `__getattr__`  (GH-102248)" (GH-103332)

This reverts commit aa0a73d1bc53dcb6348a869df1e775138991e561.

2 years agogh-103256: Fix hmac algorithm to support fallback implementation (gh-103286)
Dong-hee Na [Fri, 7 Apr 2023 01:51:29 +0000 (10:51 +0900)] 
gh-103256: Fix hmac algorithm to support fallback implementation (gh-103286)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-103266: Fix a typo in example code for bisect() function (#103267)
Oleg Iarygin [Fri, 7 Apr 2023 00:34:19 +0000 (04:34 +0400)] 
gh-103266: Fix a typo in example code for bisect() function (#103267)

2 years agogh-93121: fix test_mailbox where some test cases were accidentally dropped (#93242)
AGZain [Thu, 6 Apr 2023 22:19:11 +0000 (18:19 -0400)] 
gh-93121: fix test_mailbox where some test cases were accidentally dropped (#93242)

2 years agoGH-102700: allow built-in modules to be submodules (GH-103162)
Brett Cannon [Thu, 6 Apr 2023 21:19:54 +0000 (14:19 -0700)] 
GH-102700: allow built-in modules to be submodules (GH-103162)

2 years agogh-103193: Speedup and inline `inspect._is_type` (#103321)
Alex Waygood [Thu, 6 Apr 2023 20:49:24 +0000 (21:49 +0100)] 
gh-103193: Speedup and inline `inspect._is_type` (#103321)

Improve performance of `inspect.getattr_static`

2 years agogh-103193: Use LBYL idioms rather than EAFP in `inspect.getattr_static` (#103318)
Alex Waygood [Thu, 6 Apr 2023 19:17:53 +0000 (20:17 +0100)] 
gh-103193: Use LBYL idioms rather than EAFP in `inspect.getattr_static` (#103318)

2 years agogh-103186: assert in tests that UnsafeMailcapInput warnings are provided (#103217)
Ijtaba Hussain [Thu, 6 Apr 2023 18:13:33 +0000 (23:13 +0500)] 
gh-103186: assert in tests that UnsafeMailcapInput warnings are provided (#103217)

2 years agogh-100227: Use an Array for _PyRuntime's Set of Locks During Init (gh-103315)
Eric Snow [Thu, 6 Apr 2023 18:00:49 +0000 (12:00 -0600)] 
gh-100227: Use an Array for _PyRuntime's Set of Locks During Init (gh-103315)

This cleans things up a bit and simplifies adding new granular global locks.

2 years agogh-99202: Fix extension type from documentation for compiling in C++20 mode (#102518)
Jeffrey Newman [Thu, 6 Apr 2023 15:59:36 +0000 (10:59 -0500)] 
gh-99202: Fix extension type from documentation for compiling in C++20 mode  (#102518)

2 years agogh-48330: assert warning is emitted on unittest.TestResult with no addDuration (...
Irit Katriel [Thu, 6 Apr 2023 13:05:23 +0000 (14:05 +0100)] 
gh-48330: assert warning is emitted on unittest.TestResult with no addDuration (#103309)

2 years agogh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293)
Irit Katriel [Thu, 6 Apr 2023 10:08:25 +0000 (11:08 +0100)] 
gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293)

2 years ago[Enum] unchain exception property.__get__ (GH-103305)
Ethan Furman [Thu, 6 Apr 2023 04:30:11 +0000 (21:30 -0700)] 
[Enum] unchain exception property.__get__ (GH-103305)

2 years agogh-103207: Fix Welcome formatting issues when macOS Installer is run in dark mode...
Ned Deily [Thu, 6 Apr 2023 03:42:14 +0000 (23:42 -0400)] 
gh-103207: Fix Welcome formatting issues when macOS Installer is run in dark mode. (GH-103303)

2 years agogh-101659: Add _Py_AtExit() (gh-103298)
Eric Snow [Thu, 6 Apr 2023 00:42:02 +0000 (18:42 -0600)] 
gh-101659: Add _Py_AtExit() (gh-103298)

The function is like Py_AtExit() but for a single interpreter.  This is a companion to the atexit module's register() function, taking a C callback instead of a Python one.

We also update the _xxinterpchannels module to use _Py_AtExit(), which is the motivating case.  (This is inspired by pain points felt while working on gh-101660.)

2 years agogh-93910: [Enum] remove member.member deprecation (GH-103236)
Ethan Furman [Thu, 6 Apr 2023 00:33:52 +0000 (17:33 -0700)] 
gh-93910: [Enum] remove member.member deprecation (GH-103236)

i.e. Color.RED.BLUE is now officially supported.

2 years agoGH-88691: Shrink the CALL caches (GH-103230)
Brandt Bucher [Wed, 5 Apr 2023 21:15:49 +0000 (14:15 -0700)] 
GH-88691: Shrink the CALL caches (GH-103230)

2 years agogh-101659: Use the Raw Allocator in the _xxinterpchannels Module (gh-103287)
Eric Snow [Wed, 5 Apr 2023 21:13:12 +0000 (15:13 -0600)] 
gh-101659: Use the Raw Allocator in the _xxinterpchannels Module (gh-103287)

Using the raw allocator for any of the global state makes sense, especially as we move to a per-interpreter obmalloc state (gh-101660).

2 years agogh-74690: Further optimise `typing._ProtocolMeta.__instancecheck__` (#103280)
Alex Waygood [Wed, 5 Apr 2023 16:37:36 +0000 (17:37 +0100)] 
gh-74690: Further optimise `typing._ProtocolMeta.__instancecheck__` (#103280)

2 years agogh-99069: Consolidate checks for static_assert (#94766)
Joshua Root [Wed, 5 Apr 2023 15:09:19 +0000 (01:09 +1000)] 
gh-99069: Consolidate checks for static_assert (#94766)

Several platforms don't define the static_assert macro despite having
compiler support for the _Static_assert keyword. The macro needs to be
defined since it is used unconditionally in the Python code. So it
should always be safe to define it if undefined and not in C++11 (or
later) mode.

Hence, remove the checks for particular platforms or libc versions,
and just define static_assert anytime it needs to be defined but isn't.
That way, all platforms that need the fix will get it, regardless of
whether someone specifically thought of them.

Also document that certain macOS versions are among the platforms that
need this.

The C2x draft (currently expected to become C23) makes static_assert
a keyword to match C++. So only define the macro for up to C17.

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years agogh-102899: Fix doc link for getting filesystem error handler (#102901)
Olivier Gayot [Wed, 5 Apr 2023 14:54:43 +0000 (16:54 +0200)] 
gh-102899: Fix doc link for getting filesystem error handler (#102901)

2 years agogh-89058: remove skip from test_no_hang_on_context_chain_cycle2 (#102903)
Irit Katriel [Wed, 5 Apr 2023 14:52:38 +0000 (15:52 +0100)] 
gh-89058: remove skip from test_no_hang_on_context_chain_cycle2 (#102903)

2 years agogh-86094: Add support for Unicode Path Extra Field in ZipFile (gh-102566)
Yeojin Kim [Wed, 5 Apr 2023 11:54:48 +0000 (20:54 +0900)] 
gh-86094: Add support for Unicode Path Extra Field in ZipFile (gh-102566)

2 years agogh-100408: Fix a traceback in multiprocessing example (#100409)
Serhiy Storchaka [Wed, 5 Apr 2023 11:43:26 +0000 (14:43 +0300)] 
gh-100408: Fix a traceback in multiprocessing example (#100409)

2 years agogh-74690: typing: Call `_get_protocol_attrs` and `_callable_members_only` at protocol...
Alex Waygood [Wed, 5 Apr 2023 11:19:03 +0000 (12:19 +0100)] 
gh-74690: typing: Call `_get_protocol_attrs` and `_callable_members_only` at protocol class creation time, not during `isinstance()` checks (#103160)

2 years agogh-81762: Clarify and simplify description of print's flush param (#103264)
C.A.M. Gerlach [Wed, 5 Apr 2023 11:16:36 +0000 (06:16 -0500)] 
gh-81762: Clarify and simplify description of print's flush param (#103264)

2 years agogh-74690: typing: Simplify and optimise `_ProtocolMeta.__instancecheck__` (#103159)
Alex Waygood [Wed, 5 Apr 2023 09:07:30 +0000 (10:07 +0100)] 
gh-74690: typing: Simplify and optimise `_ProtocolMeta.__instancecheck__` (#103159)

2 years agogh-103193: Micro-optimise helper functions for `inspect.getattr_static` (#103195)
Alex Waygood [Wed, 5 Apr 2023 07:27:01 +0000 (08:27 +0100)] 
gh-103193: Micro-optimise helper functions for `inspect.getattr_static` (#103195)

2 years agogh-103167: Fix `-Wstrict-prototypes` warnings by using `(void)` for functions with...
Nikita Sobolev [Wed, 5 Apr 2023 07:22:33 +0000 (10:22 +0300)] 
gh-103167: Fix `-Wstrict-prototypes` warnings by using `(void)` for functions with no args (GH-103168)

2 years agogh-66897: Upgrade HTTP CONNECT to protocol HTTP/1.1 (#8305)
Michael Handler [Wed, 5 Apr 2023 04:55:24 +0000 (21:55 -0700)] 
gh-66897: Upgrade HTTP CONNECT to protocol HTTP/1.1 (#8305)

* bpo-22708: Upgrade HTTP CONNECT to protocol HTTP/1.1 (GH-NNNN)

Use protocol HTTP/1.1 when sending HTTP CONNECT tunnelling requests;
generate Host: headers if one is not already provided (required by
HTTP/1.1), convert IDN domains to punycode in HTTP CONNECT requests.

* Refactor tests to pass under -bb (fix ByteWarnings); missed some lines >80.

* Use consistent 'tunnelling' spelling in Lib/http/client.py

* Lib/test/test_httplib: Remove remnant of obsoleted test.

* Use dict.copy() not copy.copy()

* fix version changed

* Update Lib/http/client.py

Co-authored-by: bgehman <bgehman@users.noreply.github.com>
* Switch to for/else: syntax, as suggested

* Don't use for: else:

* Sure, fine, w/e

* Oops

* 1nm to the left

---------

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: bgehman <bgehman@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-101525: Disable peephole optimization process of BOLT (gh-103187)
Dong-hee Na [Wed, 5 Apr 2023 00:10:45 +0000 (09:10 +0900)] 
gh-101525: Disable peephole optimization process of BOLT (gh-103187)

Co-authored-by: Dong-hee Na <donghee.na@linecorp.com>
2 years agogh-102660: Fix is_core_module() (gh-103257)
Eric Snow [Tue, 4 Apr 2023 23:03:40 +0000 (17:03 -0600)] 
gh-102660: Fix is_core_module() (gh-103257)

In gh-102744 we added is_core_module() (in Python/import.c), which relies on get_core_module_dict() (also added in that PR).  The problem is that_PyImport_FixupBuiltin(), which ultimately calls is_core_module(), is called on the builtins module before interp->builtins_copyis set.  Consequently, the builtins module isn't considered a "core" module while it is getting "fixed up" and its module def m_copy erroneously gets set.  Under isolated interpreters this causes problems since sys and builtins are allowed even though they are still single-phase init modules.  (This was discovered while working on gh-101660.)

The solution is to stop relying on get_core_module_dict() in is_core_module().

2 years agoImprove some grammar in the socket docs (#103254)
Tim Burke [Tue, 4 Apr 2023 22:46:46 +0000 (15:46 -0700)] 
Improve some grammar in the socket docs (#103254)

2 years agoGH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179)
Charles Machalow [Tue, 4 Apr 2023 22:24:13 +0000 (15:24 -0700)] 
GH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179)

2 years agogh-103207: Add instructions to the macOS installer welcome display on how to workarou...
Ned Deily [Tue, 4 Apr 2023 21:06:00 +0000 (17:06 -0400)] 
gh-103207: Add instructions to the macOS installer welcome display on how to workaround  the macOS 13 Ventura “The installer encountered an error” failure. (GH-103251)

2 years agoMerge branch 'main' of https://github.com/python/cpython into main
Thomas Wouters [Tue, 4 Apr 2023 20:01:07 +0000 (22:01 +0200)] 
Merge branch 'main' of https://github.com/python/cpython into main

2 years agoPost 3.12.0a7
Thomas Wouters [Tue, 4 Apr 2023 20:00:41 +0000 (22:00 +0200)] 
Post 3.12.0a7

2 years agobpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908)
Steve Dower [Tue, 4 Apr 2023 16:00:03 +0000 (17:00 +0100)] 
bpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908)

2 years agoPython 3.12.0a7 v3.12.0a7
Thomas Wouters [Tue, 4 Apr 2023 15:51:44 +0000 (17:51 +0200)] 
Python 3.12.0a7

2 years agoFix a compiler warning in _xxsubinterpretermodule.c (#103245)
T. Wouters [Tue, 4 Apr 2023 14:51:30 +0000 (16:51 +0200)] 
Fix a compiler warning in _xxsubinterpretermodule.c (#103245)

Fix a (correct) warning about potential uses of uninitialized memory in
_xxsubinterpreter. Unlike newly allocated PyObject structs or global
structs, stack-allocated structs are not initialised, and a few places in
the code expect the _sharedexception struct data to be either NULL or
initialised.

2 years agogh-103092: Isolate `_pickle` module (#102982)
Erlend E. Aasland [Tue, 4 Apr 2023 10:08:54 +0000 (12:08 +0200)] 
gh-103092: Isolate `_pickle` module (#102982)

Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)
Ethan Furman [Tue, 4 Apr 2023 00:47:40 +0000 (17:47 -0700)] 
gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)

_gnv_ --> _generate_next_value_

2 years agoSpecify more settings for the C extension of VS Code for dev containers (GH-103229)
Brett Cannon [Mon, 3 Apr 2023 23:47:48 +0000 (16:47 -0700)] 
Specify more settings for the C extension of VS Code for dev containers (GH-103229)

Should help with auto-complete.

2 years agogh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)
David Benjamin [Mon, 3 Apr 2023 22:44:00 +0000 (07:44 +0900)] 
gh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)

Prior to https://github.com/python/cpython/pull/25300, the
make_ssl_data.py script used various tables, exposed in _ssl, to update
the error list.

After that PR, this is no longer used. Moreover, the err_names_to_codes
map isn't used at all. Clean those up. This gets them out of the way if,
in the future, OpenSSL provides an API to do what the code here is doing
directly. (https://github.com/openssl/openssl/issues/19848)

2 years agogh-98298, gh-74730: [Enum] update docs (GH-103163)
Ethan Furman [Mon, 3 Apr 2023 21:57:42 +0000 (14:57 -0700)] 
gh-98298, gh-74730: [Enum] update docs (GH-103163)

fix FlagBoundary statements
add warning about reloading modules and enum identity

2 years agogh-103215: Remove redundant if stmt from `enum.EnumType._find_data_type_` (GH-103222)
Sadra Barikbin [Mon, 3 Apr 2023 21:51:43 +0000 (01:21 +0330)] 
gh-103215: Remove redundant if stmt from `enum.EnumType._find_data_type_` (GH-103222)

2 years agogh-101100: Use list of 'dirty' docs, with warnings, instead of a clean list (#103191)
Hugo van Kemenade [Mon, 3 Apr 2023 18:59:47 +0000 (21:59 +0300)] 
gh-101100: Use list of 'dirty' docs, with warnings, instead of a clean list (#103191)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)
Barney Gale [Mon, 3 Apr 2023 18:57:11 +0000 (19:57 +0100)] 
GH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)

Fix an issue where `__new__()` and `__init__()` were not called on subclasses of `pathlib.PurePath` and `Path` in some circumstances.

Paths are now normalized on-demand. This speeds up path construction, `p.joinpath(q)`, and `p / q`.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2 years agogh-101865: Deprecate `co_lnotab` from code objects as per PEP 626 (#101866)
Nikita Sobolev [Mon, 3 Apr 2023 15:35:04 +0000 (18:35 +0300)] 
gh-101865: Deprecate `co_lnotab` from code objects as per PEP 626 (#101866)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agoGH-103182: use vectorcall in `_asyncio` instead of variadic calling APIs (#103175)
Kumar Aditya [Mon, 3 Apr 2023 12:44:32 +0000 (18:14 +0530)] 
GH-103182: use vectorcall in `_asyncio` instead of variadic calling APIs (#103175)

2 years agogh-102038: Skip a sometimes unnecessary stat in site.py (#102039)
Shantanu [Sun, 2 Apr 2023 22:47:31 +0000 (15:47 -0700)] 
gh-102038: Skip a sometimes unnecessary stat in site.py (#102039)

2 years agogh-102994: Profile docs has typo in example (#103074)
Nouran Ali [Sun, 2 Apr 2023 22:44:16 +0000 (00:44 +0200)] 
gh-102994: Profile docs has typo in example (#103074)

2 years agogh-103109: Document ignore_warnings() test support helper (#103110)
Charlie Zhao [Sun, 2 Apr 2023 22:18:25 +0000 (06:18 +0800)] 
gh-103109: Document ignore_warnings() test support helper (#103110)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agobpo-4080: unittest durations (#12271)
Giampaolo Rodola [Sun, 2 Apr 2023 22:12:51 +0000 (00:12 +0200)] 
bpo-4080: unittest durations (#12271)

2 years agofix typo in _ssl.c (GH-103192)
Ikko Eltociear Ashimine [Sun, 2 Apr 2023 15:25:46 +0000 (00:25 +0900)] 
fix typo in _ssl.c (GH-103192)

seperated -> separated

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-102433: Use `inspect.getattr_static` in `typing._ProtocolMeta.__instancecheck__...
Alex Waygood [Sun, 2 Apr 2023 13:22:19 +0000 (14:22 +0100)] 
gh-102433: Use `inspect.getattr_static` in `typing._ProtocolMeta.__instancecheck__` (#103034)

2 years agoGH-102456: Fix docstring and getopt options for base64 (gh-102457) 103190/head
Partha P. Mukherjee [Sun, 2 Apr 2023 05:05:50 +0000 (01:05 -0400)] 
GH-102456: Fix docstring and getopt options for base64 (gh-102457)

2 years agogh-102192: deprecate _PyErr_ChainExceptions (#102935)
Irit Katriel [Sat, 1 Apr 2023 20:30:23 +0000 (21:30 +0100)] 
gh-102192: deprecate _PyErr_ChainExceptions (#102935)

2 years agogh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo ...
Irit Katriel [Sat, 1 Apr 2023 05:01:48 +0000 (06:01 +0100)] 
gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157)

2 years agoAdd missing variables to `bytecodes.c` (GH-103153)
Brett Cannon [Fri, 31 Mar 2023 21:23:55 +0000 (14:23 -0700)] 
Add missing variables to `bytecodes.c` (GH-103153)

The code works without this change, but it does cause C tooling to complain less about undeclared variables.

2 years agogh-74690: Micro-optimise `typing._get_protocol_attrs` (#103152)
Alex Waygood [Fri, 31 Mar 2023 20:54:50 +0000 (21:54 +0100)] 
gh-74690: Micro-optimise `typing._get_protocol_attrs` (#103152)

Improve performance of `isinstance()` checks against runtime-checkable protocols

2 years agogh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149)
Ethan Furman [Fri, 31 Mar 2023 20:52:31 +0000 (13:52 -0700)] 
gh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149)

2 years agogh-101659: Clean Up the General Import Tests for Subinterpreters (gh-103151)
Eric Snow [Fri, 31 Mar 2023 18:18:33 +0000 (12:18 -0600)] 
gh-101659: Clean Up the General Import Tests for Subinterpreters (gh-103151)

This involves 3 changes: some general cleanup, checks to match the kind of module, and switch from testing against sys to _imp.

This is a precursor to gh-103150, though the changes are meant to stand on their own.

2 years agogh-100227: Fix Cleanup of the Extensions Cache (gh-103150)
Eric Snow [Fri, 31 Mar 2023 18:09:10 +0000 (12:09 -0600)] 
gh-100227: Fix Cleanup of the Extensions Cache (gh-103150)

Decref the key in the right interpreter in _extensions_cache_set().

This is a follow-up to gh-103084. I found the bug while working on gh-101660.

2 years agogh-74690: typing: Don't unnecessarily call `_get_protocol_attrs` twice in `_ProtocolM...
Alex Waygood [Fri, 31 Mar 2023 17:37:24 +0000 (18:37 +0100)] 
gh-74690: typing: Don't unnecessarily call `_get_protocol_attrs` twice in `_ProtocolMeta.__instancecheck__` (#103141)

Speed up `isinstance()` calls against runtime-checkable protocols

2 years agogh-87092: move CFG related code from compile.c to flowgraph.c (#103021)
Irit Katriel [Fri, 31 Mar 2023 17:17:59 +0000 (18:17 +0100)] 
gh-87092: move CFG related code from compile.c to flowgraph.c (#103021)

2 years agogh-102871: Remove obsolete browsers from webbrowser (#102872)
James De Bias [Fri, 31 Mar 2023 15:02:47 +0000 (02:02 +1100)] 
gh-102871: Remove obsolete browsers from webbrowser (#102872)

2 years agoGH-84783: Mention Author for GH-101264 (make slices hashable) (#103146)
Furkan Onder [Fri, 31 Mar 2023 13:54:17 +0000 (16:54 +0300)] 
GH-84783: Mention Author for GH-101264 (make slices hashable) (#103146)

Will Bradshaw contributed original patch on bpo-40603.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agoQuote literal tokens in standard format specifier grammar (GH-102902)
Petr Viktorin [Fri, 31 Mar 2023 12:40:38 +0000 (14:40 +0200)] 
Quote literal tokens in standard format specifier grammar (GH-102902)

Reported by Damian Dureck: https://mail.python.org/archives/list/docs@python.org/thread/UZTWBJIXC3MBKTHXVTIBPGDPKBNWZ5LN/

2 years agogh-101100: Expand list of clean docs (GH-103135)
Hugo van Kemenade [Fri, 31 Mar 2023 10:48:46 +0000 (13:48 +0300)] 
gh-101100:  Expand list of clean docs (GH-103135)

Follow on from https://github.com/python/cpython/pull/103116.

Expand list of clean docs files from 3 to 181. These files have no Sphinx warnings, and their presence in this list means that any new warnings introduced will fail the build.

The list was created by subtracting the list of files with warnings from a list of all files.

I tested with all of those, but found that `touch`ing two clean files (https://github.com/python/cpython/blob/main/Doc/includes/wasm-notavail.rst and https://github.com/python/cpython/blob/main/Doc/whatsnew/changelog.rst) caused a cascade effect and resulted in a number of dirty files being rebuilt too, and failing the build. So those two have been omitted.

Automerge-Triggered-By: GH:hugovk
2 years agogh-102799: use exception instance instead of sys.exc_info() (#102885)
Irit Katriel [Fri, 31 Mar 2023 10:23:02 +0000 (11:23 +0100)] 
gh-102799: use exception instance instead of sys.exc_info() (#102885)

2 years agoMinor docs improvements fix for `codeop` (#103123)
gaogaotiantian [Thu, 30 Mar 2023 22:51:36 +0000 (15:51 -0700)] 
Minor docs improvements fix for `codeop` (#103123)

2 years agogh-102110: Add all tools description missed (GH-102625)
Missoupro [Thu, 30 Mar 2023 20:49:07 +0000 (21:49 +0100)] 
gh-102110: Add all tools description missed (GH-102625)

Added missing descriptions of some tools.

Automerge-Triggered-By: GH:hugovk
2 years agoAdd IPv6 into to the docstring for socket.getsockname (#102961)
Brian Haley [Thu, 30 Mar 2023 18:40:58 +0000 (14:40 -0400)] 
Add IPv6 into to the docstring for socket.getsockname (#102961)

Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
2 years agogh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)
Hugo van Kemenade [Thu, 30 Mar 2023 18:03:50 +0000 (21:03 +0300)] 
gh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086)
Jeong, YunWon [Thu, 30 Mar 2023 16:23:43 +0000 (01:23 +0900)] 
gh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086)

2 years agogh-103099: Link mypy docs from typing.rst (#103100)
Shantanu [Thu, 30 Mar 2023 08:32:09 +0000 (01:32 -0700)] 
gh-103099: Link mypy docs from typing.rst (#103100)

2 years agogh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters (gh-103084)
Eric Snow [Wed, 29 Mar 2023 23:15:43 +0000 (17:15 -0600)] 
gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters (gh-103084)

Sharing mutable (or non-immortal) objects between interpreters is generally not safe.  We can work around that but not easily.
 There are two restrictions that are critical for objects that break interpreter isolation.

The first is that the object's state be guarded by a global lock.  For now the GIL meets this requirement, but a granular global lock is needed once we have a per-interpreter GIL.

The second restriction is that the object (and, for a container, its items) be deallocated/resized only when the interpreter in which it was allocated is the current one.  This is because every interpreter has (or will have, see gh-101660) its own object allocator.  Deallocating an object with a different allocator can cause crashes.

The dict for the cache of module defs is completely internal, which simplifies what we have to do to meet those requirements.  To do so, we do the following:

* add a mechanism for re-using a temporary thread state tied to the main interpreter in an arbitrary thread
   * add _PyRuntime.imports.extensions.main_tstate`
   * add _PyThreadState_InitDetached() and _PyThreadState_ClearDetached() (pystate.c)
   * add _PyThreadState_BindDetached() and _PyThreadState_UnbindDetached() (pystate.c)
* make sure the cache dict (_PyRuntime.imports.extensions.dict) and its items are all owned by the main interpreter)
* add a placeholder using for a granular global lock

Note that the cache is only used for legacy extension modules and not for multi-phase init modules.

https://github.com/python/cpython/issues/100227

2 years agoGH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)
Brandt Bucher [Wed, 29 Mar 2023 22:53:30 +0000 (15:53 -0700)] 
GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)

2 years agogh-90110: Bring the whitelists up to date. (gh-103114)
Eric Snow [Wed, 29 Mar 2023 22:08:40 +0000 (16:08 -0600)] 
gh-90110: Bring the whitelists up to date. (gh-103114)

https://github.com/python/cpython/issues/90110

2 years agoGH-102973: add a dev container (GH-102975)
Brett Cannon [Wed, 29 Mar 2023 20:28:08 +0000 (13:28 -0700)] 
GH-102973: add a dev container (GH-102975)

On content update, builds `python` and the docs. Also adds a Dockerfile that should include everything but autoconf 2.69 that's necessary to build CPython and the entire stdlib on Fedora.

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Dusty Phillips <dusty@phillips.codes>
2 years agogh-103112: Add http.client.HTTPResponse.read docstring and fix pydoc output (#103113)
Bernhard Wagner [Wed, 29 Mar 2023 19:21:56 +0000 (21:21 +0200)] 
gh-103112: Add http.client.HTTPResponse.read docstring and fix pydoc output (#103113)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
2 years agogh-103068: Check condition expression of breakpoints for pdb (#103069)
gaogaotiantian [Wed, 29 Mar 2023 10:09:12 +0000 (03:09 -0700)] 
gh-103068: Check condition expression of breakpoints for pdb (#103069)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Artem Mukhin <ortem00@gmail.com>
2 years agogh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst (GH-102635)
Matěj Cepl [Wed, 29 Mar 2023 08:52:53 +0000 (10:52 +0200)] 
gh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst (GH-102635)

2 years agogh-103054: typing: Improve `Callable` type substitution tests (#103055)
Nikita Sobolev [Wed, 29 Mar 2023 03:04:26 +0000 (06:04 +0300)] 
gh-103054: typing: Improve `Callable` type substitution tests (#103055)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2 years agogh-103097: Add workaround for Windows ARM64 compiler bug (GH-103098)
Steve Dower [Tue, 28 Mar 2023 23:47:13 +0000 (00:47 +0100)] 
gh-103097: Add workaround for Windows ARM64 compiler bug (GH-103098)

See https://developercommunity.visualstudio.com/t/Regression-in-MSVC-1433-1434-ARM64-co/10224361 for details of the issue. It only applies to version 14.34.

2 years agogh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)
Eric Snow [Tue, 28 Mar 2023 18:52:28 +0000 (12:52 -0600)] 
gh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)

We can revisit the options for keeping it global later, if desired.  For now the approach seems quite complex, so we've gone with the simpler isolation solution in the meantime.

https://github.com/python/cpython/issues/100227

2 years agoGH-102711: Fix warnings found by clang (#102712)
Chenxi Mao [Tue, 28 Mar 2023 08:52:22 +0000 (16:52 +0800)] 
GH-102711: Fix warnings found by clang (#102712)

There are some warnings if build python via clang:

Parser/pegen.c:812:31: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_clear_memo_statistics()
                              ^
                               void

Parser/pegen.c:820:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_get_memo_statistics()
                            ^
                             void

Fix it to make clang happy.

Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
2 years agogh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060)
Ethan Furman [Mon, 27 Mar 2023 23:26:16 +0000 (16:26 -0700)] 
gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060)

2 years agogh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod (GH-103062)
Ethan Furman [Mon, 27 Mar 2023 23:25:19 +0000 (16:25 -0700)] 
gh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod (GH-103062)

2 years agogh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)
Oleg Iarygin [Mon, 27 Mar 2023 23:21:07 +0000 (03:21 +0400)] 
gh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)

Co-authored-by: Simeon Visser <svisser@users.noreply.github.com>
2 years agogh-100227: Revert gh-102925 "gh-100227: Make the Global Interned Dict Safe for Isolat...
Eric Snow [Mon, 27 Mar 2023 22:53:05 +0000 (16:53 -0600)] 
gh-100227: Revert gh-102925 "gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters" (gh-103063)

This reverts commit 87be8d9.

This approach to keeping the interned strings safe is turning out to be too complex for my taste (due to obmalloc isolation). For now I'm going with the simpler solution, making the dict per-interpreter. We can revisit that later if we want a sharing solution.

2 years agogh-103046: Display current line correctly for `dis.disco()` with CACHE entries (...
gaogaotiantian [Mon, 27 Mar 2023 22:22:06 +0000 (15:22 -0700)] 
gh-103046: Display current line correctly for `dis.disco()` with CACHE entries (#103047)

2 years agogh-103023: Add SyntaxError check in pdb's `display` command (#103024)
gaogaotiantian [Mon, 27 Mar 2023 20:37:22 +0000 (13:37 -0700)] 
gh-103023: Add SyntaxError check in pdb's `display` command (#103024)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>