]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
19 months agogh-105866: fix dataclass with slots=True, weakref_slot=True (#105870)
Aviel Boag [Tue, 19 Mar 2024 00:53:14 +0000 (02:53 +0200)] 
gh-105866: fix dataclass with slots=True, weakref_slot=True (#105870)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Carl Meyer <carl@oddbird.net>
19 months agogh-116869: Enable test_cext and test_cppext on Free Threading build (#116973)
Victor Stinner [Mon, 18 Mar 2024 23:14:29 +0000 (00:14 +0100)] 
gh-116869: Enable test_cext and test_cppext on Free Threading build (#116973)

Remove the "if Py_GIL_DISABLED" skip and move all "skip" decorators
to the class. Use support.check_sanitizer()

19 months agogh-116417: Fix WASI build of _testlimitedcapi (#116974)
Victor Stinner [Mon, 18 Mar 2024 22:06:52 +0000 (23:06 +0100)] 
gh-116417: Fix WASI build of _testlimitedcapi (#116974)

Use different function names between _testcapi and _testlimitedcapi
to not confuse the WASI linker.

19 months agogh-116941: Fix pyatomic_std.h syntax errors (#116967)
Sam Gross [Mon, 18 Mar 2024 21:05:43 +0000 (17:05 -0400)] 
gh-116941: Fix pyatomic_std.h syntax errors (#116967)

19 months ago gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602)
Victor Stinner [Mon, 18 Mar 2024 21:03:55 +0000 (22:03 +0100)] 
  gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602)

Split list.c and set.c tests of _testcapi into two parts: limited C
API tests in _testlimitedcapi and non-limited C API tests in
_testcapi.

19 months agogh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)
Pierre Ossman (ThinLinc team) [Mon, 18 Mar 2024 20:15:53 +0000 (21:15 +0100)] 
gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)

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.

This is a do-over with a test fix for gh-114432, which was reverted.

19 months agogh-116869: Make C API compatible with ISO C90 (#116950)
Victor Stinner [Mon, 18 Mar 2024 19:16:58 +0000 (20:16 +0100)] 
gh-116869: Make C API compatible with ISO C90 (#116950)

Make the C API compatible with -Werror=declaration-after-statement
compiler flag again.

19 months agogh-116869: Add test_cext test: build a C extension (#116954)
Victor Stinner [Mon, 18 Mar 2024 19:15:20 +0000 (20:15 +0100)] 
gh-116869: Add test_cext test: build a C extension (#116954)

19 months agogh-108716: Cleanup remaining deepfreeze infrastructure (#116919)
Guido van Rossum [Mon, 18 Mar 2024 18:13:11 +0000 (11:13 -0700)] 
gh-108716: Cleanup remaining deepfreeze infrastructure (#116919)

Keep Tools/build/deepfreeze.py around (we may repurpose it for deepfreezing non-code objects),
and keep basic "clean" targets that remove the output of former deep-freeze activities,
to keep the build directories of current devs clean.

19 months agogh-116916: Remove separate next_func_version counter (#116918)
Guido van Rossum [Mon, 18 Mar 2024 18:11:10 +0000 (11:11 -0700)] 
gh-116916: Remove separate next_func_version counter (#116918)

Somehow we ended up with two separate counter variables tracking "the next function version".
Most likely this was a historical accident where an old branch was updated incorrectly.
This PR merges the two counters into a single one: `interp->func_state.next_version`.

19 months agoCleanup tier2 debug output (#116920)
Guido van Rossum [Mon, 18 Mar 2024 18:08:43 +0000 (11:08 -0700)] 
Cleanup tier2 debug output (#116920)

Various tweaks, including a slight refactor of the special cases for `_PUSH_FRAME`/`_POP_FRAME` to show the actual operand emitted.

19 months agogh-115119: Switch Windows build to mpdecimal external (GH-115182)
Zachary Ware [Mon, 18 Mar 2024 17:07:25 +0000 (12:07 -0500)] 
gh-115119: Switch Windows build to mpdecimal external (GH-115182)

This includes adding what should be a relatively temporary
`Modules/_decimal/windows/mpdecimal.h` shim to choose between `mpdecimal32vc.h`
or `mpdecimal64vc.h` based on which of `CONFIG_64` or `CONFIG_32` is defined.

19 months agogh-115258: Fix hanging tests for threading queue shutdown (#115940)
Duprat [Mon, 18 Mar 2024 16:15:29 +0000 (17:15 +0100)] 
gh-115258: Fix hanging tests for threading queue shutdown (#115940)

This reinstates `test_shutdown_immediate_all_methods_in_many_threads`
and improves `test_shutdown_all_methods_in_many_threads`.

19 months agogh-116869: Fix redefinition of the _PyOptimizerObject type (#116963)
Victor Stinner [Mon, 18 Mar 2024 16:14:42 +0000 (17:14 +0100)] 
gh-116869: Fix redefinition of the _PyOptimizerObject type (#116963)

Defining a type twice is a C11 feature and so makes the C API
incompatible with C99. Fix the issue by only defining the type once.

Example of warning (treated as an error):

    In file included from Include/Python.h:122:
    Include/cpython/optimizer.h:77:3: error: redefinition of typedef
    '_PyOptimizerObject' is a C11 feature [-Werror,-Wtypedef-redefinition]
    } _PyOptimizerObject;
    ^
    build/Include/cpython/optimizer.h:60:35: note: previous definition is here
    typedef struct _PyOptimizerObject _PyOptimizerObject;
                                    ^

19 months agogh-63207: Use GetSystemTimePreciseAsFileTime() in time.time() (#116822)
Victor Stinner [Mon, 18 Mar 2024 16:13:01 +0000 (17:13 +0100)] 
gh-63207: Use GetSystemTimePreciseAsFileTime() in time.time() (#116822)

19 months agogh-116877: Update `wheel` to version `0.43.0` (#116878)
Sam Gross [Mon, 18 Mar 2024 15:50:32 +0000 (11:50 -0400)] 
gh-116877: Update `wheel` to version `0.43.0` (#116878)

19 months agogh-71765: Fix inspect.getsource() on empty file (GH-20809)
kernc [Mon, 18 Mar 2024 15:13:02 +0000 (16:13 +0100)] 
gh-71765: Fix inspect.getsource() on empty file (GH-20809)

* bpo-27578: Fix inspect.getsource() on empty file

For modules from empty files, `inspect.getsource()` now
returns an empty string, and `inspect.getsourcelines()` returns
a list of one empty string, fixing the expected invariant.

As indicated by `exec('')`, empty strings are valid Python
source code.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
19 months agoRevert "gh-96844: Improve error message of list.remove (gh-106455)" (#116956)
Victor Stinner [Mon, 18 Mar 2024 13:54:45 +0000 (14:54 +0100)] 
Revert "gh-96844: Improve error message of list.remove (gh-106455)" (#116956)

This reverts commit 217f47d6e5e56bca78b8556e910cd00890f6f84a.

19 months agoGH-65056: Improve the IP address' is_global/is_private documentation (GH-113186)
Jakub Stasiak [Mon, 18 Mar 2024 12:57:00 +0000 (13:57 +0100)] 
GH-65056: Improve the IP address' is_global/is_private documentation (GH-113186)

* GH-65056: Improve the IP address' is_global/is_private documentation

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

Co-authored-by: Petr Viktorin <encukou@gmail.com>
19 months agogh-115874: Don't use module state in teedataobject tp_dealloc (#116204)
Erlend E. Aasland [Mon, 18 Mar 2024 12:24:24 +0000 (13:24 +0100)] 
gh-115874: Don't use module state in teedataobject tp_dealloc (#116204)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
19 months agogh-115538: Emit warning when use bool as fd in _io.WindowsConsoleIO (GH-116925)
AN Long [Mon, 18 Mar 2024 11:48:50 +0000 (19:48 +0800)] 
gh-115538: Emit warning when use bool as fd in _io.WindowsConsoleIO (GH-116925)

19 months agoCI: Pass environment variables directly to configure in JIT CI (#116156)
Erlend E. Aasland [Mon, 18 Mar 2024 09:49:45 +0000 (10:49 +0100)] 
CI: Pass environment variables directly to configure in JIT CI (#116156)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
19 months agogh-116664: Ensure thread-safe dict access in _warnings (#116768)
Erlend E. Aasland [Mon, 18 Mar 2024 09:37:48 +0000 (10:37 +0100)] 
gh-116664: Ensure thread-safe dict access in _warnings (#116768)

Replace _PyDict_GetItemWithError() with PyDict_GetItemRef().

19 months agogh-116881: Remove erroneous or redundant grammar NULL (GH-116885)
Terry Jan Reedy [Mon, 18 Mar 2024 09:31:13 +0000 (05:31 -0400)] 
gh-116881: Remove erroneous or redundant grammar NULL (GH-116885)

In Lexical Analysis f-strings section, NULL in the description
of 'literal character' means '\0'.  In the format_spec grammar
production, it is wrong with that meaning and redundant if
instead interpreted as <nothing>.  Remove it there.

19 months agoBump GitHub Actions (#116944)
Hugo van Kemenade [Mon, 18 Mar 2024 08:44:15 +0000 (10:44 +0200)] 
Bump GitHub Actions (#116944)

19 months agogh-116915: Make `_thread._ThreadHandle` support GC (#116934)
mpage [Mon, 18 Mar 2024 08:40:16 +0000 (01:40 -0700)] 
gh-116915: Make `_thread._ThreadHandle` support GC (#116934)

Even though it has no internal references to Python objects it still
has a reference to its type by virtue of being a heap type. We need
to provide a traverse function that visits the type, but we do not
need to provide a clear function.

19 months agogh-85283: Build _statistics extension with the limited C API (#116927)
Victor Stinner [Sun, 17 Mar 2024 17:59:02 +0000 (18:59 +0100)] 
gh-85283: Build _statistics extension with the limited C API (#116927)

Argument Clinic now inlines _PyArg_CheckPositional() for the limited
C API. The generated code should be as fast or even a little bit
faster.

19 months agoGH-116377: Stop raising `ValueError` from `glob.translate()`. (#116378)
Barney Gale [Sun, 17 Mar 2024 17:09:35 +0000 (17:09 +0000)] 
GH-116377: Stop raising `ValueError` from `glob.translate()`. (#116378)

Stop raising `ValueError` from `glob.translate()` when a `**` sub-string
appears in a non-recursive pattern segment. This matches `glob.glob()`
behaviour.

19 months agogh-85283: Build termios extension with the limited C API (#116928)
Victor Stinner [Sun, 17 Mar 2024 15:12:29 +0000 (16:12 +0100)] 
gh-85283: Build termios extension with the limited C API (#116928)

19 months agogh-73468: Add math.fma() function (#116667)
Victor Stinner [Sun, 17 Mar 2024 13:58:26 +0000 (14:58 +0100)] 
gh-73468: Add math.fma() function (#116667)

Added new math.fma() function, wrapping C99's ``fma()`` operation:
fused multiply-add function.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
19 months agoGH-112536: Add more TSan tests (#116911)
Antoine Pitrou [Sun, 17 Mar 2024 08:47:14 +0000 (09:47 +0100)] 
GH-112536: Add more TSan tests (#116911)

These may all exercise some non-trivial aspects of thread synchronization.

19 months agogh-85287: Change codecs to raise precise UnicodeEncodeError and UnicodeDecodeError...
John Sloboda [Sun, 17 Mar 2024 04:58:42 +0000 (00:58 -0400)] 
gh-85287: Change codecs to raise precise UnicodeEncodeError and UnicodeDecodeError (#113674)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
19 months agoUpdate titles and subtitles on landing page template (#116914)
Carol Willing [Sun, 17 Mar 2024 00:01:56 +0000 (17:01 -0700)] 
Update titles and subtitles on landing page template (#116914)

* Update titles and subtitles on landing page template

* address review from gvanrossum

* Edits from hugovk review

* Change word order back. Down the road we should split license and history

19 months agogh-116809: Restore removed _PyErr_ChainExceptions1() function (#116900)
Victor Stinner [Sat, 16 Mar 2024 20:37:11 +0000 (21:37 +0100)] 
gh-116809: Restore removed _PyErr_ChainExceptions1() function (#116900)

19 months agoCI: Process stale issues four times per day (#116857)
Hugo van Kemenade [Sat, 16 Mar 2024 17:59:42 +0000 (19:59 +0200)] 
CI: Process stale issues four times per day (#116857)

19 months agogh-116879: Add new optimizer pystats to tables (GH-116880)
Michael Droettboom [Sat, 16 Mar 2024 15:10:43 +0000 (11:10 -0400)] 
gh-116879: Add new optimizer pystats to tables (GH-116880)

19 months agogh-112536: Add more TSAN tests (#116896)
Donghee Na [Sat, 16 Mar 2024 14:52:44 +0000 (23:52 +0900)] 
gh-112536: Add more TSAN tests (#116896)

---------

Co-authored-by: Antoine Pitrou <antoine@python.org>
19 months agogh-116851: Remove "from ctypes import *" from a ctypes example (GH-116852)
jnchen [Sat, 16 Mar 2024 13:01:45 +0000 (21:01 +0800)] 
gh-116851: Remove "from ctypes import *" from a ctypes example (GH-116852)

It is confusing, because libc is not imported from ctypes,
but defined in previous examples, which already contain the import.

19 months agogh-114271: Fix race in `Thread.join()` (#114839)
mpage [Sat, 16 Mar 2024 12:56:30 +0000 (05:56 -0700)] 
gh-114271: Fix race in `Thread.join()` (#114839)

There is a race between when `Thread._tstate_lock` is released[^1] in `Thread._wait_for_tstate_lock()`
and when `Thread._stop()` asserts[^2] that it is unlocked. Consider the following execution
involving threads A, B, and C:

1. A starts.
2. B joins A, blocking on its `_tstate_lock`.
3. C joins A, blocking on its `_tstate_lock`.
4. A finishes and releases its `_tstate_lock`.
5. B acquires A's `_tstate_lock` in `_wait_for_tstate_lock()`, releases it, but is swapped
   out before calling `_stop()`.
6. C is scheduled, acquires A's `_tstate_lock` in `_wait_for_tstate_lock()` but is swapped
   out before releasing it.
7. B is scheduled, calls `_stop()`, which asserts that A's `_tstate_lock` is not held.
   However, C holds it, so the assertion fails.

The race can be reproduced[^3] by inserting sleeps at the appropriate points in
the threading code. To do so, run the `repro_join_race.py` from the linked repo.

There are two main parts to this PR:

1. `_tstate_lock` is replaced with an event that is attached to `PyThreadState`.
   The event is set by the runtime prior to the thread being cleared (in the same
   place that `_tstate_lock` was released). `Thread.join()` blocks waiting for the
   event to be set.
2. `_PyInterpreterState_WaitForThreads()` provides the ability to wait for all
   non-daemon threads to exit. To do so, an `is_daemon` predicate was added to
   `PyThreadState`. This field is set each time a thread is created. `threading._shutdown()`
   now calls into `_PyInterpreterState_WaitForThreads()` instead of waiting on
   `_tstate_lock`s.

[^1]: https://github.com/python/cpython/blob/441affc9e7f419ef0b68f734505fa2f79fe653c7/Lib/threading.py#L1201
[^2]: https://github.com/python/cpython/blob/441affc9e7f419ef0b68f734505fa2f79fe653c7/Lib/threading.py#L1115
[^3]: https://github.com/mpage/cpython/commit/81946532792f938cd6f6ab4c4ff92a4edf61314f

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
19 months agogh-112536: Add test_threading to TSAN tests (#116898)
Antoine Pitrou [Sat, 16 Mar 2024 11:55:46 +0000 (12:55 +0100)] 
gh-112536: Add test_threading to TSAN tests (#116898)

19 months agogh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names ...
Serhiy Storchaka [Sat, 16 Mar 2024 11:31:19 +0000 (13:31 +0200)] 
gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names (GH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.

19 months agogh-116764: Fix regressions in urllib.parse.parse_qsl() (GH-116801)
Serhiy Storchaka [Sat, 16 Mar 2024 10:36:05 +0000 (12:36 +0200)] 
gh-116764: Fix regressions in urllib.parse.parse_qsl() (GH-116801)

* Restore support of None and other false values.
* Raise TypeError for non-zero integers and non-empty sequences.

The regressions were introduced in gh-74668
(bdba8ef42b15e651dc23374a08143cc2b4c4657d).

19 months agogh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220)
Serhiy Storchaka [Sat, 16 Mar 2024 10:29:42 +0000 (12:29 +0200)] 
gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.

19 months agogh-112536: Add TSAN builds on Github Actions (#116872)
Donghee Na [Sat, 16 Mar 2024 10:10:37 +0000 (19:10 +0900)] 
gh-112536: Add TSAN builds on Github Actions (#116872)

19 months agogh-116858: Add `@cpython_only` to several tests in `test_cmd_line` (#116859)
Nikita Sobolev [Sat, 16 Mar 2024 08:54:42 +0000 (11:54 +0300)] 
gh-116858: Add `@cpython_only` to several tests in `test_cmd_line` (#116859)

19 months agoMinor kde() docstring nit: make presentation order match the function signature ...
Raymond Hettinger [Fri, 15 Mar 2024 19:02:10 +0000 (14:02 -0500)] 
Minor kde() docstring nit: make presentation order match the function signature (#116876)

19 months agoGH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (GH-116856)
Mark Shannon [Fri, 15 Mar 2024 17:16:30 +0000 (17:16 +0000)] 
GH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (GH-116856)

19 months agogh-116868: Avoid locking in PyType_IsSubtype (#116829)
Dino Viehland [Fri, 15 Mar 2024 16:35:29 +0000 (12:35 -0400)] 
gh-116868: Avoid locking in PyType_IsSubtype (#116829)

Make PyType_IsSubType not acquire lock

19 months agogh-112536: Add --tsan test for reasonable TSAN execution times. (gh-116601)
Donghee Na [Fri, 15 Mar 2024 16:07:16 +0000 (01:07 +0900)] 
gh-112536: Add --tsan test for reasonable TSAN execution times. (gh-116601)

19 months agogh-116782: Mention `__type_params__` in `inspect.getmembers` docs (#116783)
Nikita Sobolev [Fri, 15 Mar 2024 15:47:46 +0000 (18:47 +0300)] 
gh-116782: Mention `__type_params__` in `inspect.getmembers` docs (#116783)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
19 months agogh-116621: Specialize list.extend for dict keys/values (gh-116816)
Donghee Na [Fri, 15 Mar 2024 14:48:34 +0000 (23:48 +0900)] 
gh-116621: Specialize list.extend for dict keys/values (gh-116816)

19 months agogh-116735: Use `MISSING` for `CALL` event if argument is absent (GH-116737)
Tian Gao [Fri, 15 Mar 2024 14:46:18 +0000 (07:46 -0700)] 
gh-116735: Use `MISSING` for `CALL` event if argument is absent (GH-116737)

19 months agogh-63283: IDNA prefix should be case insensitive (GH-17726)
Zackery Spytz [Fri, 15 Mar 2024 14:38:13 +0000 (07:38 -0700)] 
gh-63283: IDNA prefix should be case insensitive (GH-17726)

Any capitalization of "xn--" should be acceptable for the ACE prefix
(see https://tools.ietf.org/html/rfc3490#section-5).

Co-authored-by: Pepijn de Vos <pepijndevos@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
19 months agogh-111926: Simplify proxy creation logic (#116844)
mpage [Fri, 15 Mar 2024 13:58:40 +0000 (06:58 -0700)] 
gh-111926: Simplify proxy creation logic (#116844)

Since 3.12, allocating a GC-able object cannot trigger GC. This allows
us to simplify the logic for creating the canonical callback-less
proxy object.

19 months agogh-111926: Simplify weakref creation logic (#116843)
mpage [Fri, 15 Mar 2024 13:56:13 +0000 (06:56 -0700)] 
gh-111926: Simplify weakref creation logic (#116843)

Since 3.12, allocating a GC object cannot immediately trigger GC. This
allows us to simplify the logic for creating the canonical callback-less
weakref.

19 months agoGH-116422: Modify a few uops so that they can be supported by tier 2 with hot/cold...
Mark Shannon [Fri, 15 Mar 2024 10:48:00 +0000 (10:48 +0000)] 
GH-116422: Modify a few uops so that they can be supported by tier 2 with hot/cold splitting (GH-116832)

19 months agogh-90095: Ignore empty lines and comments in `.pdbrc` (#116834)
Tian Gao [Fri, 15 Mar 2024 09:36:04 +0000 (02:36 -0700)] 
gh-90095: Ignore empty lines and comments in `.pdbrc` (#116834)

19 months agogh-85283: Build pwd extension with the limited C API (#116841)
Victor Stinner [Fri, 15 Mar 2024 07:49:58 +0000 (08:49 +0100)] 
gh-85283: Build pwd extension with the limited C API (#116841)

Argument Clinic now uses the PEP 737 "%T" format to format type name
for the limited C API.

19 months agogh-116842: Improve test comment and fix a doctest (gh-116846)
Raymond Hettinger [Fri, 15 Mar 2024 02:40:36 +0000 (21:40 -0500)] 
gh-116842: Improve test comment and fix a doctest (gh-116846)

19 months agoGH-113838: Add "Comparison to os.path" section to pathlib docs (#115926)
Barney Gale [Fri, 15 Mar 2024 00:11:49 +0000 (00:11 +0000)] 
GH-113838: Add "Comparison to os.path" section to pathlib docs (#115926)

19 months agogh-116195: Implements a fast path for nt.getppid (GH-116205)
vxiiduu [Thu, 14 Mar 2024 23:09:36 +0000 (09:09 +1000)] 
gh-116195: Implements a fast path for nt.getppid (GH-116205)

Use the NtQueryInformationProcess system call to efficiently retrieve the parent process ID in a single step, rather than using the process snapshots API which retrieves large amounts of unnecessary information and is more prone to failure (since it makes heap allocations).

Includes a fallback to the original win32_getppid implementation in case the unstable API appears to return strange results.

19 months agogh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839)
Victor Stinner [Thu, 14 Mar 2024 22:23:00 +0000 (23:23 +0100)] 
gh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839)

19 months agogh-116811: Ensure MetadataPathFinder.invalidate_caches is reachable when delegated...
Jason R. Coombs [Thu, 14 Mar 2024 21:59:00 +0000 (17:59 -0400)] 
gh-116811: Ensure MetadataPathFinder.invalidate_caches is reachable when delegated through PathFinder. (#116812)

* Make MetadataPathFinder a proper classmethod.

* In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.

* Add blurb

19 months agogh-106531: Refresh zipfile._path with zipp 3.18. (#116835)
Jason R. Coombs [Thu, 14 Mar 2024 21:53:50 +0000 (17:53 -0400)] 
gh-106531: Refresh zipfile._path with zipp 3.18. (#116835)

* gh-106531: Refresh zipfile._path with zipp 3.18.

* Add blurb

19 months agoMinor improvements to the itertools documentation (gh-116833)
Raymond Hettinger [Thu, 14 Mar 2024 21:39:50 +0000 (16:39 -0500)] 
Minor improvements to the itertools documentation (gh-116833)

19 months agogh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)
Victor Stinner [Thu, 14 Mar 2024 18:17:43 +0000 (19:17 +0100)] 
gh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
19 months agogh-113317, AC: Add libclinic.converter module (#116821)
Victor Stinner [Thu, 14 Mar 2024 17:59:43 +0000 (18:59 +0100)] 
gh-113317, AC: Add libclinic.converter module (#116821)

* Move CConverter class to a new libclinic.converter module.
* Move CRenderData and Include classes to a new libclinic.crenderdata
  module.

19 months agogh-112795: Move the test for ZipFile into the core tests for zipfile. (#116823)
Jason R. Coombs [Thu, 14 Mar 2024 17:50:24 +0000 (13:50 -0400)] 
gh-112795: Move the test for ZipFile into the core tests for zipfile. (#116823)

Move the test for ZipFile into the core tests for zipfile.

19 months agoGH-116422: Factor out eval breaker checks at end of calls into its own micro-op....
Mark Shannon [Thu, 14 Mar 2024 16:31:47 +0000 (16:31 +0000)] 
GH-116422: Factor out eval breaker checks at end of calls into its own micro-op. (GH-116817)

19 months agogh-111696, PEP 737: Add PyType_GetFullyQualifiedName() function (#116815)
Victor Stinner [Thu, 14 Mar 2024 16:19:36 +0000 (17:19 +0100)] 
gh-111696, PEP 737: Add PyType_GetFullyQualifiedName() function (#116815)

Rewrite tests on type names in Python, they were written in C.

19 months agogh-113317, AC: Add libclinic.block_parser module (#116819)
Victor Stinner [Thu, 14 Mar 2024 16:11:39 +0000 (17:11 +0100)] 
gh-113317, AC: Add libclinic.block_parser module (#116819)

* Move Block and BlockParser classes to a new libclinic.block_parser
  module.
* Move Language and PythonLanguage classes to a new
  libclinic.language module.

19 months agogh-116731: libregrtest: Clear inspect & importlib.metadata caches in clear_caches...
Petr Viktorin [Thu, 14 Mar 2024 15:47:12 +0000 (16:47 +0100)] 
gh-116731: libregrtest: Clear inspect & importlib.metadata caches in clear_caches (GH-116805)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
19 months agogh-88494: Use QueryPerformanceCounter() for time.monotonic() (#116781)
Victor Stinner [Thu, 14 Mar 2024 15:42:41 +0000 (16:42 +0100)] 
gh-88494: Use QueryPerformanceCounter() for time.monotonic() (#116781)

On Windows, time.monotonic() now uses the QueryPerformanceCounter()
clock to have a resolution better than 1 us, instead of the
gGetTickCount64() clock which has a resolution of 15.6 ms.

19 months agoCI: Only test free-threading with faster macOS M1 (#116814)
Hugo van Kemenade [Thu, 14 Mar 2024 15:10:56 +0000 (17:10 +0200)] 
CI: Only test free-threading with faster macOS M1 (#116814)

Only test free-threading with faster macOS M1

19 months agogh-113317, AC: Add libclinic.function (#116807)
Victor Stinner [Thu, 14 Mar 2024 14:37:22 +0000 (15:37 +0100)] 
gh-113317, AC: Add libclinic.function (#116807)

Move Module, Class, Function and Parameter classes to a new
libclinic.function module.

Move VersionTuple and Sentinels to libclinic.utils.

19 months agogh-116646, AC: Always use PyObject_AsFileDescriptor() in fildes (#116806)
Victor Stinner [Thu, 14 Mar 2024 13:58:07 +0000 (14:58 +0100)] 
gh-116646, AC: Always use PyObject_AsFileDescriptor() in fildes (#116806)

The fildes converter of Argument Clinic now always call
PyObject_AsFileDescriptor(), not only for the limited C API.

The _PyLong_FileDescriptor_Converter() converter stays as a fallback
when PyObject_AsFileDescriptor() cannot be used.

19 months agogh-116646, AC: Add CConverter.use_converter() method (#116793)
Victor Stinner [Thu, 14 Mar 2024 12:57:02 +0000 (13:57 +0100)] 
gh-116646, AC: Add CConverter.use_converter() method (#116793)

Only add includes when the converter is effectively used.

19 months agogh-85283: Build fcntl extension with the limited C API (#116791)
Victor Stinner [Thu, 14 Mar 2024 12:01:13 +0000 (13:01 +0100)] 
gh-85283: Build fcntl extension with the limited C API (#116791)

19 months agogh-116780: Fix `test_inspect` in `-OO` mode (#116788)
Nikita Sobolev [Thu, 14 Mar 2024 10:16:18 +0000 (13:16 +0300)] 
gh-116780: Fix `test_inspect` in `-OO` mode (#116788)

19 months agogh-90300: Fix undocumented envvars in the Python CLI help (GH-116765)
Serhiy Storchaka [Thu, 14 Mar 2024 10:09:19 +0000 (12:09 +0200)] 
gh-90300: Fix undocumented envvars in the Python CLI help (GH-116765)

19 months agogh-113308: Remove some internal parts of `uuid` module (#115934)
Nikita Sobolev [Thu, 14 Mar 2024 10:01:41 +0000 (13:01 +0300)] 
gh-113308: Remove some internal parts of `uuid` module (#115934)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
19 months agogh-116785: Fix direct invocation of `test_inspect` (#116787)
Nikita Sobolev [Thu, 14 Mar 2024 09:55:54 +0000 (12:55 +0300)] 
gh-116785: Fix direct invocation of `test_inspect` (#116787)

19 months agogh-116646: Add limited C API support to AC fildes converter (#116769)
Victor Stinner [Thu, 14 Mar 2024 09:28:58 +0000 (10:28 +0100)] 
gh-116646: Add limited C API support to AC fildes converter (#116769)

Add tests on the "fildes" converter to _testclinic_limited.

19 months agogh-113317, AC: Move warn() and fail() to libclinic.errors (#116770)
Victor Stinner [Thu, 14 Mar 2024 08:07:01 +0000 (09:07 +0100)] 
gh-113317, AC: Move warn() and fail() to libclinic.errors (#116770)

19 months agoGH-114736: Use WASI SDK 21 (GH-116771)
Brett Cannon [Thu, 14 Mar 2024 01:45:33 +0000 (18:45 -0700)] 
GH-114736: Use WASI SDK 21 (GH-116771)

19 months agoGH-115983: skip building shared modules for testing under WASI (GH-116528)
Brett Cannon [Wed, 13 Mar 2024 23:25:50 +0000 (16:25 -0700)] 
GH-115983: skip building shared modules for testing under WASI (GH-116528)

19 months agoDocs: PyUnstable_Long_IsCompact() docs now mention PyLong_AsNativeBytes() (#116634)
Sergey B Kirpichev [Wed, 13 Mar 2024 23:01:13 +0000 (02:01 +0300)] 
Docs: PyUnstable_Long_IsCompact() docs now mention PyLong_AsNativeBytes() (#116634)

19 months agoDocs: fix spelling of the word 'transferring' (#116641)
guangwu [Wed, 13 Mar 2024 22:53:32 +0000 (06:53 +0800)] 
Docs: fix spelling of the word 'transferring' (#116641)

19 months agogh-116760: Fix pystats for trace attempts (GH-116761)
Michael Droettboom [Wed, 13 Mar 2024 22:13:33 +0000 (18:13 -0400)] 
gh-116760: Fix pystats for trace attempts (GH-116761)

There are now at least two bytecodes that may attempt to optimize,
JUMP_BACK, and more recently, COLD_EXIT.

Only the JUMP_BACK was counting the attempt in the stats.
This moves that counter to uop_optimize itself so it should
always happen no matter where it is called from.

19 months agogh-90300: Document equivalent -X options for envvars in the Python CLI help (GH-116756)
Serhiy Storchaka [Wed, 13 Mar 2024 20:59:16 +0000 (22:59 +0200)] 
gh-90300: Document equivalent -X options for envvars in the Python CLI help (GH-116756)

19 months agoGH-115979: update test_importlib to work under WASI SDK 21 (GH-116754)
Brett Cannon [Wed, 13 Mar 2024 20:24:28 +0000 (13:24 -0700)] 
GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754)

19 months agoBetter presentation order for recipes. (gh-116755)
Raymond Hettinger [Wed, 13 Mar 2024 20:02:56 +0000 (15:02 -0500)] 
Better presentation order for recipes. (gh-116755)

19 months agogh-90300: Sort the -X options and some envvars in the Python CLI help (GH-116739)
Serhiy Storchaka [Wed, 13 Mar 2024 19:15:44 +0000 (21:15 +0200)] 
gh-90300: Sort the -X options and some envvars in the Python CLI help (GH-116739)

19 months agogh-116631: Fix race condition in `test_shutdown_immediate_put_join` (#116670)
Sam Gross [Wed, 13 Mar 2024 18:56:28 +0000 (14:56 -0400)] 
gh-116631: Fix race condition in `test_shutdown_immediate_put_join` (#116670)

The test case had a race condition: if `q.task_done()` was executed
after `shutdown(immediate=True)`, then it would raise an exception
because the immediate shutdown already emptied the queue. This happened
rarely with the GIL (due to the switching interval), but frequently in
the free-threaded build.

19 months agogh-100746: Improve `test_named_expressions.py` (#116713)
Nikita Sobolev [Wed, 13 Mar 2024 18:12:40 +0000 (21:12 +0300)] 
gh-100746: Improve `test_named_expressions.py` (#116713)

19 months agogh-98731: Improvements to the logging documentation (GH-101618)
Nir Friedman [Wed, 13 Mar 2024 15:58:30 +0000 (11:58 -0400)] 
gh-98731: Improvements to the logging documentation (GH-101618)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
19 months agogh-116604: Fix test_gc on free-threaded build (#116662)
Sam Gross [Wed, 13 Mar 2024 13:27:36 +0000 (09:27 -0400)] 
gh-116604: Fix test_gc on free-threaded build (#116662)

The free-threaded GC only does full collections, so it uses a threshold that
is a maximum of a fixed value (default 2000) and proportional to the number of
live objects. If there were many live objects after the previous collection,
then the threshold may be larger than 10,000 causing
`test_indirect_calls_with_gc_disabled` to fail.

This manually sets the threshold to `(1000, 0, 0)` for the test. The `0`
disables the proportional scaling.

19 months ago[doc]: Update cookbook recipe for Qt6. (GH-116719)
Vinay Sajip [Wed, 13 Mar 2024 13:22:47 +0000 (13:22 +0000)] 
[doc]: Update cookbook recipe for Qt6. (GH-116719)

19 months agogh-110918: Fix side effects of regrtest test_match_tests() (#116718)
Victor Stinner [Wed, 13 Mar 2024 13:20:33 +0000 (14:20 +0100)] 
gh-110918: Fix side effects of regrtest test_match_tests() (#116718)

test_match_tests now saves and restores patterns.

Add get_match_tests() function to libregrtest.filter.

Previously, running test_regrtest multiple times in a row only ran
tests once: "./python -m test test_regrtest -R 3:3.

19 months agogh-90300: Fix cmdline.rst (GH-116721)
Serhiy Storchaka [Wed, 13 Mar 2024 13:03:13 +0000 (15:03 +0200)] 
gh-90300: Fix cmdline.rst (GH-116721)

* Fix the description of the "-b" option.
* Add references to environment variables for "-s" and "-X dev" options.