]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
17 months agogh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script...
Steve Dower [Thu, 6 Jun 2024 15:11:42 +0000 (16:11 +0100)] 
gh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script (GH-120133)

17 months agogh-120111: Don't use cirrus M1 macOS runners on fork (#120116)
Nice Zombies [Thu, 6 Jun 2024 11:40:37 +0000 (13:40 +0200)] 
gh-120111: Don't use cirrus M1 macOS runners on fork (#120116)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)
Irit Katriel [Thu, 6 Jun 2024 10:56:58 +0000 (11:56 +0100)] 
gh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)

17 months agogh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)
Jan Kaliszewski [Wed, 5 Jun 2024 21:52:40 +0000 (23:52 +0200)] 
gh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)

The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).

17 months agopathlib ABCs: remove duplicate `realpath()` implementation. (#119178)
Barney Gale [Wed, 5 Jun 2024 17:54:50 +0000 (18:54 +0100)] 
pathlib ABCs: remove duplicate `realpath()` implementation. (#119178)

Add private `posixpath._realpath()` function, which is a generic version of `realpath()` that can be parameterised with string tokens (`sep`, `curdir`, `pardir`) and query functions (`getcwd`, `lstat`, `readlink`). Also add support for limiting the number of symlink traversals.

In the private `pathlib._abc.PathBase` class, call `posixpath._realpath()` and remove our re-implementation of the same algorithm.

No change to any public APIs, either in `posixpath` or `pathlib`.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
17 months agogh-115225: Raise error on unsupported ISO 8601 time strings (#119339)
benchatt [Wed, 5 Jun 2024 17:35:40 +0000 (10:35 -0700)] 
gh-115225: Raise error on unsupported ISO 8601 time strings (#119339)

Some time strings that contain fractional hours or minutes are permitted
by ISO 8601, but such strings are very unlikely to be intentional. The
current parser does not parse such strings correctly or raise an error.
This change raises a ValueError when hours or minutes contain a decimal mark.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
17 months agogh-119786: add links to code in exception handling doc (#120077)
Irit Katriel [Wed, 5 Jun 2024 15:28:47 +0000 (16:28 +0100)] 
gh-119786: add links to code in exception handling doc (#120077)

17 months agogh-120065: Increase `collect_in_thread` period to 5 ms. (#120068)
Sam Gross [Wed, 5 Jun 2024 13:23:29 +0000 (09:23 -0400)] 
gh-120065: Increase `collect_in_thread` period to 5 ms. (#120068)

This matches the default GIL switch interval. It greatly speeds up the
free-threaded build: previously, it spent nearly all its time in
`gc.collect()`.

17 months agogh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib...
Irit Katriel [Wed, 5 Jun 2024 11:56:01 +0000 (12:56 +0100)] 
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (#119657)

17 months agogh-119819: Update logging configuration to support joinable multiproc… (GH-120090)
Vinay Sajip [Wed, 5 Jun 2024 06:25:47 +0000 (07:25 +0100)] 
gh-119819: Update logging configuration to support joinable multiproc… (GH-120090)

gh-119819: Update logging configuration to support joinable multiprocessing manager queues.

17 months agogh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH...
shurj0 [Wed, 5 Jun 2024 00:23:12 +0000 (06:23 +0600)] 
gh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH-120081)

17 months agogh-114616: Improve docs regarding changes to caches representation in dis (#120033)
Irit Katriel [Tue, 4 Jun 2024 23:00:02 +0000 (00:00 +0100)] 
gh-114616: Improve docs regarding changes to caches representation in dis (#120033)

17 months agogh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)
Lysandros Nikolaou [Tue, 4 Jun 2024 21:22:28 +0000 (23:22 +0200)] 
gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)

17 months agogh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (#120000)
Sam Gross [Tue, 4 Jun 2024 19:26:26 +0000 (15:26 -0400)] 
gh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (#120000)

We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`.
Once we mark `ob_ref_shared` as merged, some other thread may free the
object because the caller also passes in `-1` as `extra` to give up its
only reference.

17 months agogh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067)
Vinay Sajip [Tue, 4 Jun 2024 19:16:43 +0000 (20:16 +0100)] 
gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067)

17 months agogh-120048: Make `test_imaplib` faster (#120050)
Sam Gross [Tue, 4 Jun 2024 18:59:23 +0000 (14:59 -0400)] 
gh-120048: Make `test_imaplib` faster (#120050)

The `test_imaplib` was taking 40+ minutes in the refleak build bots because
the tests waiting on a client `self._setup()` was creating a client that
prevented progress until its connection timed out, which scaled with the
global timeout.

We should set `connect=False` for the tests that don't want `_setup()` to
create a client.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)
Pablo Galindo Salgado [Tue, 4 Jun 2024 18:32:43 +0000 (19:32 +0100)] 
gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
17 months agodoc: Mention the missing reflected special methods for all binary operations (GH...
Paulo Freitas [Tue, 4 Jun 2024 17:55:11 +0000 (14:55 -0300)] 
doc: Mention the missing reflected special methods for all binary operations (GH-119931)

17 months agogh-119553: Clear reader on Ctrl-C command (GH-119801)
Lysandros Nikolaou [Tue, 4 Jun 2024 17:46:33 +0000 (19:46 +0200)] 
gh-119553: Clear reader on Ctrl-C command (GH-119801)

17 months agogh-120039: Reduce expected timeout in test_siginterrupt_off (#120047)
Sam Gross [Tue, 4 Jun 2024 17:38:29 +0000 (13:38 -0400)] 
gh-120039: Reduce expected timeout in test_siginterrupt_off (#120047)

The process is expected to time out. In the refleak builds,
`support.SHORT_TIMEOUT` is often five minutes and we run the tests six
times, so test_signal was taking >30 minutes.

17 months agogh-120041: Refactor check for visible completion menu in completing_reader (#120055)
Lysandros Nikolaou [Tue, 4 Jun 2024 17:26:44 +0000 (19:26 +0200)] 
gh-120041: Refactor check for visible completion menu in completing_reader (#120055)

17 months agogh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)
Christopher Chavez [Tue, 4 Jun 2024 16:47:15 +0000 (11:47 -0500)] 
gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)

* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-89928: Fix integer conversion of device numbers (GH-31794)
Serhiy Storchaka [Tue, 4 Jun 2024 16:36:37 +0000 (19:36 +0300)] 
gh-89928: Fix integer conversion of device numbers (GH-31794)

Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).

17 months agoFix incorrect pull GitHub link in What's New (#120045)
Trey Hunner [Tue, 4 Jun 2024 16:28:08 +0000 (09:28 -0700)] 
Fix incorrect pull GitHub link in What's New (#120045)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-120041: Do not use append_to_screen when completions are visible (GH-120042)
Lysandros Nikolaou [Tue, 4 Jun 2024 16:09:31 +0000 (18:09 +0200)] 
gh-120041: Do not use append_to_screen when completions are visible (GH-120042)

17 months agogh-119588: Update docs to reflect decision to include the change with Python 3.13...
Jason R. Coombs [Tue, 4 Jun 2024 15:20:01 +0000 (11:20 -0400)] 
gh-119588: Update docs to reflect decision to include the change with Python 3.13 and not 3.12. (#120043)

17 months agogh-120029: export `DEF_TYPE_PARAM` compiler flag (#120028)
Bénédikt Tran [Tue, 4 Jun 2024 14:24:22 +0000 (16:24 +0200)] 
gh-120029: export `DEF_TYPE_PARAM` compiler flag (#120028)

17 months agogh-117657: Fix race involving GC and heap initialization (#119923)
Sam Gross [Tue, 4 Jun 2024 13:42:13 +0000 (09:42 -0400)] 
gh-117657: Fix race involving GC and heap initialization (#119923)

The `_PyThreadState_Bind()` function is called before the first
`PyEval_AcquireThread()` so it's not synchronized with the stop the
world GC. We had a race where `gc_visit_heaps()` might visit a thread's
heap while it's being initialized.

Use a simple atomic int to avoid visiting heaps for threads that are not
yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called).

The race was reproducible by running:
`python Lib/test/test_importlib/partial/pool_in_threads.py`.

17 months agogh-94808: Reorganize _make_posargs and mark unused code (GH-119227)
Mark Jason Dominus (陶敏修) [Tue, 4 Jun 2024 12:59:56 +0000 (08:59 -0400)] 
gh-94808: Reorganize _make_posargs and mark unused code (GH-119227)

* Reorganize four-way if-elsif-elsif-elsif as nested if-elses
* Mark unused branch in _make_posargs

`names_with_default` is never `NULL`, even if there are no names with
defaults.  In that case it points to a structure with `size` zero.

Rather than eliminating the branch, we leave it behind with an `assert(0)`
in case a future change to the grammar exercises the branch.

17 months agogh-119819: Fix regression to allow logging configuration with multipr… (GH-120030)
Vinay Sajip [Tue, 4 Jun 2024 12:20:50 +0000 (13:20 +0100)] 
gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030)

17 months agogh-118868: logging QueueHandler fix passing of kwargs (GH-118869)
Kaundur [Tue, 4 Jun 2024 11:48:05 +0000 (12:48 +0100)] 
gh-118868: logging QueueHandler fix passing of kwargs (GH-118869)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
17 months agoFix typos in documentation and comments (#119763)
Xie Yanbo [Tue, 4 Jun 2024 10:22:22 +0000 (18:22 +0800)] 
Fix typos in documentation and comments (#119763)

17 months agogh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)
Victor Stinner [Tue, 4 Jun 2024 09:39:07 +0000 (11:39 +0200)] 
gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)

Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before
the interpreter is deleted.

17 months agogh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)
Victor Stinner [Tue, 4 Jun 2024 09:23:55 +0000 (11:23 +0200)] 
gh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)

Use directly memcpy() instead.

17 months agogh-119070: Update test_shebang_executable_extension to always use non-installed versi...
Steve Dower [Tue, 4 Jun 2024 08:17:45 +0000 (09:17 +0100)] 
gh-119070: Update test_shebang_executable_extension to always use non-installed version (GH-119846)

17 months agogh-119879: str.find(): Utilize last character gap for two-way periodic needles (...
d.grigonis [Tue, 4 Jun 2024 07:44:49 +0000 (10:44 +0300)] 
gh-119879: str.find(): Utilize last character gap for two-way periodic needles (#119880)

17 months agogh-106531: Apply changes from importlib_resources 6.3.2 (#117054)
Jason R. Coombs [Tue, 4 Jun 2024 06:36:28 +0000 (02:36 -0400)] 
gh-106531: Apply changes from importlib_resources 6.3.2 (#117054)

Apply changes from importlib_resources 6.3.2.

17 months agogh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else...
Petr Viktorin [Tue, 4 Jun 2024 01:10:15 +0000 (03:10 +0200)] 
gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513)" (#119974)

This reverts commit 1c8f912ebdfdb146cd7dd2d7a3a67d2c5045ddb0.

17 months agogh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)
Eric Snow [Mon, 3 Jun 2024 23:09:18 +0000 (19:09 -0400)] 
gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)

We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

The relevant code could use some cleanup but I opted to avoid the significant churn in this change.  I'll tackle that separately.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.

17 months agogh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)
Eric Snow [Mon, 3 Jun 2024 22:42:48 +0000 (18:42 -0400)] 
gh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)

This makes the support official.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
17 months agogh-117398: Add datetime Module State (gh-119810)
Eric Snow [Mon, 3 Jun 2024 21:56:00 +0000 (17:56 -0400)] 
gh-117398: Add datetime Module State (gh-119810)

I was able to make use of the existing datetime_state struct, but there was one tricky thing I had to sort out.  We mostly aren't converting to heap types, so we can't use things like PyType_GetModuleByDef() to look up the module state.  The solution I came up with is somewhat novel, but I consider it straightforward.  Also, it shouldn't have much impact on performance.

In summary, this main changes here are:

* I've added some macros to help hide how various objects relate to module state
* as a solution to the module state lookup problem, I've stored the last loaded module on the current interpreter's internal dict (actually a weakref)
* if the static type method is used after the module has been deleted, it is reloaded
* to avoid extra work when loading the module, we directly copy the objects (new refs only) from the old module state into the new state if the old module hasn't been deleted yet
* during module init we set various objects on the static types' __dict__s; to simplify things, we only do that the first time; once those static types have a separate __dict__ per interpreter, we'll do it every time
* we now clear the module state when the module is destroyed (before, we were leaking everything in _datetime_global_state)

17 months agogh-117657: Fix race involving immortalizing objects (#119927)
Sam Gross [Mon, 3 Jun 2024 20:58:41 +0000 (16:58 -0400)] 
gh-117657: Fix race involving immortalizing objects (#119927)

The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.

This fixes a race condition involving the tracking of whether the
behavior is suppressed.

17 months agoupdate CODEOWNERS (#120003)
Irit Katriel [Mon, 3 Jun 2024 20:44:36 +0000 (21:44 +0100)] 
update CODEOWNERS (#120003)

17 months agogh-117657: Avoid `sem_clockwait` in TSAN (#119915)
Sam Gross [Mon, 3 Jun 2024 17:42:27 +0000 (13:42 -0400)] 
gh-117657: Avoid `sem_clockwait` in TSAN (#119915)

The `sem_clockwait` function is not currently instrumented, which leads
to false positives.

17 months agogh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI...
Daniel Hollas [Mon, 3 Jun 2024 17:07:06 +0000 (18:07 +0100)] 
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (#119942)

17 months agogh-119727: Add --single-process option to regrtest (#119728)
Victor Stinner [Mon, 3 Jun 2024 16:34:36 +0000 (18:34 +0200)] 
gh-119727: Add --single-process option to regrtest (#119728)

17 months agogh-119057: Use better error messages for zero division (#119066)
Nikita Sobolev [Mon, 3 Jun 2024 16:03:56 +0000 (19:03 +0300)] 
gh-119057: Use better error messages for zero division (#119066)

17 months agogh-119981: Use do while(0) in some symtable.c multi-line macros (#119982)
Bénédikt Tran [Mon, 3 Jun 2024 15:48:02 +0000 (17:48 +0200)] 
gh-119981: Use do while(0) in some symtable.c multi-line macros (#119982)

17 months agoUse Cirrus M1 macOS runners for CI (GH-119979)
Łukasz Langa [Mon, 3 Jun 2024 15:32:40 +0000 (11:32 -0400)] 
Use Cirrus M1 macOS runners for CI (GH-119979)

Co-authored-by: Ee Durbin <ee@python.org>
17 months agogh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591)
Jason R. Coombs [Mon, 3 Jun 2024 15:13:07 +0000 (11:13 -0400)] 
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591)

17 months agogh-119679: Ensures correct import libraries are included in Windows install packages...
Steve Dower [Mon, 3 Jun 2024 14:42:45 +0000 (15:42 +0100)] 
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790)

17 months agogh-102511: Amend 3.13.0b1.rst (GH-119895)
Nice Zombies [Mon, 3 Jun 2024 13:27:44 +0000 (15:27 +0200)] 
gh-102511: Amend 3.13.0b1.rst (GH-119895)

17 months agogh-116560: Add PyLong_GetSign() public function (#116561)
Sergey B Kirpichev [Mon, 3 Jun 2024 12:06:31 +0000 (15:06 +0300)] 
gh-116560: Add PyLong_GetSign() public function (#116561)

Co-authored-by: Victor Stinner <vstinner@python.org>
17 months agogh-119786: move exception handling doc to InternalDocs (#119815)
Irit Katriel [Mon, 3 Jun 2024 09:36:20 +0000 (10:36 +0100)] 
gh-119786: move exception handling doc to InternalDocs (#119815)

17 months agogh-119968: Improved monitoring c-api docs (#119969)
Awbert [Mon, 3 Jun 2024 09:31:02 +0000 (12:31 +0300)] 
gh-119968: Improved monitoring c-api docs (#119969)

17 months agogh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex...
Serhiy Storchaka [Mon, 3 Jun 2024 09:29:01 +0000 (12:29 +0300)] 
gh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex (GH-119839)

17 months agogh-112026: Deprecate _PyDict_GetItemStringWithError() function (#119855)
Victor Stinner [Mon, 3 Jun 2024 08:26:13 +0000 (10:26 +0200)] 
gh-112026: Deprecate _PyDict_GetItemStringWithError() function (#119855)

17 months agogh-119856: Support exiting help() with just "exit" (#119858)
Victor Stinner [Mon, 3 Jun 2024 08:15:04 +0000 (10:15 +0200)] 
gh-119856: Support exiting help() with just "exit" (#119858)

17 months agogh-116991: Improve `pygen --help` for `python` subparser (#116992)
Nikita Sobolev [Mon, 3 Jun 2024 07:52:35 +0000 (10:52 +0300)] 
gh-116991: Improve `pygen --help` for `python` subparser (#116992)

17 months agogh-118827: Remove `Quoter` from `urllib.parse` (#118828)
Nikita Sobolev [Mon, 3 Jun 2024 07:50:29 +0000 (10:50 +0300)] 
gh-118827: Remove `Quoter` from `urllib.parse` (#118828)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)
Radislav Chugunov [Mon, 3 Jun 2024 07:47:36 +0000 (10:47 +0300)] 
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
17 months agogh-119396: Optimize unicode_decode_utf8_writer() (#119957)
Victor Stinner [Mon, 3 Jun 2024 06:45:20 +0000 (08:45 +0200)] 
gh-119396: Optimize unicode_decode_utf8_writer() (#119957)

Optimize unicode_decode_utf8_writer()

Take the ascii_decode() fast-path even if dest is not aligned on
size_t bytes.

17 months agogh-119961: Fix test workflow status badge in README (#119962)
wookie184 [Mon, 3 Jun 2024 06:05:57 +0000 (07:05 +0100)] 
gh-119961: Fix test workflow status badge in README (#119962)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
17 months agogh-117657: Fix data races report by TSAN unicode-hash (gh-119907)
Donghee Na [Mon, 3 Jun 2024 03:22:41 +0000 (12:22 +0900)] 
gh-117657: Fix data races report by TSAN unicode-hash (gh-119907)

17 months agogh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative...
Solomon Himelbloom [Mon, 3 Jun 2024 00:43:03 +0000 (16:43 -0800)] 
gh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative (#119958)

17 months agoGH-119054: Add "Reading and writing files" section to pathlib docs (#119524)
Barney Gale [Sun, 2 Jun 2024 19:39:19 +0000 (20:39 +0100)] 
GH-119054: Add "Reading and writing files" section to pathlib docs (#119524)

Add a dedicated subsection for `open()`, `read_text()`, `read_bytes()`,
`write_text()` and `write_bytes()`.

17 months agoImprove documentation for typing.get_type_hints (#119928)
Jelle Zijlstra [Sun, 2 Jun 2024 15:13:24 +0000 (08:13 -0700)] 
Improve documentation for typing.get_type_hints (#119928)

- Explicit list of what it does that is different from
  "just return __annotations__"
- Remove reference to PEP 563; adding the future import doesn't
  do anything to type aliases, and in general it will never make
  get_type_hints() less likely to fail.
- Remove example, as the Annotated docs already have a similar
  example, and it's unbalanced to have one example about this
  one edge case but not about other behaviors of the function.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
17 months agogh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (#119921)
Sam Gross [Sun, 2 Jun 2024 14:19:02 +0000 (10:19 -0400)] 
gh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (#119921)

The GIL may be disabled concurrently with this call so we need to use a
relaxed atomic load.

17 months agogh-119740: Remove deprecated trunc delegation (#119743)
Mark Dickinson [Sun, 2 Jun 2024 09:16:49 +0000 (10:16 +0100)] 
gh-119740: Remove deprecated trunc delegation (#119743)

Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-119775: Remove ability to create immutable types with mutable bases (#119776)
Nikita Sobolev [Sun, 2 Jun 2024 07:27:20 +0000 (10:27 +0300)] 
gh-119775: Remove ability to create immutable types with mutable bases (#119776)

17 months agogh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)
Alyssa Coghlan [Sun, 2 Jun 2024 04:44:29 +0000 (14:44 +1000)] 
gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)

PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)

17 months agoRefactor (mostly rearrange) the statistics module (gh-119930)
Raymond Hettinger [Sun, 2 Jun 2024 03:07:46 +0000 (22:07 -0500)] 
Refactor (mostly rearrange) the statistics module (gh-119930)

17 months agogh-119016: Remove outdated sentences from the "classes" tutorial (#119130)
Nice Zombies [Sat, 1 Jun 2024 21:20:00 +0000 (23:20 +0200)] 
gh-119016: Remove outdated sentences from the "classes" tutorial (#119130)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
17 months agoGH-89727: Fix `shutil.rmtree()` recursion error on deep trees (#119808)
Barney Gale [Sat, 1 Jun 2024 18:49:12 +0000 (19:49 +0100)] 
GH-89727: Fix `shutil.rmtree()` recursion error on deep trees (#119808)

Implement `shutil._rmtree_safe_fd()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

`shutil._rmtree_unsafe()` was fixed in a150679f90.

17 months agoAdd unique() recipe to itertools docs (gh-119911)
Raymond Hettinger [Sat, 1 Jun 2024 16:30:24 +0000 (11:30 -0500)] 
Add unique() recipe to itertools docs (gh-119911)

17 months agogh-117657: Add TSAN suppression for `set_discard_entry` (#119908)
Sam Gross [Sat, 1 Jun 2024 16:15:58 +0000 (12:15 -0400)] 
gh-117657: Add TSAN suppression for `set_discard_entry` (#119908)

Seen in CI occasionally when running `test_weakref`.

17 months agogh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure that the...
Kirill Podoprigora [Sat, 1 Jun 2024 16:05:19 +0000 (19:05 +0300)] 
gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure that the given socket is in non-blocking mode (#119519)

17 months agoMinor speed/accuracy improvement for kde() (gh-119910)
Raymond Hettinger [Sat, 1 Jun 2024 15:49:14 +0000 (10:49 -0500)] 
Minor speed/accuracy improvement for kde() (gh-119910)

17 months agogh-117657: Fix TSAN race in QSBR assertion (#119887)
Sam Gross [Sat, 1 Jun 2024 14:04:38 +0000 (10:04 -0400)] 
gh-117657: Fix TSAN race in QSBR assertion (#119887)

Due to a limitation in TSAN, all reads from `PyThreadState.state` must be
atomic to avoid reported races.

17 months agogh-117657: Fix TSAN race in free-threaded GC (#119883)
Sam Gross [Sat, 1 Jun 2024 14:04:05 +0000 (10:04 -0400)] 
gh-117657: Fix TSAN race in free-threaded GC (#119883)

Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.

17 months agoBump types-psutil from 5.9.5.20240423 to 5.9.5.20240516 in /Tools (#119900)
dependabot[bot] [Sat, 1 Jun 2024 10:38:13 +0000 (10:38 +0000)] 
Bump types-psutil from 5.9.5.20240423 to 5.9.5.20240516 in /Tools (#119900)

17 months agobuild(deps-dev): bump types-setuptools from 69.5.0.20240423 to 70.0.0.20240524 in...
dependabot[bot] [Sat, 1 Jun 2024 10:11:53 +0000 (10:11 +0000)] 
build(deps-dev): bump types-setuptools from 69.5.0.20240423 to 70.0.0.20240524 in /Tools (#119899)

17 months agogh-118888: Further PEP 667 docs updates (gh-119893)
Alyssa Coghlan [Sat, 1 Jun 2024 06:21:48 +0000 (16:21 +1000)] 
gh-118888: Further PEP 667 docs updates (gh-119893)

* Clarify impact on default behaviour of exec, eval, etc
* Update documentation for changes to PyEval_GetLocals (gh-74929)

Closes gh-11888

17 months agogh-74929: PEP 667 C API documentation (gh-119379)
Alyssa Coghlan [Sat, 1 Jun 2024 03:59:35 +0000 (13:59 +1000)] 
gh-74929: PEP 667 C API documentation (gh-119379)

* Add docs for new APIs
* Add soft-deprecation notices
* Add What's New porting entries
* Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead
* Other related cleanups found when looking for refs to the deprecated APIs

17 months agostatistics.fmean(): speed-up code path for non-sizeable inputs. (gh-119876) 119460/head
Raymond Hettinger [Fri, 31 May 2024 22:08:55 +0000 (17:08 -0500)] 
statistics.fmean(): speed-up code path for non-sizeable inputs. (gh-119876)

17 months agogh-119180: Lazily wrap annotations on classmethod and staticmethod (#119864)
Jelle Zijlstra [Fri, 31 May 2024 21:05:51 +0000 (14:05 -0700)] 
gh-119180: Lazily wrap annotations on classmethod and staticmethod (#119864)

17 months agogh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822)
Jelle Zijlstra [Fri, 31 May 2024 21:05:24 +0000 (14:05 -0700)] 
gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822)

Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS

The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated,
but that seems like it may get hairy since the two operations have different operands.

This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too,
and we should backport to 3.13 and 3.12 if possible.

17 months agogh-118894: Make asyncio REPL use pyrepl (GH-119433)
Łukasz Langa [Fri, 31 May 2024 20:26:02 +0000 (16:26 -0400)] 
gh-118894: Make asyncio REPL use pyrepl (GH-119433)

17 months agogh-119853: Add Include/refcount.h to projects (#119860)
Victor Stinner [Fri, 31 May 2024 19:21:30 +0000 (21:21 +0200)] 
gh-119853: Add Include/refcount.h to projects (#119860)

17 months agogh-119799: Add missing `_Py_IncRefTotal` to `_Py_NewRefWithLock` (#119800)
Sam Gross [Fri, 31 May 2024 18:18:24 +0000 (14:18 -0400)] 
gh-119799: Add missing `_Py_IncRefTotal` to `_Py_NewRefWithLock` (#119800)

The free-threaded refleak builds were reporting negative refcount deltas
in some tests because of a missing `_Py_NewRefWithLock`.

17 months agodoc: Add glossary entry for "free threading" (#119865)
Sam Gross [Fri, 31 May 2024 17:23:29 +0000 (13:23 -0400)] 
doc: Add glossary entry for "free threading" (#119865)

17 months agocontextlib docs: Clean up redundant 'up' after 'cleanup' (GH-119867)
Zachary Ware [Fri, 31 May 2024 17:19:54 +0000 (12:19 -0500)] 
contextlib docs: Clean up redundant 'up' after 'cleanup' (GH-119867)

Reported by Michael Kass on docs@

17 months agogh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field...
Irit Katriel [Fri, 31 May 2024 17:09:48 +0000 (18:09 +0100)] 
gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (#119364)

17 months agogh-119369: Fix deadlock during thread exit in free-threaded build (#119528)
Sam Gross [Fri, 31 May 2024 17:04:59 +0000 (13:04 -0400)] 
gh-119369: Fix deadlock during thread exit in free-threaded build (#119528)

Release the GIL before calling `_Py_qsbr_unregister`.

The deadlock could occur when the GIL was enabled at runtime. The
`_Py_qsbr_unregister` call might block while holding the GIL because the
thread state was not active, but the GIL was still held.

17 months agogh-119770: Make termios ioctl() constants positive (#119840)
Victor Stinner [Fri, 31 May 2024 15:18:40 +0000 (17:18 +0200)] 
gh-119770: Make termios ioctl() constants positive (#119840)

17 months agogh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()...
Sam Gross [Fri, 31 May 2024 14:50:52 +0000 (10:50 -0400)] 
gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (#119753)

Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.

17 months agogh-119853: Add Include/refcount.h file (#119854)
Victor Stinner [Fri, 31 May 2024 14:49:26 +0000 (16:49 +0200)] 
gh-119853: Add Include/refcount.h file  (#119854)

17 months agogh-111201: Skip pyrepl Windows tests earlier (#119848)
Victor Stinner [Fri, 31 May 2024 14:06:10 +0000 (16:06 +0200)] 
gh-111201: Skip pyrepl Windows tests earlier (#119848)

Don't attempt to load pyrepl Windows console if platforms others than
Windows. For example, the import can fail if ctypes is missing.

17 months agogh-111201: [pyrepl] Ensure optional platform-specific imports are optional (GH-119834)
Łukasz Langa [Fri, 31 May 2024 12:41:26 +0000 (08:41 -0400)] 
gh-111201: [pyrepl] Ensure optional platform-specific imports are optional (GH-119834)

17 months agogh-116145: Updated bundled Tcl/Tk on Windows to 8.6.14 (GH-117030)
Steve Dower [Fri, 31 May 2024 12:07:19 +0000 (13:07 +0100)] 
gh-116145: Updated bundled Tcl/Tk on Windows to 8.6.14 (GH-117030)