]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
19 months agoCI: Process stale issues twice per day (#116636)
Hugo van Kemenade [Tue, 12 Mar 2024 17:49:26 +0000 (19:49 +0200)] 
CI: Process stale issues twice per day (#116636)

19 months agogh-116656: Fix test_capi test_py_config_isoloated_per_interpreter() (#116658)
Victor Stinner [Tue, 12 Mar 2024 17:31:35 +0000 (18:31 +0100)] 
gh-116656: Fix test_capi test_py_config_isoloated_per_interpreter() (#116658)

Don't parse argv when setting the configuration, to avoid SystemExit if parsing argv fails.

19 months agogh-116604: Check for `gcstate->enabled` in _Py_RunGC in free-threaded build (#116663)
Sam Gross [Tue, 12 Mar 2024 17:12:02 +0000 (13:12 -0400)] 
gh-116604: Check for `gcstate->enabled` in _Py_RunGC in free-threaded build (#116663)

This isn't strictly necessary because the implementation of `gc_should_collect`
already checks `gcstate->enabled` in the free-threaded build, but it seems
like a good idea until the common pieces of gc.c and gc_free_threading.c are
refactored out.

19 months agogh-116127: PEP-705: Add `ReadOnly` support for `TypedDict` (#116350)
Nikita Sobolev [Tue, 12 Mar 2024 14:49:39 +0000 (17:49 +0300)] 
gh-116127: PEP-705: Add `ReadOnly` support for `TypedDict` (#116350)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
19 months agoFix code comment regarding DK_ENTRIES (GH-113960)
Matthias Diener [Tue, 12 Mar 2024 14:05:30 +0000 (09:05 -0500)] 
Fix code comment regarding DK_ENTRIES (GH-113960)

fix code comment regarding dict entries

19 months agogh-116616: Use relaxed atomic ops to access socket module defaulttimeout (#116623)
Erlend E. Aasland [Tue, 12 Mar 2024 13:44:39 +0000 (14:44 +0100)] 
gh-116616: Use relaxed atomic ops to access socket module defaulttimeout (#116623)

Co-authored-by: Sam Gross <colesbury@gmail.com>
19 months agogh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)
Pablo Galindo Salgado [Tue, 12 Mar 2024 12:00:49 +0000 (12:00 +0000)] 
gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)

19 months agogh-110819: Fix ‘kind’ may be used uninitialized warning in `longobject` (#116599)
Nikita Sobolev [Tue, 12 Mar 2024 10:50:06 +0000 (13:50 +0300)] 
gh-110819: Fix ‘kind’ may be used uninitialized warning in `longobject` (#116599)

19 months agogh-116541: Handle errors correctly in `_pystatvfs_fromstructstatvfs` (#116542)
Nikita Sobolev [Tue, 12 Mar 2024 10:10:00 +0000 (13:10 +0300)] 
gh-116541: Handle errors correctly in `_pystatvfs_fromstructstatvfs` (#116542)

19 months agogh-89547: Support for nesting special forms like Final (#116096)
Mehdi Drissi [Tue, 12 Mar 2024 06:11:56 +0000 (23:11 -0700)] 
gh-89547: Support for nesting special forms like Final (#116096)

19 months agogh-116145: Update macOS installer to Tcl/Tk 8.6.14 (GH-116151)
Christopher Chavez [Tue, 12 Mar 2024 05:37:07 +0000 (00:37 -0500)] 
gh-116145: Update macOS installer to Tcl/Tk 8.6.14 (GH-116151)

19 months agogh-85283: Convert grp extension to the limited C API (#116611)
Victor Stinner [Tue, 12 Mar 2024 00:46:53 +0000 (01:46 +0100)] 
gh-85283: Convert grp extension to the limited C API (#116611)

posixmodule.h: remove check on the limited C API, since these helpers
are not part of the public C API.

19 months agogh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)"...
Guido van Rossum [Tue, 12 Mar 2024 00:31:49 +0000 (17:31 -0700)] 
gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" (#116632)

Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)"

Reason: The new test doesn't always pass:
https://github.com/python/cpython/pull/116423#issuecomment-1989425489

This reverts commit 1d0d49a7e86257ff95b4de0685e6997d7533993c.

19 months agogh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)
Victor Stinner [Mon, 11 Mar 2024 22:42:18 +0000 (23:42 +0100)] 
gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)

Accept spaces in "#  define Py_LIMITED_API 0x030d0000".

19 months agogh-116600: [Enum] fix global Flag repr (GH-116615)
Ethan Furman [Mon, 11 Mar 2024 22:41:53 +0000 (15:41 -0700)] 
gh-116600: [Enum] fix global Flag repr (GH-116615)

* and fix global flag repr

* Update Misc/NEWS.d/next/Library/2024-03-11-12-11-10.gh-issue-116600.FcNBy_.rst

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
19 months agogh-116563: Update tutorial error example (#116569)
Terry Jan Reedy [Mon, 11 Mar 2024 22:01:08 +0000 (18:01 -0400)] 
gh-116563: Update tutorial error example (#116569)

There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.

19 months agogh-90095: Make .pdbrc work properly and add some reasonable tests (#110496)
Tian Gao [Mon, 11 Mar 2024 21:27:00 +0000 (14:27 -0700)] 
gh-90095: Make .pdbrc work properly and add some reasonable tests (#110496)

19 months agogh-116040: [Enum] fix test_empty_names test (GH-116508)
Ethan Furman [Mon, 11 Mar 2024 20:42:01 +0000 (13:42 -0700)] 
gh-116040: [Enum] fix test_empty_names test (GH-116508)

* and fix _not_given usage

19 months agogh-71052: Use `raise_signal` in `ThreadSignals.test_signals` (#116423)
Malcolm Smith [Mon, 11 Mar 2024 20:39:17 +0000 (20:39 +0000)] 
gh-71052: Use `raise_signal` in `ThreadSignals.test_signals` (#116423)

Use `raise_signal` rather than `kill` in `ThreadSignals.test_signals`

19 months agogh-113538: Add asycio.Server.{close,abort}_clients (#114432)
Pierre Ossman (ThinLinc team) [Mon, 11 Mar 2024 19:43:30 +0000 (20:43 +0100)] 
gh-113538: Add asycio.Server.{close,abort}_clients (#114432)

These give applications the option of more forcefully terminating client
connections for asyncio servers. Useful when terminating a service and
there is limited time to wait for clients to finish up their work.

19 months agogh-71052: Change Android's `sys.platform` from "linux" to "android"
Malcolm Smith [Mon, 11 Mar 2024 19:25:39 +0000 (19:25 +0000)] 
gh-71052: Change Android's `sys.platform` from "linux" to "android"

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
19 months agogh-116515: Clear thread-local state before tstate_delete_common() (#116517)
Sam Gross [Mon, 11 Mar 2024 19:14:20 +0000 (15:14 -0400)] 
gh-116515: Clear thread-local state before tstate_delete_common() (#116517)

This moves `current_fast_clear()` up so that the current thread state is
`NULL` while running `tstate_delete_common()`.

This doesn't fix any bugs, but it means that we are more consistent that
`_PyThreadState_GET() != NULL` means that the thread is "attached".

19 months agoGH-115976: Add WASI to CI (GH-116516)
Brett Cannon [Mon, 11 Mar 2024 18:59:09 +0000 (11:59 -0700)] 
GH-115976: Add WASI to CI (GH-116516)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
19 months agogh-110850: Fix _PyTime_FromSecondsDouble() API (#116606)
Victor Stinner [Mon, 11 Mar 2024 16:35:29 +0000 (17:35 +0100)] 
gh-110850: Fix _PyTime_FromSecondsDouble() API (#116606)

Return 0 on success. Set an exception and return -1 on error.

Fix os.timerfd_settime(): properly report exceptions on
_PyTime_FromSecondsDouble() failure.

No longer export _PyTime_FromSecondsDouble().

19 months agogh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)
Brett Simmers [Mon, 11 Mar 2024 15:02:58 +0000 (11:02 -0400)] 
gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)

In free-threaded builds, running with `PYTHON_GIL=0` will now disable the
GIL. Follow-up issues track work to re-enable the GIL when loading an
incompatible extension, and to disable the GIL by default.

In order to support re-enabling the GIL at runtime, all GIL-related data
structures are initialized as usual, and disabling the GIL simply sets a flag
that causes `take_gil()` and `drop_gil()` to return early.

19 months agogh-116417: Build _testinternalcapi with limited C API version 3.5 (#116598)
Victor Stinner [Mon, 11 Mar 2024 14:20:04 +0000 (15:20 +0100)] 
gh-116417: Build _testinternalcapi with limited C API version 3.5 (#116598)

19 months agoGH-116596: Better determination of escaping uops. (GH-116597)
Mark Shannon [Mon, 11 Mar 2024 13:37:48 +0000 (13:37 +0000)] 
GH-116596: Better determination of escaping uops. (GH-116597)

19 months agogh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-thread-sanitizer (gh...
Donghee Na [Mon, 11 Mar 2024 13:25:55 +0000 (22:25 +0900)] 
gh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-thread-sanitizer (gh-116558)

19 months agogh-116590: Fix unused `current_thread_holds_gil` function warning (#116591)
Nikita Sobolev [Mon, 11 Mar 2024 13:25:04 +0000 (16:25 +0300)] 
gh-116590: Fix unused `current_thread_holds_gil` function warning (#116591)

19 months agogh-116545: Fix error handling in `mkpwent` in `pwdmodule` (#116548)
Nikita Sobolev [Mon, 11 Mar 2024 10:58:24 +0000 (13:58 +0300)] 
gh-116545: Fix error handling in `mkpwent` in `pwdmodule` (#116548)

19 months agogh-116417: Move 4 limited C API test files to _testlimitedcapi (#116571)
Victor Stinner [Mon, 11 Mar 2024 10:28:16 +0000 (11:28 +0100)] 
gh-116417: Move 4 limited C API test files to _testlimitedcapi (#116571)

Move the following files from Modules/_testcapi/ to
Modules/_testlimitedcapi/:

* bytearray.c
* bytes.c
* pyos.c
* sys.c

Changes:

* Replace PyBytes_AS_STRING() with PyBytes_AsString().
* Replace PyBytes_GET_SIZE() with PyBytes_Size().
* Update related test_capi tests.
* Copy Modules/_testcapi/util.h to Modules/_testlimitedcapi/util.h.

19 months agogh-88352: Make TimedRotatingFileHandler tests more stable (GH-116409)
Serhiy Storchaka [Mon, 11 Mar 2024 09:57:07 +0000 (11:57 +0200)] 
gh-88352: Make TimedRotatingFileHandler tests more stable (GH-116409)

The tests failed (with less than 1% probability) if for example the file
was created at 11:46:03.999, but the record was emitted at 11:46:04.001,
with atTime=11:46:04, which caused an unexpected rollover. Ensure that the
tests are always run within the range of the same whole second.

Also share code between test_rollover_at_midnight and test_rollover_at_weekday.

19 months agoGH-116468: Use constants instead of `oparg` in stack effects when `oparg` is known...
Mark Shannon [Mon, 11 Mar 2024 09:30:15 +0000 (09:30 +0000)] 
GH-116468: Use constants instead of `oparg` in stack effects when `oparg` is known to be a constant. (GH-116469)

19 months agogh-116417: Argument Clinic: test generated Limited C API code for float args (#116573)
Erlend E. Aasland [Mon, 11 Mar 2024 07:44:42 +0000 (08:44 +0100)] 
gh-116417: Argument Clinic: test generated Limited C API code for float args (#116573)

19 months agogh-116576: Fix `Tools/scripts/sortperf.py` sorting the same list (#116577)
Nikita Sobolev [Mon, 11 Mar 2024 06:38:04 +0000 (09:38 +0300)] 
gh-116576: Fix `Tools/scripts/sortperf.py` sorting the same list (#116577)

19 months agogh-116057: Use relative recursion limits when testing os.walk() and Path.walk() ...
Malcolm Smith [Sun, 10 Mar 2024 22:00:33 +0000 (22:00 +0000)] 
gh-116057: Use relative recursion limits when testing os.walk() and Path.walk() (#116058)

Replace test.support.set_recursion_limit with test.support.infinite_recursion.

19 months agogh-116417: Fix make check-c-globals for _testlimitedcapi (#116570)
Victor Stinner [Sun, 10 Mar 2024 20:19:47 +0000 (21:19 +0100)] 
gh-116417: Fix make check-c-globals for _testlimitedcapi (#116570)

* Remove unused '_testcapimodule' global in Modules/_testcapi/unicode.c.
* Update c-analyzer to not use the internal C API in
  _testlimitedcapi.c.

19 months agogh-116417: Avoid PyFloat_AS_DOUBLE() in AC limited C API (#116568)
Victor Stinner [Sun, 10 Mar 2024 19:42:40 +0000 (20:42 +0100)] 
gh-116417: Avoid PyFloat_AS_DOUBLE() in AC limited C API (#116568)

Argument Clinic no longer calls PyFloat_AS_DOUBLE() when the usage of
the limited C API is requested.

20 months agogh-112087: Make list.sort to be thread-safe for PEP 703. (gh-116553)
Donghee Na [Sun, 10 Mar 2024 00:45:42 +0000 (09:45 +0900)] 
gh-112087: Make list.sort to be thread-safe for PEP 703. (gh-116553)

20 months agogh-112087: Store memory allocation information into _PyListArray (gh-116529)
Donghee Na [Sat, 9 Mar 2024 23:50:28 +0000 (08:50 +0900)] 
gh-112087: Store memory allocation information into _PyListArray (gh-116529)

20 months agogh-116535: Fix distracting "TypeError" in example code (gh-116538)
Declan [Sat, 9 Mar 2024 21:52:57 +0000 (22:52 +0100)] 
gh-116535: Fix distracting "TypeError" in example code (gh-116538)

20 months agogh-111389: expose PyHASH_INF/BITS/MODULUS/IMAG macros as public (#111418)
Sergey B Kirpichev [Sat, 9 Mar 2024 20:32:05 +0000 (23:32 +0300)] 
gh-111389: expose PyHASH_INF/BITS/MODULUS/IMAG macros as public (#111418)

Co-authored-by: Victor Stinner <vstinner@python.org>
20 months agogh-115142: Skip ``test__xxsubinterpreters`` if ``_testinternalcapi`` is not available...
Kirill Podoprigora [Sat, 9 Mar 2024 13:28:13 +0000 (15:28 +0200)] 
gh-115142: Skip ``test__xxsubinterpreters`` if ``_testinternalcapi`` is not available (#116507)

20 months agogh-116520: Fix error handling in `os_get_terminal_size_impl` in `posixmodule` (#116521)
Nikita Sobolev [Sat, 9 Mar 2024 11:18:38 +0000 (14:18 +0300)] 
gh-116520: Fix error handling in `os_get_terminal_size_impl` in `posixmodule` (#116521)

20 months agoGH-116218 Docs: Add availability information for the 'resource' module (#116256)
Kerim Kabirov [Sat, 9 Mar 2024 09:00:37 +0000 (10:00 +0100)] 
GH-116218 Docs: Add availability information for the 'resource' module (#116256)

Add availability data to 'resource' module Docs

20 months agogh-112069: Make sets thread-safe with the GIL disabled (#113800)
Tomas R [Fri, 8 Mar 2024 21:25:34 +0000 (22:25 +0100)] 
gh-112069: Make sets thread-safe with the GIL disabled (#113800)

This makes nearly all the operations on set thread-safe in the free-threaded build, with the exception of `_PySet_NextEntry` and `setiter_iternext`.

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
20 months agogh-108724: Fix _PySemaphore_Wait call during thread deletion (#116483)
Sam Gross [Fri, 8 Mar 2024 20:26:36 +0000 (15:26 -0500)] 
gh-108724: Fix _PySemaphore_Wait call during thread deletion (#116483)

In general, when `_PyThreadState_GET()` is non-NULL then the current
thread is "attached", but there is a small window during
`PyThreadState_DeleteCurrent()` where that's not true:
tstate_delete_common() is called when the thread is detached, but before
current_fast_clear().

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
20 months agogh-105535 Document potential performance trap during enum creation (GH-107119)
Nicolas A. Oyarzabal [Fri, 8 Mar 2024 19:22:17 +0000 (20:22 +0100)] 
gh-105535 Document potential performance trap during enum creation (GH-107119)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-75988: Fix issues with autospec ignoring wrapped object (#115223)
infohash [Fri, 8 Mar 2024 19:14:32 +0000 (00:44 +0530)] 
gh-75988: Fix issues with autospec ignoring wrapped object (#115223)

* set default return value of functional types as _mock_return_value

* added test of wrapping child attributes

* added backward compatibility with explicit return

* added docs on the order of precedence

* added test to check default return_value

20 months agogh-112075: Support freeing object memory via QSBR (#116344)
Dino Viehland [Fri, 8 Mar 2024 17:56:36 +0000 (09:56 -0800)] 
gh-112075: Support freeing object memory via QSBR (#116344)

Free objects with qsbr if shared

20 months agoReplace stat.ST_xxx usage with os.stat().st_xxx (#116501)
Victor Stinner [Fri, 8 Mar 2024 17:49:09 +0000 (18:49 +0100)] 
Replace stat.ST_xxx usage with os.stat().st_xxx (#116501)

Modernize code to use the new API which avoids the usage of the stat
module just to read os.stat() members.

* Sort logging.handlers imports.
* Rework reopenIfNeeded() code to make it easier to follow.
* Replace "not self.stream" with "self.stream is None".

20 months agogh-115103: Fix unregistering of QSBR state (#116480)
Sam Gross [Fri, 8 Mar 2024 17:39:53 +0000 (12:39 -0500)] 
gh-115103: Fix unregistering of QSBR state (#116480)

If a thread blocks while waiting on the `shared->mutex` lock, the array
of QSBR states may be reallocated. The `tstate->qsbr` values before the
lock is acquired may not be the same as the value after the lock is acquired.

20 months agogh-116493: Remove old Python 2.x _winreg imports from platform.py (GH-116494)
Nikita Sobolev [Fri, 8 Mar 2024 12:42:21 +0000 (15:42 +0300)] 
gh-116493: Remove old Python 2.x _winreg imports from platform.py (GH-116494)

20 months agogh-116447: Fix possible UB in `arraymodule` and `getargs` (#116459)
Nikita Sobolev [Fri, 8 Mar 2024 10:49:52 +0000 (13:49 +0300)] 
gh-116447: Fix possible UB in `arraymodule` and `getargs` (#116459)

20 months agoGH-113710: Fix optimization of globals using `_CHECK_FUNCTION` (GH-116460)
Mark Shannon [Fri, 8 Mar 2024 09:47:41 +0000 (09:47 +0000)] 
GH-113710: Fix optimization of globals using `_CHECK_FUNCTION` (GH-116460)

20 months agogh-116349: Deprecate `platform.java_ver` function (#116471)
Nikita Sobolev [Fri, 8 Mar 2024 08:14:17 +0000 (11:14 +0300)] 
gh-116349: Deprecate `platform.java_ver` function (#116471)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
20 months agogh-116485: Fixed the typo (#116486)
Varun Gole [Fri, 8 Mar 2024 08:04:50 +0000 (03:04 -0500)] 
gh-116485: Fixed the typo (#116486)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
20 months agogh-116303: Explicitly check for the _testsinglephase module in configure.ac (#116479)
Erlend E. Aasland [Thu, 7 Mar 2024 23:42:43 +0000 (00:42 +0100)] 
gh-116303: Explicitly check for the _testsinglephase module in configure.ac (#116479)

20 months agogh-116472: Replace literal newlines with escape characters in MSBuild files (GH-116473)
Dan Albert [Thu, 7 Mar 2024 21:53:13 +0000 (13:53 -0800)] 
gh-116472: Replace literal newlines with escape characters in MSBuild files (GH-116473)

20 months agogh-116040: [Enum] fix by-value calls when second value is falsey; e.g. Cardinal(1...
Ethan Furman [Thu, 7 Mar 2024 21:30:26 +0000 (13:30 -0800)] 
gh-116040: [Enum] fix by-value calls when second value is falsey; e.g. Cardinal(1, 0) (GH-116072)

20 months agogh-116000: Make optimizer_generator.py work without any arguments (#116470)
Kirill Podoprigora [Thu, 7 Mar 2024 19:05:50 +0000 (21:05 +0200)] 
gh-116000: Make optimizer_generator.py work without any arguments (#116470)

20 months agogh-116396: Pass "detached_state" argument to tstate_set_detached (#116398)
Sam Gross [Thu, 7 Mar 2024 18:37:43 +0000 (13:37 -0500)] 
gh-116396: Pass "detached_state" argument to tstate_set_detached (#116398)

The stop-the-world code was incorrectly setting suspended threads'
states to _Py_THREAD_DETACHED instead of _Py_THREAD_SUSPENDED.

20 months agogh-116417: Add _testlimitedcapi C extension (#116419)
Victor Stinner [Thu, 7 Mar 2024 18:31:12 +0000 (19:31 +0100)] 
gh-116417: Add _testlimitedcapi C extension (#116419)

Add a new C extension "_testlimitedcapi" which is only built with the
limited C API.

Move heaptype_relative.c and vectorcall_limited.c from
Modules/_testcapi/ to Modules/_testlimitedcapi/.

* configure: add _testlimitedcapi test extension.
* Update generate_stdlib_module_names.py.
* Update make check-c-globals.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
20 months agogh-106259: Add minimal help target to Makefile (#106260)
Skip Montanaro [Thu, 7 Mar 2024 17:21:28 +0000 (11:21 -0600)] 
gh-106259: Add minimal help target to Makefile (#106260)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
20 months agogh-116381: Remove bad specializations, add fail stats (GH-116464)
Ken Jin [Thu, 7 Mar 2024 16:21:21 +0000 (00:21 +0800)] 
gh-116381: Remove bad specializations, add fail stats (GH-116464)

* Remove bad specializations, add fail stats

20 months agogh-116420: Fix unused var compilation warnings (GH-116466)
Ken Jin [Thu, 7 Mar 2024 16:19:59 +0000 (00:19 +0800)] 
gh-116420: Fix unused var compilation warnings (GH-116466)

Fix unused var compilation warnings

20 months agoParallelize regen-cases (#116446)
Guido van Rossum [Thu, 7 Mar 2024 15:25:24 +0000 (07:25 -0800)] 
Parallelize regen-cases (#116446)

This makes a huge difference when using `make -j regen-cases`.

20 months agogh-115421: Test that our Makefile has all needed test folders (GH-115813)
Nikita Sobolev [Thu, 7 Mar 2024 11:24:38 +0000 (14:24 +0300)] 
gh-115421: Test that our Makefile has all needed test folders (GH-115813)

20 months agogh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)
Serhiy Storchaka [Thu, 7 Mar 2024 09:21:08 +0000 (11:21 +0200)] 
gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)

20 months agogh-116448: Handle errors correctly in `os_waitid_impl` in `posixmodule` (#116449)
Nikita Sobolev [Thu, 7 Mar 2024 08:28:48 +0000 (11:28 +0300)] 
gh-116448: Handle errors correctly in `os_waitid_impl` in `posixmodule` (#116449)

20 months agogh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298)
Serhiy Storchaka [Thu, 7 Mar 2024 08:05:03 +0000 (10:05 +0200)] 
gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298)

20 months agogh-116386: Fix format string "%ld" warning in `_xxinterpqueuesmodule` (#116387)
Nikita Sobolev [Thu, 7 Mar 2024 06:44:26 +0000 (09:44 +0300)] 
gh-116386: Fix format string "%ld" warning in `_xxinterpqueuesmodule` (#116387)

20 months agogh-114099 - Add iOS testbed, plus Makefile target to invoke it. (gh-115930)
Russell Keith-Magee [Thu, 7 Mar 2024 04:24:52 +0000 (12:24 +0800)] 
gh-114099 - Add iOS testbed, plus Makefile target to invoke it. (gh-115930)

20 months agoGH-116314: Update `Tools/wasm/README.md` to point to the devguide for building for...
Brett Cannon [Thu, 7 Mar 2024 02:38:00 +0000 (18:38 -0800)] 
GH-116314: Update `Tools/wasm/README.md` to point to the devguide for building for WASI (GH-116445)

20 months agogh-116397: Move the _PyGC_ClearAllFreeLists to the safe point (gh-116414)
Donghee Na [Wed, 6 Mar 2024 23:29:39 +0000 (08:29 +0900)] 
gh-116397: Move the _PyGC_ClearAllFreeLists to the safe point (gh-116414)

20 months agogh-109653: Reduce import overhead of uuid module on Linux (#115160)
Shantanu [Wed, 6 Mar 2024 22:39:43 +0000 (14:39 -0800)] 
gh-109653: Reduce import overhead of uuid module on Linux (#115160)

This follows in the footsteps of #21586
This speeds up import uuid by about 6ms on Linux.

Before:
```
λ hyperfine -w 4 "./python -c 'import uuid'"
Benchmark 1: ./python -c 'import uuid'
  Time (mean ± σ):      20.4 ms ±   0.4 ms    [User: 16.7 ms, System: 3.8 ms]
  Range (min … max):    19.6 ms …  21.8 ms    136 runs
```
After:
```
λ hyperfine -w 4 "./python -c 'import uuid'"
Benchmark 1: ./python -c 'import uuid'
  Time (mean ± σ):      14.5 ms ±   0.3 ms    [User: 11.5 ms, System: 3.2 ms]
  Range (min … max):    13.9 ms …  16.0 ms    175 runs
```

20 months agogh-107361: strengthen default SSL context flags (#112389)
William Woodruff [Wed, 6 Mar 2024 21:44:58 +0000 (16:44 -0500)] 
gh-107361: strengthen default SSL context flags (#112389)

This adds `VERIFY_X509_STRICT` to make the default
SSL context perform stricter (per RFC 5280) validation, as well
as `VERIFY_X509_PARTIAL_CHAIN` to enforce more standards-compliant
path-building behavior.

As part of this changeset, I had to tweak `make_ssl_certs.py`
slightly to emit 5280-conforming CA certs. This changeset includes
the regenerated certificates after that change.

Signed-off-by: William Woodruff <william@yossarian.net>
Co-authored-by: Victor Stinner <vstinner@python.org>
20 months agogh-88118: Fix some test_multiprocessing flakiness. (#116434)
Gregory P. Smith [Wed, 6 Mar 2024 21:39:06 +0000 (13:39 -0800)] 
gh-88118: Fix some test_multiprocessing flakiness. (#116434)

Fix some test_multiprocessing flakiness.

Potentially introduced by https://github.com/python/cpython/pull/25845

not joining that thread likely leads to recently observed "environment
changed" logically passing but overall failing tests seen on some
buildbots similar to:

```
1 test altered the execution environment (env changed):
    test.test_multiprocessing_fork.test_processes

2 re-run tests:
    test.test_multiprocessing_fork.test_processes
    test.test_multiprocessing_forkserver.test_processes
```

20 months agogh-114271: Make `_thread.lock` thread-safe in free-threaded builds (#116433)
mpage [Wed, 6 Mar 2024 20:46:36 +0000 (12:46 -0800)] 
gh-114271: Make `_thread.lock` thread-safe in free-threaded builds (#116433)

Previously, the `locked` field was set after releasing the lock. This reverses
the order so that the `locked` field is set while the lock is still held.

There is still one thread-safety issue where `locked` is checked prior to
releasing the lock, however, in practice that will only be an issue when
unlocking the lock is contended, which should be rare.

20 months agogh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009)
Jason Zhang [Wed, 6 Mar 2024 20:20:26 +0000 (20:20 +0000)] 
gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009)

20 months agogh-116381: Specialize CONTAINS_OP (GH-116385)
Ken Jin [Wed, 6 Mar 2024 19:30:11 +0000 (03:30 +0800)] 
gh-116381: Specialize CONTAINS_OP (GH-116385)

* Specialize CONTAINS_OP

* 📜🤖 Added by blurb_it.

* Add PyAPI_FUNC for JIT

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
20 months agogh-115398: Suggest use of `hasattr` with checking for 3.13 Expat API availability...
Sebastian Pipping [Wed, 6 Mar 2024 19:08:25 +0000 (20:08 +0100)] 
gh-115398: Suggest use of `hasattr` with checking for 3.13 Expat API availability (GH-116278)

Suggest use of "hasattr" with checking for 3.13 Expat API availability

20 months agogh-115398: Revert `PyExpat_CAPI_MAGIC` version bump (GH-116411)
Sebastian Pipping [Wed, 6 Mar 2024 17:55:07 +0000 (18:55 +0100)] 
gh-115398: Revert `PyExpat_CAPI_MAGIC` version bump (GH-116411)

Revert "gh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH-116301)"

This reverts part of commit eda2963378a3c292cf6bb202bb00e94e46ee6d90.  Why? this comment buried in an earlier code review explains:

I checked again how that value is used in practice, it's here:

https://github.com/python/cpython/blob/0c80da4c14d904a367968955544dd6ae58c8101c/Modules/_elementtree.c#L4363-L4372

Based on that code my understanding is that loading bigger structs from the future is considered okay unless `PyExpat_CAPI_MAGIC` differs, which implies that (1) magic needs to stay the same to support loading the future from the past and (2) that `PyExpat_CAPI_MAGIC` should only ever change for changes that do not increase size (but keep it constant).

To summarize, that supports your argument.
I checked branches 3.8, 3.9, 3.10, 3.11, 3.12 now and they all have the same comparison code there so reverting that magic string bump will support seamless backporting.

20 months agogh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435)
Sam Gross [Wed, 6 Mar 2024 14:42:11 +0000 (09:42 -0500)] 
gh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435)

This implements the delayed reuse of mimalloc pages that contain Python
objects in the free-threaded build.

Allocations of the same size class are grouped in data structures called
pages. These are different from operating system pages. For thread-safety, we
want to ensure that memory used to store PyObjects remains valid as long as
there may be concurrent lock-free readers; we want to delay using it for
other size classes, in other heaps, or returning it to the operating system.

When a mimalloc page becomes empty, instead of immediately freeing it, we tag
it with a QSBR goal and insert it into a per-thread state linked list of
pages to be freed. When mimalloc needs a fresh page, we process the queue and
free any still empty pages that are now deemed safe to be freed. Pages
waiting to be freed are still available for allocations of the same size
class and allocating from a page prevent it from being freed. There is
additional logic to handle abandoned pages when threads exit.

20 months agogh-116143: Fix race condition in pydoc _start_server (#116144)
Itamar Oren [Wed, 6 Mar 2024 14:39:51 +0000 (06:39 -0800)] 
gh-116143: Fix race condition in pydoc _start_server (#116144)

20 months agogh-107625: configparser: Raise error if a missing value is continued (GH-107651)
Prince Roshan [Wed, 6 Mar 2024 14:05:54 +0000 (19:35 +0530)] 
gh-107625: configparser: Raise error if a missing value is continued (GH-107651)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
20 months agoGH-113710: Tier 2 optimizer: check the function instead of checking globals. (GH...
Mark Shannon [Wed, 6 Mar 2024 13:12:23 +0000 (13:12 +0000)] 
GH-113710: Tier 2 optimizer: check the function instead of checking globals. (GH-116410)

20 months agoGH-115687: Most comparisons create Booleans, so propagate that information (GH-116360)
Mark Shannon [Wed, 6 Mar 2024 10:46:42 +0000 (10:46 +0000)] 
GH-115687: Most comparisons create Booleans, so propagate that information (GH-116360)

Most comparisons create booleans

20 months agogh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)
Victor Stinner [Wed, 6 Mar 2024 09:29:27 +0000 (10:29 +0100)] 
gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)

_PyConfig_AsDict() now returns bool objects for options using the new
PyConfig_MEMBER_BOOL type.

Update tests for these changes.

20 months agogh-116404: Handle errors correctly in `wait_helper` in `posixmodule` (#116405)
Nikita Sobolev [Wed, 6 Mar 2024 08:46:47 +0000 (11:46 +0300)] 
gh-116404: Handle errors correctly in `wait_helper` in `posixmodule` (#116405)

20 months agogh-112087: Update list_get_item_ref to optimistically avoid locking (gh-116353)
Donghee Na [Tue, 5 Mar 2024 23:21:33 +0000 (08:21 +0900)] 
gh-112087: Update list_get_item_ref to optimistically avoid locking (gh-116353)

Co-authored-by: Sam Gross <colesbury@gmail.com>
20 months agogh-116112: Fix `ResourceWarning` in `test_asyncio.test_stream` (#116371)
Nikita Sobolev [Tue, 5 Mar 2024 22:08:18 +0000 (01:08 +0300)] 
gh-116112: Fix `ResourceWarning` in `test_asyncio.test_stream` (#116371)

Co-authored-by: @CendioOssman
20 months agogh-115986: Fix inaccuracies in pprint docs (#116104)
Kerim Kabirov [Tue, 5 Mar 2024 21:14:52 +0000 (22:14 +0100)] 
gh-115986: Fix inaccuracies in pprint docs (#116104)

Amend wording after gh-116019 was merged.

20 months agogh-115103: Enable internal mimalloc assertions in debug builds (#116343)
Sam Gross [Tue, 5 Mar 2024 18:54:20 +0000 (13:54 -0500)] 
gh-115103: Enable internal mimalloc assertions in debug builds (#116343)

This sets `MI_DEBUG` to `2` in debug builds to enable `mi_assert_internal()`
calls. Expensive internal assertions are not enabled.

This also disables an assertion in free-threaded builds that would be
triggered by the free-threaded GC because we traverse heaps that are not
owned by the current thread.

20 months agogh-76785: Use PRId64 to Fix a Compiler Warning on Windows (gh-116369)
Eric Snow [Tue, 5 Mar 2024 18:51:04 +0000 (11:51 -0700)] 
gh-76785: Use PRId64 to Fix a Compiler Warning on Windows (gh-116369)

I accidentally introduced the warning in gh-116328.

20 months agogh-109653: Just import `recursive_repr` in `dataclasses` (gh-109822)
Nikita Sobolev [Tue, 5 Mar 2024 18:12:00 +0000 (21:12 +0300)] 
gh-109653: Just import `recursive_repr` in `dataclasses` (gh-109822)

20 months agoFix debug output for optimized executor (#116337)
Guido van Rossum [Tue, 5 Mar 2024 18:05:29 +0000 (10:05 -0800)] 
Fix debug output for optimized executor (#116337)

This adjusts `length` rather than using `length+1`
all over the place.

20 months agochore: fix typos (#116345)
cui fliter [Tue, 5 Mar 2024 16:05:52 +0000 (00:05 +0800)] 
chore: fix typos (#116345)

Signed-off-by: cui fliter <imcusg@gmail.com>
20 months agogh-76785: Minor Improvements to "interpreters" Module (gh-116328)
Eric Snow [Tue, 5 Mar 2024 15:54:46 +0000 (08:54 -0700)] 
gh-76785: Minor Improvements to "interpreters" Module (gh-116328)

This includes adding pickle support to various classes, and small changes to improve the maintainability of the low-level _xxinterpqueues module.

20 months agogh-74668: Fix support of bytes in urllib.parse.parse_qsl() (GH-115771)
Serhiy Storchaka [Tue, 5 Mar 2024 15:49:50 +0000 (17:49 +0200)] 
gh-74668: Fix support of bytes in urllib.parse.parse_qsl() (GH-115771)

urllib.parse functions parse_qs() and parse_qsl() now support bytes
arguments containing raw and percent-encoded non-ASCII data.