]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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.

20 months agogh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset...
Serhiy Storchaka [Tue, 5 Mar 2024 15:49:01 +0000 (17:49 +0200)] 
gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125)

20 months agoFix the PyGetSetDef documentation (GH-116056)
Serhiy Storchaka [Tue, 5 Mar 2024 15:48:20 +0000 (17:48 +0200)] 
Fix the PyGetSetDef documentation (GH-116056)

closure is not a function pointer, it is a user data pointer.

20 months agogh-115777: Fix double versionadded directives (GH-116269)
Serhiy Storchaka [Tue, 5 Mar 2024 15:41:53 +0000 (17:41 +0200)] 
gh-115777: Fix double versionadded directives (GH-116269)

20 months agoGH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)
Mark Shannon [Tue, 5 Mar 2024 15:23:08 +0000 (15:23 +0000)] 
GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)

20 months agoGH-115819: Eliminate Boolean guards when value is known (GH-116355)
Mark Shannon [Tue, 5 Mar 2024 15:06:00 +0000 (15:06 +0000)] 
GH-115819: Eliminate Boolean guards when value is known (GH-116355)

20 months agogh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` (#116339)
Nikita Sobolev [Tue, 5 Mar 2024 12:31:04 +0000 (15:31 +0300)] 
gh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` (#116339)

20 months agoGH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. (GH-116311)
Mark Shannon [Tue, 5 Mar 2024 11:23:46 +0000 (11:23 +0000)] 
GH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. (GH-116311)

20 months agogh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty...
Nikita Sobolev [Tue, 5 Mar 2024 09:14:18 +0000 (12:14 +0300)] 
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (#116341)

20 months agogh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336)
Dino Viehland [Tue, 5 Mar 2024 09:08:18 +0000 (01:08 -0800)] 
gh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336)

20 months agoGH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives...
Brett Cannon [Tue, 5 Mar 2024 08:18:53 +0000 (00:18 -0800)] 
GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives (#116327)

* GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives

* Add the configure changes

* Update `wasm_build.py`

20 months agogh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (gh-116233)
Donghee Na [Tue, 5 Mar 2024 04:58:14 +0000 (13:58 +0900)] 
gh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (gh-116233)

20 months agogh-116029: Fix unused function warning on macOS (#116340)
Sam Gross [Tue, 5 Mar 2024 03:06:21 +0000 (22:06 -0500)] 
gh-116029: Fix unused function warning on macOS (#116340)

20 months agogh-116265: Remove obsolete sentence. (#116284)
Terry Jan Reedy [Mon, 4 Mar 2024 21:49:42 +0000 (16:49 -0500)] 
gh-116265: Remove obsolete sentence. (#116284)

Remove sentence in Tools/c-analyzer/README referring to deleted
ignore-globals.txt.

20 months agogh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reload...
Eric Snow [Mon, 4 Mar 2024 20:59:30 +0000 (13:59 -0700)] 
gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly (gh-115493)

The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.

20 months agogh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (#115321)
Nikita Sobolev [Mon, 4 Mar 2024 20:03:59 +0000 (23:03 +0300)] 
gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (#115321)

20 months agogh-76785: Simplify Channels XID Types (gh-116318)
Eric Snow [Mon, 4 Mar 2024 19:32:39 +0000 (12:32 -0700)] 
gh-76785: Simplify Channels XID Types (gh-116318)

I had added an extra cleanup abstraction a while back that has turned out to be unnecessary.

20 months agoGH-116134: JIT aarch64-pc-windows-msvc (GH-116130)
Brandt Bucher [Mon, 4 Mar 2024 18:16:56 +0000 (10:16 -0800)] 
GH-116134: JIT aarch64-pc-windows-msvc (GH-116130)

20 months agoGH-115802: Don't JIT zero-length jumps (GH-116177)
Brandt Bucher [Mon, 4 Mar 2024 18:13:10 +0000 (10:13 -0800)] 
GH-115802: Don't JIT zero-length jumps (GH-116177)

20 months agogh-116316: Fix typo in `UNARY_FUNC(PyNumber_Positive)` macros (GH-116317)
Kirill Podoprigora [Mon, 4 Mar 2024 17:57:01 +0000 (19:57 +0200)] 
gh-116316: Fix typo in `UNARY_FUNC(PyNumber_Positive)` macros (GH-116317)

20 months agogh-57141: Add dircmp shallow option (GH-109499)
Tobias Rautenkranz [Mon, 4 Mar 2024 17:27:43 +0000 (18:27 +0100)] 
gh-57141: Add dircmp shallow option (GH-109499)

Co-authored-by: Steve Ward <planet36@gmail.com>
Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
20 months agogh-108562: Revert enabling -fstrict-overflow for libmpdec (GH-116302)
Sergey B Kirpichev [Mon, 4 Mar 2024 17:07:24 +0000 (20:07 +0300)] 
gh-108562: Revert enabling -fstrict-overflow for libmpdec (GH-116302)

gh-108562: partial reversion of pr114751

Reverts -fstrict-overflow for libmpdec

20 months agogh-116116: Backport blake2 change to fix building with clang-cl on windows-i686 ...
Yuriy Chernyshov [Mon, 4 Mar 2024 16:59:57 +0000 (17:59 +0100)] 
gh-116116: Backport blake2 change to fix building with clang-cl on windows-i686 (GH-116117)

20 months agogh-115832: Fix instrumentation version mismatch during interpreter shutdown (#115856)
Brett Simmers [Mon, 4 Mar 2024 16:29:39 +0000 (08:29 -0800)] 
gh-115832: Fix instrumentation version mismatch during interpreter shutdown (#115856)

A previous commit introduced a bug to `interpreter_clear()`: it set
`interp->ceval.instrumentation_version` to 0, without making the corresponding
change to `tstate->eval_breaker` (which holds a thread-local copy of the
version). After this happens, Python code can still run due to object finalizers
during a GC, and the version check in bytecodes.c will see a different result
than the one in instrumentation.c causing an infinite loop.

The fix itself is straightforward: clear `tstate->eval_breaker` when clearing
`interp->ceval.instrumentation_version`.

20 months agoConsistently spell out *predicate* instead of *pred*. (gh-116308)
Raymond Hettinger [Mon, 4 Mar 2024 15:51:29 +0000 (09:51 -0600)] 
Consistently spell out *predicate* instead of *pred*. (gh-116308)

20 months agogh-115256: Remove refcycles from tarfile writing (GH-115257)
pan324 [Mon, 4 Mar 2024 13:26:32 +0000 (14:26 +0100)] 
gh-115256: Remove refcycles from tarfile writing (GH-115257)

20 months agogh-114258: Argument Clinic: refactor getset implementation (#116170)
Erlend E. Aasland [Mon, 4 Mar 2024 12:51:28 +0000 (13:51 +0100)] 
gh-114258: Argument Clinic: refactor getset implementation (#116170)

* Move param guard to param state machine
* Override return converter during parsing
* Don't use a custom type slot return converter; instead
  special case type slot functions during generation.

20 months agoGH-116271 Docs: provide clarification for object assignments in the Tutorial section...
Kerim Kabirov [Mon, 4 Mar 2024 12:22:13 +0000 (13:22 +0100)] 
GH-116271 Docs: provide clarification for object assignments in the Tutorial section (#116283)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH...
Gregory P. Smith [Mon, 4 Mar 2024 10:36:27 +0000 (02:36 -0800)] 
gh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH-116301)

* Increment PyExpat_CAPI_MAGIC due to SetReparseDeferralEnabled addition.

This is a followup to git commit
6a95676bb526261434dd068d6c49927c44d24a9b from Github PR #115623.

* RESTify news API list.

20 months agogh-116296: Fix refleak in reduce_newobj() corner case (#116297)
Erlend E. Aasland [Mon, 4 Mar 2024 09:46:18 +0000 (10:46 +0100)] 
gh-116296: Fix refleak in reduce_newobj() corner case (#116297)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
20 months agopathlib ABCs: follow all symlinks in `PathBase.glob()` (#116293)
Barney Gale [Mon, 4 Mar 2024 02:26:33 +0000 (02:26 +0000)] 
pathlib ABCs: follow all symlinks in `PathBase.glob()` (#116293)

Switch the default value of *follow_symlinks* from `None` to `True` in
`pathlib._abc.PathBase.glob()` and `rglob()`. This speeds up recursive
globbing.

No change to the public pathlib classes.

20 months agogh-116010: Remove link to deprecated PEP 6 in FAQ guide (#116246)
Iman Tabrizian [Sun, 3 Mar 2024 19:50:18 +0000 (23:20 +0330)] 
gh-116010: Remove link to deprecated PEP 6 in FAQ guide (#116246)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282)
HarryLHW [Sun, 3 Mar 2024 19:32:32 +0000 (03:32 +0800)] 
gh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282)

20 months agoDocs: update using/configure.rst (#116274)
Hugo van Kemenade [Sun, 3 Mar 2024 15:40:02 +0000 (17:40 +0200)] 
Docs: update using/configure.rst (#116274)

20 months agogh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)
Serhiy Storchaka [Sun, 3 Mar 2024 07:42:08 +0000 (09:42 +0200)] 
gh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)

Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.

20 months agogh-108562: Fix compiler warnings for libmpdec (#114751)
Sergey B Kirpichev [Sun, 3 Mar 2024 07:25:39 +0000 (10:25 +0300)] 
gh-108562: Fix compiler warnings for libmpdec (#114751)

If awailable, enable -fstrict-overflow for libmpdec. Also
shut off false positive warnings (-Warray-bounds).

The later was backported from mpdecimal-4.0.0.

20 months agogh-72971: Clarify the special no-TypeError behavior for equality (#110729)
Gouvernathor [Sun, 3 Mar 2024 00:45:48 +0000 (01:45 +0100)] 
gh-72971: Clarify the special no-TypeError behavior for equality (#110729)

20 months agogh-115103: Update gc.collect to process delayed objects (gh-116251)
Donghee Na [Sat, 2 Mar 2024 22:04:29 +0000 (07:04 +0900)] 
gh-115103: Update gc.collect to process delayed objects (gh-116251)

* Revert "gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)"

This reverts commit 2e91578a76d38fa8895fce95e2661618c3de892c.

* gh-115103: Update gc.collect to process delayed objects

20 months agogh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)
Donghee Na [Sat, 2 Mar 2024 21:44:16 +0000 (06:44 +0900)] 
gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)

20 months agogh-85644: webbrowser: Use $XDG_CURRENT_DESKTOP to check desktop (GH-21731)
Marco Trevisan [Sat, 2 Mar 2024 12:48:24 +0000 (13:48 +0100)] 
gh-85644: webbrowser: Use $XDG_CURRENT_DESKTOP to check desktop (GH-21731)

Usage of $GNOME_DESKTOP_SESSION_ID env variable is deprecated since
GNOME 3.30.0 [1], so should not be used, while the standard
XDG_CURRENT_DESKTOP should be instead preferred.

[1] https://gitlab.gnome.org/GNOME/gnome-session/-/commit/00e0e6226371d53f65

20 months agoGH-115978: Disable `*readv()` and `*writev()` on WASI (GH-116228)
Brett Cannon [Sat, 2 Mar 2024 00:52:12 +0000 (16:52 -0800)] 
GH-115978: Disable `*readv()` and `*writev()` on WASI (GH-116228)

Wasmtime doesn't implement these functions in a way to pass test_posix (https://github.com/bytecodealliance/wasmtime/issues/7830).

20 months agogh-116102: Silence a Compiler Warning in _xxinterpqueues (gh-116230)
Eric Snow [Sat, 2 Mar 2024 00:28:05 +0000 (17:28 -0700)] 
gh-116102: Silence a Compiler Warning in _xxinterpqueues (gh-116230)

20 months agogh-112087: Use QSBR technique for list_new/clear for free-thread build (gh-115875)
Donghee Na [Fri, 1 Mar 2024 23:30:35 +0000 (08:30 +0900)] 
gh-112087: Use QSBR technique for list_new/clear for free-thread build (gh-115875)

20 months agoGH-116226: include `pthread_stubs.h` in `pycore_pythreads.h` (#116227)
Brett Cannon [Fri, 1 Mar 2024 23:22:31 +0000 (15:22 -0800)] 
GH-116226: include `pthread_stubs.h` in `pycore_pythreads.h` (#116227)

20 months agogh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds (GH-115190)
mpage [Fri, 1 Mar 2024 21:43:12 +0000 (13:43 -0800)] 
gh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds (GH-115190)

Make `_thread.ThreadHandle` thread-safe in free-threaded builds

We protect the mutable state of `ThreadHandle` using a `_PyOnceFlag`.
Concurrent operations (i.e. `join` or `detach`) on `ThreadHandle` block
until it is their turn to execute or an earlier operation succeeds.
Once an operation has been applied successfully all future operations
complete immediately.

The `join()` method is now idempotent. It may be called multiple times
but the underlying OS thread will only be joined once. After `join()`
succeeds, any future calls to `join()` will succeed immediately.

The internal thread handle `detach()` method has been removed.