]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
11 months agogh-86463: Fix a trailing space in argparse.rst (#127162)
Serhiy Storchaka [Fri, 22 Nov 2024 16:34:05 +0000 (18:34 +0200)] 
gh-86463: Fix a trailing space in argparse.rst (#127162)

11 months agogh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining...
Andrei Bodrov [Fri, 22 Nov 2024 16:20:34 +0000 (19:20 +0300)] 
gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098)

Threads are gone after fork, so clear the queues too. Otherwise the
child process (here created via multiprocessing.Process) crashes on
interpreter exit.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months agogh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610)
Jun Komoda [Fri, 22 Nov 2024 15:57:31 +0000 (00:57 +0900)] 
gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610)

11 months agogh-109413: Fix libregrtest get_running() (#127153)
Victor Stinner [Fri, 22 Nov 2024 15:56:03 +0000 (16:56 +0100)] 
gh-109413: Fix libregrtest get_running() (#127153)

Skip threads which are not running.

11 months agogh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035)
Serhiy Storchaka [Fri, 22 Nov 2024 15:52:15 +0000 (17:52 +0200)] 
gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035)

* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").

11 months agoFix broken XML in Visual Studio project file (GH-127142)
Sergey Muraviov [Fri, 22 Nov 2024 15:30:01 +0000 (18:30 +0300)] 
Fix broken XML in Visual Studio project file (GH-127142)

11 months agogh-86463: Fix default prog in subparsers if usage is used in the main parser (GH...
Serhiy Storchaka [Fri, 22 Nov 2024 15:29:33 +0000 (17:29 +0200)] 
gh-86463: Fix default prog in subparsers if usage is used in the main parser (GH-125891)

The usage parameter of argparse.ArgumentParser no longer
affects the default value of the prog parameter in subparsers.

Previously the full custom usage of the main parser was used as
the prog prefix in subparsers.

11 months agogh-127076: Ignore memory mmap in FileIO testing (#127088)
Cody Maloney [Fri, 22 Nov 2024 14:55:32 +0000 (06:55 -0800)] 
gh-127076: Ignore memory mmap in FileIO testing (#127088)

`mmap`, `munmap`, and `mprotect` are used by CPython for memory
management, which may occur in the middle of the FileIO tests. The
system calls can also be used with files, so `strace` includes them
in its `%file` and `%desc` filters.

Filter out the `mmap` system calls related to memory allocation for the
file tests. Currently FileIO doesn't do `mmap` at all, so didn't add
code to track from `mmap` through `munmap` since it wouldn't be used.
For now if an `mmap` on a fd happens, the call will be included (which
may cause test to fail), and at that time support for tracking the
address throug `munmap` could be added.

11 months agogh-126700: pygettext: Support more gettext functions (GH-126912)
Tomas R. [Fri, 22 Nov 2024 14:52:16 +0000 (15:52 +0100)] 
gh-126700: pygettext: Support more gettext functions (GH-126912)

Support multi-argument gettext functions: ngettext(), pgettext(), dgettext(), etc.

11 months agogh-127065: Make `methodcaller` thread-safe in free threading build (#127109)
Sam Gross [Fri, 22 Nov 2024 14:21:59 +0000 (14:21 +0000)] 
gh-127065: Make `methodcaller` thread-safe in free threading build (#127109)

The `methodcaller` C vectorcall implementation uses an arguments array
that is shared across calls. The first argument is modified on every
invocation. This isn't thread-safe in the free threading build. I think
it's also not safe in general, but for now just disable it in the free
threading build.

11 months agogh-127082: Replace "Windows only" with the `availability: Windows` in `ctypes` doc...
Jun Komoda [Fri, 22 Nov 2024 07:56:34 +0000 (16:56 +0900)] 
gh-127082: Replace "Windows only" with the `availability: Windows` in `ctypes` doc (#127099)

11 months agoAllow local use of `static PyMutex` in the C analyzer (#127102)
Peter Bierma [Fri, 22 Nov 2024 07:48:39 +0000 (02:48 -0500)] 
Allow local use of `static PyMutex` in the C analyzer (#127102)

11 months agoGH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (#127132)
Barney Gale [Fri, 22 Nov 2024 04:12:50 +0000 (04:12 +0000)] 
GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (#127132)

Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.

11 months agoGH-126766: `url2pathname()`: handle 'localhost' authority (#127129)
Barney Gale [Fri, 22 Nov 2024 03:17:06 +0000 (03:17 +0000)] 
GH-126766: `url2pathname()`: handle 'localhost' authority (#127129)

Discard any 'localhost' authority from the beginning of a `file:` URI. As a
result, file URIs like `//localhost/etc/hosts` are correctly decoded as
`/etc/hosts`.

11 months agoGH-122679: Add `register()` to argparse docs (#126939)
Savannah Ostrowski [Fri, 22 Nov 2024 00:36:11 +0000 (16:36 -0800)] 
GH-122679: Add `register()` to argparse docs (#126939)

* Add register() to argparse docs

* Add newline

* Formatting

* Fix codeblock

* Move section

* Add signature

* Add newline

* Fix indent

* Fix indent take 2

* Rephrase

* Simplify language

* Address PR comments

* Add references to register in type and action

* Remove unnecessary reference

* Rephrase and add success case

11 months agoGH-126601: `pathname2url()`: handle NTFS alternate data streams (#126760)
Barney Gale [Fri, 22 Nov 2024 00:29:05 +0000 (00:29 +0000)] 
GH-126601: `pathname2url()`: handle NTFS alternate data streams (#126760)

Adjust `pathname2url()` to encode embedded colon characters in Windows
paths, rather than bailing out with an `OSError`.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
11 months agogh-126091: Always link generator frames when propagating a thrown-in exception throug...
Jacob Bower [Thu, 21 Nov 2024 23:37:49 +0000 (15:37 -0800)] 
gh-126091: Always link generator frames when propagating a thrown-in exception through a yield-from chain (#126092)

Always link generator frames when propagating a thrown-in exception through a yield-from chain.

11 months agoImprove comment for co_nlocalsplus (#126993)
Jacob Bower [Thu, 21 Nov 2024 23:26:25 +0000 (15:26 -0800)] 
Improve comment for co_nlocalsplus (#126993)

11 months agogh-115999: Add free-threaded specialization for ``TO_BOOL`` (gh-126616)
Donghee Na [Thu, 21 Nov 2024 22:52:16 +0000 (07:52 +0900)] 
gh-115999: Add free-threaded specialization for ``TO_BOOL`` (gh-126616)

11 months agogh-115999: Specialize `LOAD_GLOBAL` in free-threaded builds (#126607)
mpage [Thu, 21 Nov 2024 19:22:21 +0000 (11:22 -0800)] 
gh-115999: Specialize `LOAD_GLOBAL` in free-threaded builds (#126607)

Enable specialization of LOAD_GLOBAL in free-threaded builds.

Thread-safety of specialization in free-threaded builds is provided by the following:

A critical section is held on both the globals and builtins objects during specialization. This ensures we get an atomic view of both builtins and globals during specialization.
Generation of new keys versions is made atomic in free-threaded builds.
Existing helpers are used to atomically modify the opcode.
Thread-safety of specialized instructions in free-threaded builds is provided by the following:

Relaxed atomics are used when loading and storing dict keys versions. This avoids potential data races as the dict keys versions are read without holding the dictionary's per-object lock in version guards.
Dicts keys objects are passed from keys version guards to the downstream uops. This ensures that we are loading from the correct offset in the keys object. Once a unicode key has been stored in a keys object for a combined dictionary in free-threaded builds, the offset that it is stored in will never be reused for a different key. Once the version guard passes, we know that we are reading from the correct offset.
The dictionary read fast-path is used to read values from the dictionary once we know the correct offset.

11 months agogh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)
Eric Snow [Thu, 21 Nov 2024 18:08:38 +0000 (11:08 -0700)] 
gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)

This is a precursor to the actual fix for gh-114940, where we will change these macros to use the new lock.  This change is almost entirely mechanical; the exceptions are the loops in codeobject.c and ceval.c, which now hold the "head" lock.  Note that almost all of the uses of _Py_FOR_EACH_TSTATE_UNLOCKED() here will change to _Py_FOR_EACH_TSTATE_BEGIN() once we add the new per-interpreter lock.

11 months agogh-124470: Fix crash when reading from object instance dictionary while replacing...
Dino Viehland [Thu, 21 Nov 2024 16:41:19 +0000 (08:41 -0800)] 
gh-124470: Fix crash when reading from object instance dictionary while replacing it (#122489)

Delay free a dictionary when replacing it

11 months agogh-127020: Make `PyCode_GetCode` thread-safe for free threading (#127043)
Sam Gross [Thu, 21 Nov 2024 16:00:50 +0000 (16:00 +0000)] 
gh-127020: Make `PyCode_GetCode` thread-safe for free threading (#127043)

Some fields in PyCodeObject are lazily initialized. Use atomics and
critical sections to make their initializations and accesses thread-safe.

11 months agogh-118761: Improve import time of `mimetypes` (#126979)
Hugo van Kemenade [Thu, 21 Nov 2024 14:55:28 +0000 (16:55 +0200)] 
gh-118761: Improve import time of `mimetypes` (#126979)

11 months agogh-124873: Tolerate 100 ms in TimerfdTests on Android (#127101)
Victor Stinner [Thu, 21 Nov 2024 14:53:52 +0000 (15:53 +0100)] 
gh-124873: Tolerate 100 ms in TimerfdTests on Android (#127101)

On Android, TimerfdTests of test_os now uses 100 ms accuracy instead
of 10 ms.

11 months agogh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)
Victor Stinner [Thu, 21 Nov 2024 14:47:24 +0000 (15:47 +0100)] 
gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)

grpmodule.c is no longer built with the limited C API, since PyMutex
is excluded from the limited C API.

11 months agogh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)
Nice Zombies [Thu, 21 Nov 2024 14:43:36 +0000 (15:43 +0100)] 
gh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)

11 months agogh-112136: Remove unused #include "pycore_lock.h" (#127093)
Victor Stinner [Thu, 21 Nov 2024 12:50:11 +0000 (13:50 +0100)] 
gh-112136: Remove unused #include "pycore_lock.h" (#127093)

pycore_modsupport.h no longer needs pycore_lock.h.

11 months agogh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730)
Serhiy Storchaka [Thu, 21 Nov 2024 11:16:08 +0000 (13:16 +0200)] 
gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730)

It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.

11 months agogh-126997: Fix support of non-ASCII strings in pickletools (GH-127062)
Serhiy Storchaka [Thu, 21 Nov 2024 11:15:12 +0000 (13:15 +0200)] 
gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062)

* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments.
* dis() now outputs non-ASCII bytes in STRING, BINSTRING and
  SHORT_BINSTRING arguments as escaped (\xXX).

11 months agogh-127076: Disable strace tests under LD_PRELOAD (#127086)
Cody Maloney [Thu, 21 Nov 2024 09:33:12 +0000 (01:33 -0800)] 
gh-127076: Disable strace tests under LD_PRELOAD (#127086)

Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses
LD_PRELOAD to intercept system calls and potentially modify them when
building. These tools can change the set of system calls, so disable
system call testing under these cases.

Co-authored-by: Michał Górny <mgorny@gentoo.org>
11 months agogh-126898: Emscripten support: Use es6 modules (#126903)
Hood Chatham [Thu, 21 Nov 2024 04:10:46 +0000 (05:10 +0100)] 
gh-126898: Emscripten support: Use es6 modules (#126903)

Modify Emscripten support to use ES6 modules.

11 months agogh-115999: Don't take a reason in unspecialize (#127030)
mpage [Wed, 20 Nov 2024 22:54:48 +0000 (14:54 -0800)] 
gh-115999: Don't take a reason in unspecialize (#127030)

Don't take a reason in unspecialize

We only want to compute the reason if stats are enabled. Optimizing
compilers should optimize this away for us (gcc and clang do), but
it's better to be safe than sorry.

11 months agoRun `apt update` before `apt install git` in autoconf CI job (GH-127066)
Zachary Ware [Wed, 20 Nov 2024 19:20:44 +0000 (13:20 -0600)] 
Run `apt update` before `apt install git` in autoconf CI job (GH-127066)

11 months agoMove NEWS entries out of directories with spaces (GH-127067)
Zachary Ware [Wed, 20 Nov 2024 18:52:46 +0000 (12:52 -0600)] 
Move NEWS entries out of directories with spaces (GH-127067)

Cleanup after GH-126063, including moving the `README.rst` files to the new directories.

11 months agogh-121058: Warn if `PyThreadState_Clear` is called with an exception set (gh-121343)
Peter Bierma [Wed, 20 Nov 2024 17:27:19 +0000 (12:27 -0500)] 
gh-121058: Warn if `PyThreadState_Clear` is called with an exception set (gh-121343)

11 months agoGH-127010: Don't lazily track and untrack dicts (GH-127027)
Mark Shannon [Wed, 20 Nov 2024 16:41:20 +0000 (16:41 +0000)] 
GH-127010: Don't lazily track and untrack dicts (GH-127027)

11 months agogh-97514: Authenticate the forkserver control socket. (GH-99309)
Gregory P. Smith [Wed, 20 Nov 2024 16:18:58 +0000 (08:18 -0800)] 
gh-97514: Authenticate the forkserver control socket. (GH-99309)

This adds authentication to the forkserver control socket. In the past only filesystem permissions protected this socket from code injection into the forkserver process by limiting access to the same UID, which didn't exist when Linux abstract namespace sockets were used (see issue) meaning that any process in the same system network namespace could inject code. We've since stopped using abstract namespace sockets by default, but protecting our control sockets regardless of type is a good idea.

This reuses the HMAC based shared key auth already used by `multiprocessing.connection` sockets for other purposes.

Doing this is useful so that filesystem permissions are not relied upon and trust isn't implied by default between all processes running as the same UID with access to the unix socket.

### pyperformance benchmarks

No significant changes. Including `concurrent_imap` which exercises `multiprocessing.Pool.imap` in that suite.

### Microbenchmarks

This does _slightly_ slow down forkserver use. How much so appears to depend on the platform. Modern platforms and simple platforms are less impacted. This PR adds additional IPC round trips to the control socket to tell forkserver to spawn a new process. Systems with potentially high latency IPC are naturally impacted more.

Typically a 1-4% slowdown on a very targeted process creation microbenchmark, with a worst case overloaded system slowdown of 20%.  No evidence that these slowdowns appear in practical sense.  See the PR for details.

11 months agoGH-126892: Reset warmup counters when JIT compiling code (GH-126893)
Brandt Bucher [Wed, 20 Nov 2024 16:11:25 +0000 (08:11 -0800)] 
GH-126892: Reset warmup counters when JIT compiling code (GH-126893)

11 months agogh-126991: Add tests for unpickling bad object state (GH-127031)
Serhiy Storchaka [Wed, 20 Nov 2024 15:31:50 +0000 (17:31 +0200)] 
gh-126991: Add tests for unpickling bad object state (GH-127031)

This catches a memory leak in loading the BUILD opcode.

11 months agogh-126615: `ctypes`: Make `COMError` public (GH-126686)
Jun Komoda [Wed, 20 Nov 2024 12:53:43 +0000 (21:53 +0900)] 
gh-126615: `ctypes`: Make `COMError` public (GH-126686)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agoGH-84850: Improve whatsnew entry for `[Fancy]URLopener` removal (#127032)
Barney Gale [Wed, 20 Nov 2024 11:14:07 +0000 (11:14 +0000)] 
GH-84850: Improve whatsnew entry for `[Fancy]URLopener` removal (#127032)

11 months agogh-123299: Copyedit "What's New in Python 3.14" (#127028)
Hugo van Kemenade [Wed, 20 Nov 2024 09:35:24 +0000 (11:35 +0200)] 
gh-123299: Copyedit "What's New in Python 3.14" (#127028)

11 months agoDoc: C API: `PyThreadState::on_delete` was removed in v3.13 (#126536)
Richard Hansen [Wed, 20 Nov 2024 08:44:45 +0000 (03:44 -0500)] 
Doc: C API: `PyThreadState::on_delete` was removed in v3.13 (#126536)

11 months agoGH-85168: Use filesystem encoding when converting to/from `file` URIs (#126852)
Barney Gale [Tue, 19 Nov 2024 21:19:30 +0000 (21:19 +0000)] 
GH-85168: Use filesystem encoding when converting to/from `file` URIs (#126852)

Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the
filesystem encoding when quoting and unquoting file URIs, rather than
forcing use of UTF-8.

No changes are needed in the `nturl2path` module because Windows always
uses UTF-8, per PEP 529.

11 months agoMerge remote-tracking branch 'upstream/main'
Hugo van Kemenade [Tue, 19 Nov 2024 20:10:24 +0000 (22:10 +0200)] 
Merge remote-tracking branch 'upstream/main'

11 months agogh-126914: Store the Preallocated Thread State's Pointer in a PyInterpreterState...
Eric Snow [Tue, 19 Nov 2024 19:59:19 +0000 (12:59 -0700)] 
gh-126914: Store the Preallocated Thread State's Pointer in a PyInterpreterState Field (gh-126989)

This approach eliminates the originally reported race. It also gets rid of the deadlock reported in gh-96071, so we can remove the workaround added then.

11 months agoPost 3.14.0a2
Hugo van Kemenade [Tue, 19 Nov 2024 19:55:02 +0000 (21:55 +0200)] 
Post 3.14.0a2

11 months agogh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest...
sobolevn [Tue, 19 Nov 2024 19:41:59 +0000 (22:41 +0300)] 
gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest` (#127033)

11 months agogh-126947: Typechecking for _pydatetime.timedelta.__new__ arguments (#126949)
Beomsoo Kim [Tue, 19 Nov 2024 19:40:52 +0000 (04:40 +0900)] 
gh-126947: Typechecking for _pydatetime.timedelta.__new__ arguments (#126949)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
11 months agogh-125729: Makes the installation of the turtle module dependent on the Tcl/Tk instal...
CoderTCY [Tue, 19 Nov 2024 17:19:33 +0000 (01:19 +0800)] 
gh-125729: Makes the installation of the turtle module dependent on the Tcl/Tk install option  (GH-126176)

11 months agogh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990)
Justin Applegate [Tue, 19 Nov 2024 16:00:35 +0000 (11:00 -0500)] 
gh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.

11 months agogh-118201: Simplify conv_confname (#126089)
Malcolm Smith [Tue, 19 Nov 2024 15:42:19 +0000 (15:42 +0000)] 
gh-118201: Simplify conv_confname (#126089)

11 months agoUpdate docs 'make serve' to suggest 'make htmllive' (#126969)
Hugo van Kemenade [Tue, 19 Nov 2024 15:28:34 +0000 (17:28 +0200)] 
Update docs 'make serve' to suggest 'make htmllive' (#126969)

11 months agoPython 3.14.0a2 v3.14.0a2
Hugo van Kemenade [Tue, 19 Nov 2024 14:51:57 +0000 (16:51 +0200)] 
Python 3.14.0a2

11 months agogh-126980: Fix `bytearray.__buffer__` crash on `PyBUF_{READ,WRITE}` (#126981)
sobolevn [Tue, 19 Nov 2024 14:44:53 +0000 (17:44 +0300)] 
gh-126980: Fix `bytearray.__buffer__` crash on `PyBUF_{READ,WRITE}` (#126981)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months agoGH-84850: Remove `urllib.request.URLopener` and `FancyURLopener` (#125739)
Barney Gale [Tue, 19 Nov 2024 14:01:49 +0000 (14:01 +0000)] 
GH-84850: Remove `urllib.request.URLopener` and `FancyURLopener` (#125739)

11 months agoGH-124567: Replace quadratic assert with linear one (GH-127009)
Mark Shannon [Tue, 19 Nov 2024 13:38:59 +0000 (13:38 +0000)] 
GH-124567: Replace quadratic assert with linear one (GH-127009)

11 months agocodeowners: add myself to getpath, site, and venv (#126994)
Filipe Laíns 🇵🇸 [Tue, 19 Nov 2024 12:43:34 +0000 (12:43 +0000)] 
codeowners: add myself to getpath, site, and venv (#126994)

Signed-off-by: Filipe Laíns <lains@riseup.net>
11 months agogh-126076: Account for relocated objects in tracemalloc (#126077)
Pablo Galindo Salgado [Tue, 19 Nov 2024 10:35:17 +0000 (10:35 +0000)] 
gh-126076: Account for relocated objects in tracemalloc (#126077)

11 months agoRevert "GH-126491: GC: Mark objects reachable from roots before doing cycle collectio...
Hugo van Kemenade [Tue, 19 Nov 2024 09:25:09 +0000 (11:25 +0200)] 
Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)" (#126983)

11 months agogh-126594: Fix typeobject.c wrap_buffer() cast (#126754)
Victor Stinner [Tue, 19 Nov 2024 08:13:20 +0000 (09:13 +0100)] 
gh-126594: Fix typeobject.c wrap_buffer() cast (#126754)

Reject flags smaller than INT_MIN.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
11 months agogh-126876: Fix socket internal_select() for large timeout (#126968)
Victor Stinner [Tue, 19 Nov 2024 08:08:42 +0000 (09:08 +0100)] 
gh-126876: Fix socket internal_select() for large timeout (#126968)

If the timeout is larger than INT_MAX, replace it with INT_MAX, in
the poll() code path.

Add an unit test.

11 months agogh-126986: Drop _PyInterpreterState_FailIfNotRunning() (gh-126988)
Eric Snow [Tue, 19 Nov 2024 00:11:12 +0000 (17:11 -0700)] 
gh-126986: Drop _PyInterpreterState_FailIfNotRunning() (gh-126988)

We replace it with _PyErr_SetInterpreterAlreadyRunning().

11 months agogetpath: fix warning typo (#126978)
Filipe Laíns 🇵🇸 [Mon, 18 Nov 2024 23:50:01 +0000 (23:50 +0000)] 
getpath: fix warning typo (#126978)

11 months agoGH-126795: Increase the JIT threshold from 16 to 4096 (GH-126816)
Brandt Bucher [Mon, 18 Nov 2024 19:11:23 +0000 (11:11 -0800)] 
GH-126795: Increase the JIT threshold from 16 to 4096 (GH-126816)

11 months agogh-85957: Add missing MIME types for images with RFCs (#126966)
Hugo van Kemenade [Mon, 18 Nov 2024 18:13:20 +0000 (20:13 +0200)] 
gh-85957: Add missing MIME types for images with RFCs (#126966)

11 months agogh-123803: Support arbitrary code page encodings on Windows (GH-123804)
Serhiy Storchaka [Mon, 18 Nov 2024 17:45:25 +0000 (19:45 +0200)] 
gh-123803: Support arbitrary code page encodings on Windows (GH-123804)

If the cpXXX encoding is not directly implemented in Python, fall back
to use the Windows-specific API codecs.code_page_encode() and
codecs.code_page_decode().

11 months agogh-126911: Update credits output (#126913)
Stan U. [Mon, 18 Nov 2024 15:29:14 +0000 (15:29 +0000)] 
gh-126911: Update credits output (#126913)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months agoGH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH...
Mark Shannon [Mon, 18 Nov 2024 14:31:26 +0000 (14:31 +0000)] 
GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)

* Mark almost all reachable objects before doing collection phase

* Add stats for objects marked

* Visit new frames before each increment

* Remove lazy dict tracking

* Update docs

* Clearer calculation of work to do.

11 months agogh-109413: Enable `strict_optional = true` for `libregrtest/run_workers` (#126855)
sobolevn [Mon, 18 Nov 2024 14:23:43 +0000 (17:23 +0300)] 
gh-109413: Enable `strict_optional = true` for `libregrtest/run_workers` (#126855)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
11 months agogh-126909: Fix running xattr tests on systems with lower limits (#126930)
Michał Górny [Mon, 18 Nov 2024 13:05:55 +0000 (13:05 +0000)] 
gh-126909: Fix running xattr tests on systems with lower limits (#126930)

Modify the extended attribute tests to write fewer and smaller extended
attributes, in order to fit within filesystems with total xattr limit
of 1 KiB (e.g. ext4 with 1 KiB blocks).  Previously, the test would
write over 2 KiB, making it fail with ENOSPC on such systems.

11 months agogh-101955: Fix SystemError in possesive quantifier with alternative and group (GH...
Serhiy Storchaka [Mon, 18 Nov 2024 11:43:44 +0000 (13:43 +0200)] 
gh-101955: Fix SystemError in possesive quantifier with alternative and group (GH-111362)

Co-authored-by: <wjssz@users.noreply.github.com>
11 months agogh-67877: Fix memory leaks in terminated RE matching (GH-126840)
Serhiy Storchaka [Mon, 18 Nov 2024 09:53:45 +0000 (11:53 +0200)] 
gh-67877: Fix memory leaks in terminated RE matching (GH-126840)

If SRE(match) function terminates abruptly, either because of a signal
or because memory allocation fails, allocated SRE_REPEAT blocks might
be never released.

Co-authored-by: <wjssz@users.noreply.github.com>
11 months agogh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941)
Russell Keith-Magee [Mon, 18 Nov 2024 08:50:40 +0000 (16:50 +0800)] 
gh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941)

11 months agoDoc: Reorganize math module documentation (#126337)
Joseph Martinot-Lagarde [Mon, 18 Nov 2024 07:57:32 +0000 (08:57 +0100)] 
Doc: Reorganize math module documentation (#126337)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
11 months agogh-126167: Modify iOS Testbed to read arguments from Info.plist (#126169)
Russell Keith-Magee [Sun, 17 Nov 2024 23:43:41 +0000 (07:43 +0800)] 
gh-126167: Modify iOS Testbed to read arguments from Info.plist (#126169)

Modify iOS Testbed to read arguments from Info.plist.

11 months agogh-126896: Fix docs about `asyncio.start_server()` (#126897)
beavailable [Sun, 17 Nov 2024 19:32:35 +0000 (03:32 +0800)] 
gh-126896: Fix docs about `asyncio.start_server()` (#126897)

11 months agoGH-126920: fix Makefile overwriting sysconfig.get_config_vars
Filipe Laíns 🇵🇸 [Sun, 17 Nov 2024 01:56:01 +0000 (01:56 +0000)] 
GH-126920: fix Makefile overwriting sysconfig.get_config_vars

11 months agoGH-126789: fix some sysconfig data on late site initializations
Filipe Laíns 🇵🇸 [Sun, 17 Nov 2024 00:07:25 +0000 (00:07 +0000)] 
GH-126789: fix some sysconfig data on late site initializations

11 months agogh-124452: Fix header mismatches when folding/unfolding with email message (#125919)
RanKKI [Sat, 16 Nov 2024 23:01:52 +0000 (10:01 +1100)] 
gh-124452: Fix header mismatches when folding/unfolding with email message (#125919)

The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agoGH-126748: amend configure.rst description for the 'build_wasm' make target (#126687)
Hood Chatham [Sat, 16 Nov 2024 01:46:39 +0000 (02:46 +0100)] 
GH-126748: amend configure.rst description for the 'build_wasm' make target (#126687)

Clarified the documentation around how the build_wasm target is selected.

11 months agogh-126691: Remove --with-emscripten-target (#126787)
Hood Chatham [Sat, 16 Nov 2024 01:44:05 +0000 (02:44 +0100)] 
gh-126691: Remove --with-emscripten-target (#126787)

This unifies the code for nodejs and the code for the browser. After this
commit, the browser example doesn't work; this will be fixed in a
subsequent update.

11 months agoAdded a warning to the urljoin docs, indicating that it is not safe to use with attac...
Alex Gaynor [Fri, 15 Nov 2024 23:09:05 +0000 (18:09 -0500)] 
Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659)

This was flagged to me at a party today by someone who works in red-teaming as a frequently encountered footgun. Documenting the potentially unexpected behavior seemed like a good place to start.

11 months agoDocs: Miscellaneous corrections to simple statements in the language reference (GH...
Beomsoo Kim [Fri, 15 Nov 2024 21:02:34 +0000 (06:02 +0900)] 
Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720)

* Replace: The :keyword:`global` -> The :keyword:`global` statement
Add :keyword: when it's needed

* Replace repeated links with duoble backticks

11 months agogh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month...
Nadeshiko Manju [Fri, 15 Nov 2024 19:03:06 +0000 (03:03 +0800)] 
gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
11 months agoAdd PEP 761 to What's New (#126550)
Seth Michael Larson [Fri, 15 Nov 2024 15:54:56 +0000 (09:54 -0600)] 
Add PEP 761 to What's New (#126550)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months agogh-122549: Add platform.invalidate_caches() (#122547)
Bénédikt Tran [Fri, 15 Nov 2024 13:52:56 +0000 (14:52 +0100)] 
gh-122549: Add platform.invalidate_caches() (#122547)

Allow to invalidate platform's cached results.

11 months agoFix intermittent failures for the `PyUnstable_Object_EnableDeferredRefcount` tests...
Peter Bierma [Fri, 15 Nov 2024 13:03:46 +0000 (08:03 -0500)] 
Fix intermittent failures for the `PyUnstable_Object_EnableDeferredRefcount` tests (GH-126849)

Hotfix for the PyUnstable_Object_EnableDeferredRefcount tests.

11 months agogh-125063: marshal: Add version 5, improve documentation (GH-126829)
Petr Viktorin [Fri, 15 Nov 2024 12:48:57 +0000 (13:48 +0100)] 
gh-125063: marshal: Add version 5, improve documentation (GH-126829)

* Document that slices can be marshalled
* Deduplicate and organize the list of supported types
  in docs
* Organize the type code list in marshal.c, to make
  it more obvious that this is a versioned format
* Back-fill some historical info

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
11 months agogh-89083: small docs fixup for UUIDv8 (#126857)
Bénédikt Tran [Fri, 15 Nov 2024 12:26:38 +0000 (13:26 +0100)] 
gh-89083: small docs fixup for UUIDv8 (#126857)

11 months agogh-118973: Add _tkinter to freethreaded MSI (GH-126768)
Steve Dower [Fri, 15 Nov 2024 12:22:56 +0000 (12:22 +0000)] 
gh-118973: Add _tkinter to freethreaded MSI (GH-126768)

11 months agogh-126312: Don't traverse frozen objects on the free-threaded build (#126338)
Peter Bierma [Fri, 15 Nov 2024 10:21:30 +0000 (05:21 -0500)] 
gh-126312: Don't traverse frozen objects on the free-threaded build (#126338)

Also, _PyGC_Freeze() no longer freezes unreachable objects.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
11 months agogh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555)
George Alexopoulos [Fri, 15 Nov 2024 10:05:51 +0000 (12:05 +0200)] 
gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555)

For dlsym(), a return value of NULL does not necessarily indicate
an error [1].

Therefore, to avoid using stale (or NULL) dlerror() values, we must:

 1. clear the previous error state by calling dlerror()
 2. call dlsym()
 3. call dlerror()

If the return value of dlerror() is not NULL, an error occured.

In ctypes we choose to treat a NULL return value from dlsym()
as a "not found" error. This is the same as the fallback
message we use on Windows, Cygwin or when getting/formatting
the error reason fails.

[1]: https://man7.org/linux/man-pages/man3/dlsym.3.html

Signed-off-by: Georgios Alexopoulos <grgalex42@gmail.com>
Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
11 months agoGH-124567: Reduce overhead of debug build for GC. Should help CI performance (GH...
Mark Shannon [Fri, 15 Nov 2024 08:59:01 +0000 (08:59 +0000)] 
GH-124567: Reduce overhead of debug build for GC. Should help CI performance (GH-126777)

11 months agogh-103951: enable optimization for fast attribute access on module subclasses (GH...
Sergey B Kirpichev [Fri, 15 Nov 2024 08:03:38 +0000 (11:03 +0300)] 
gh-103951: enable optimization for fast attribute access on module subclasses (GH-126264)

Co-authored-by: Nicolas Tessore <n.tessore@ucl.ac.uk>
11 months agogh-126433: Update hacl-star (GH-126791)
Victor Stinner [Fri, 15 Nov 2024 00:22:50 +0000 (01:22 +0100)] 
gh-126433: Update hacl-star (GH-126791)

Retrieve the change: "Lib_Memzero0.c: Fix compiler warning on 32-bit Windows".

11 months agogh-126807: pygettext: Do not attempt to extract messages from function definitions...
Tomas R. [Thu, 14 Nov 2024 22:17:42 +0000 (23:17 +0100)] 
gh-126807: pygettext: Do not attempt to extract messages from function definitions. (GH-126808)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.

11 months agoGH-126766: `url2pathname()`: handle empty authority section. (#126767)
Barney Gale [Thu, 14 Nov 2024 20:22:14 +0000 (20:22 +0000)] 
GH-126766: `url2pathname()`: handle empty authority section. (#126767)

Discard two leading slashes from the beginning of a `file:` URI if they
introduce an empty authority section. As a result, file URIs like
`///etc/hosts` are correctly parsed as `/etc/hosts`.

11 months agogh-124111: Update tkinter for compatibility with Tcl/Tk 9.0.0 (GH-124156)
Marc Culler [Thu, 14 Nov 2024 18:45:08 +0000 (12:45 -0600)] 
gh-124111: Update tkinter for compatibility with Tcl/Tk 9.0.0 (GH-124156)