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

11 months agogh-126061: add new functions to `refcounts.dat` (#126788)
RUANG (James Roy) [Thu, 14 Nov 2024 14:04:38 +0000 (22:04 +0800)] 
gh-126061: add new functions to `refcounts.dat` (#126788)

11 months agoGH-117759: Update GC docs for incremental collection (GH-126695)
Mark Shannon [Thu, 14 Nov 2024 09:50:00 +0000 (09:50 +0000)] 
GH-117759: Update GC docs for incremental collection (GH-126695)

11 months agogh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182)
Petr Viktorin [Thu, 14 Nov 2024 08:31:14 +0000 (09:31 +0100)] 
gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182)

* gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance

This changes nothing changes for CPython supported platforms,
but hints how to deal with platforms that stick to the letter of
the spec.
It also marks `socket.getaddrinfo` as a wrapper around `getaddrinfo(3)`;
specifically, workarounds to make the function work consistently across
platforms are out of scope in its code.

Include wording similar to the POSIX's “by providing options and by
limiting the returned information”, which IMO suggests that the
hints limit the resulting list compared to the defaults, *but* can
be interpreted differently. Details are added in a note.

Specifically say that this wraps the underlying C function. So, the
details are in OS docs. The “full range of results” bit goes away.

Use `AF_UNSPEC` rather than zero for the *family* default, although
I don't think a system where it's nonzero would be very usable.

Suggest setting proto and/or type (with examples, as the appropriate
values aren't obvious). Say why you probably want to do that that
on all systems; mention the behavior on the “letter of the spec”
systems.

Suggest that the results should be tried in order, which is,
AFAIK best practice -- see RFC 6724 section 2, and its predecessor
from 2003 (which are specific to IP, but indicate how people use this):

> Well-behaved applications SHOULD iterate through the list of
> addresses returned from `getaddrinfo()` until they find a working address.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
11 months agoDocument that return-less user-defined functions return None (#126769)
John Marshall [Thu, 14 Nov 2024 07:47:24 +0000 (20:47 +1300)] 
Document that return-less user-defined functions return None (#126769)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
11 months agoDoc: Recommend shlex.quote alongside pipes removal (#126570)
Colin Watson [Thu, 14 Nov 2024 05:01:35 +0000 (05:01 +0000)] 
Doc: Recommend shlex.quote alongside pipes removal (#126570)

One of the most common reasons I see the old `pipes` module still in use
when porting to Python 3.13 is for the undocumented `pipes.quote`
function, which can easily be replaced with `shlex.quote`.  I think it's
worth specifically calling this out, since being directed to the
`subprocess` module would be confusing in this case.

11 months agogh-126731: Update outdated project information in `pprint.pp` doc (#126732)
Wulian [Thu, 14 Nov 2024 04:58:06 +0000 (12:58 +0800)] 
gh-126731: Update outdated project information in `pprint.pp` doc (#126732)

11 months agoAdd Savannah to CODEOWNERS for argparse and the JIT (#126814)
Savannah Ostrowski [Wed, 13 Nov 2024 23:45:08 +0000 (15:45 -0800)] 
Add Savannah to CODEOWNERS for argparse and the JIT (#126814)

Add Savannah to CODEOWNERS

11 months agoGH-118289: Fix handling of non-directories in `posixpath.realpath()` (#120127)
Barney Gale [Wed, 13 Nov 2024 22:59:32 +0000 (22:59 +0000)] 
GH-118289: Fix handling of non-directories in `posixpath.realpath()` (#120127)

In strict mode, raise `NotADirectoryError` if we encounter a non-directory
while we still have path parts left to process.

We use a `part_count` variable rather than `len(rest)` because the `rest`
stack also contains markers for unresolved symlinks.

11 months agoGH-126606: don't write incomplete pyc files (GH-126627)
CF Bolz-Tereick [Wed, 13 Nov 2024 21:39:10 +0000 (22:39 +0100)] 
GH-126606: don't write incomplete pyc files (GH-126627)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Brett Cannon <brett@python.org>
11 months agogh-126188: Update bundled pip to 24.3.1 (gh-126805)
Stéphane Bidoul [Wed, 13 Nov 2024 20:58:57 +0000 (21:58 +0100)] 
gh-126188: Update bundled pip to 24.3.1 (gh-126805)

Update bundled pip to 24.3.1

11 months agogh-89640: Pull in update to float word order detection in autoconf-archive (#126747)
Hood Chatham [Wed, 13 Nov 2024 20:57:33 +0000 (21:57 +0100)] 
gh-89640: Pull in update to float word order detection in autoconf-archive (#126747)

11 months agogh-126390: Support for preserving order of options and nonoption arguments in gnu_get...
Serhiy Storchaka [Wed, 13 Nov 2024 20:50:46 +0000 (22:50 +0200)] 
gh-126390: Support for preserving order of options and nonoption arguments in gnu_getopt() (GH-126393)

11 months agogh-109413: Enable `strict_optional` for `libregrtest/main.py` (#126394)
sobolevn [Wed, 13 Nov 2024 19:29:28 +0000 (22:29 +0300)] 
gh-109413: Enable `strict_optional` for `libregrtest/main.py` (#126394)

11 months agogh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792)
Seth Michael Larson [Wed, 13 Nov 2024 18:31:20 +0000 (12:31 -0600)] 
gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792)

Update libexpat to 2.6.4, make future updates easier.

11 months agogh-123465: Ensure PyType_FromMetaclass avoids extra strcmp (GH-125460)
neonene [Wed, 13 Nov 2024 17:09:26 +0000 (02:09 +0900)] 
gh-123465: Ensure PyType_FromMetaclass avoids extra strcmp (GH-125460)

use else

11 months agogh-126456: Fix _pyrepl curses tigetstr() (#126472)
Victor Stinner [Wed, 13 Nov 2024 16:46:10 +0000 (17:46 +0100)] 
gh-126456: Fix _pyrepl curses tigetstr() (#126472)

11 months agogh-123619: Add an unstable C API function for enabling deferred reference counting...
Peter Bierma [Wed, 13 Nov 2024 13:27:16 +0000 (08:27 -0500)] 
gh-123619: Add an unstable C API function for enabling deferred reference counting (GH-123635)

Co-authored-by: Sam Gross <colesbury@gmail.com>
11 months agogh-126175: Add attributes to TOMLDecodeError. Deprecate free-form `__init__` args...
Taneli Hukkinen [Wed, 13 Nov 2024 12:52:16 +0000 (14:52 +0200)] 
gh-126175: Add attributes to TOMLDecodeError. Deprecate free-form `__init__` args (GH-126428)

11 months agogh-126341: add release check to `__iter__` method of `memoryview` (#126759)
Ritvik Pasham [Wed, 13 Nov 2024 11:51:01 +0000 (06:51 -0500)] 
gh-126341: add release check to `__iter__` method of `memoryview` (#126759)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
11 months agogh-71936: Fix race condition in multiprocessing.Pool (GH-124973)
Petr Viktorin [Wed, 13 Nov 2024 09:25:10 +0000 (10:25 +0100)] 
gh-71936: Fix race condition in multiprocessing.Pool (GH-124973)

* gh-71936: Fix race condition in multiprocessing.Pool

Proxes of shared objects register a Finalizer in BaseProxy._incref(), and it
will call BaseProxy._decref() when it is GCed. This may cause a race condition
with Pool(maxtasksperchild=None) on Windows.

A connection would be closed and raised TypeError when a GC occurs between
_ConnectionBase._check_writable() and _ConnectionBase._send_bytes() in
_ConnectionBase.send() in the second or later task, and a new object
is allocated that shares the id() of a previously deleted one.

Instead of using the id() of the token (or the proxy), use a unique,
non-reusable number.

Co-Authored-By: Akinori Hattori <hattya@gmail.com>
11 months agogh-104745: Limit starting a patcher more than once without stopping it (#126649)
Red4Ru [Wed, 13 Nov 2024 08:20:38 +0000 (11:20 +0300)] 
gh-104745: Limit starting a patcher more than once without stopping it (#126649)

Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agobpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (#30196)
Andrew Svetlov [Wed, 13 Nov 2024 04:24:33 +0000 (05:24 +0100)] 
bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (#30196)

* Strip IsolatedAsyncioTestCase frames from reported stacktraces

* Update Misc/NEWS.d/next/Library/2021-12-19-10-47-24.bpo-46128.Qv3EK1.rst

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
---------

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
11 months agogh-126757: fix minor typo (GH-126758)
Yuxuan Zhang [Tue, 12 Nov 2024 21:23:40 +0000 (16:23 -0500)] 
gh-126757: fix minor typo (GH-126758)

11 months agogh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)
Nice Zombies [Tue, 12 Nov 2024 21:18:03 +0000 (22:18 +0100)] 
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)

11 months agogh-126688: Reinit import lock after fork (#126692)
Sam Gross [Tue, 12 Nov 2024 20:53:58 +0000 (20:53 +0000)] 
gh-126688: Reinit import lock after fork (#126692)

The PyMutex implementation supports unlocking after fork because we
clear the list of waiters in parking_lot.c. This doesn't work as well
for _PyRecursiveMutex because on some systems, such as SerenityOS, the
thread id is not preserved across fork().

11 months agoGH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)
Barney Gale [Tue, 12 Nov 2024 19:52:30 +0000 (19:52 +0000)] 
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)

Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.

11 months agogh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)
Serhiy Storchaka [Tue, 12 Nov 2024 19:10:29 +0000 (21:10 +0200)] 
gh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)

Accepting objects with false values (like 0 and []) except empty strings
and byte-like objects and None in urllib.parse functions parse_qsl() and
parse_qs() is now deprecated.

11 months agogh-89083: add support for UUID version 8 (RFC 9562) (#123224)
Bénédikt Tran [Tue, 12 Nov 2024 18:08:49 +0000 (19:08 +0100)] 
gh-89083: add support for UUID version 8 (RFC 9562) (#123224)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months agogh-126705: Make os.PathLike more like a protocol (#126706)
Stephen Morton [Tue, 12 Nov 2024 17:54:13 +0000 (09:54 -0800)] 
gh-126705: Make os.PathLike more like a protocol (#126706)

it can now be used as a base class in other protocols

11 months agogh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)
Eric Snow [Tue, 12 Nov 2024 17:41:51 +0000 (10:41 -0700)] 
gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)

These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

This involves the following:

* add the _PyXI_GET_STATE() and _PyXI_GET_GLOBAL_STATE() macros
* add _PyXIData_lookup_context_t and _PyXIData_GetLookupContext()
* add _Py_xi_state_init() and _Py_xi_state_fini()

11 months agogh-95382: Use cache for indentations in the JSON encoder (GH-118636)
Serhiy Storchaka [Tue, 12 Nov 2024 17:19:15 +0000 (19:19 +0200)] 
gh-95382: Use cache for indentations in the JSON encoder (GH-118636)

11 months agogh-126133: Only use start year in PSF copyright, remove end years (#126236)
Hugo van Kemenade [Tue, 12 Nov 2024 13:59:19 +0000 (15:59 +0200)] 
gh-126133: Only use start year in PSF copyright, remove end years (#126236)

11 months agogh-126061: Add PyLong_IsPositive/Zero/Negative() functions (#126065)
RUANG (James Roy) [Tue, 12 Nov 2024 13:18:06 +0000 (21:18 +0800)] 
gh-126061: Add PyLong_IsPositive/Zero/Negative() functions (#126065)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agogh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917)
Sayandip Dutta [Tue, 12 Nov 2024 13:11:58 +0000 (18:41 +0530)] 
gh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917)

11 months agogh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)
Bénédikt Tran [Tue, 12 Nov 2024 13:10:10 +0000 (14:10 +0100)] 
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)

11 months agogh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (#126733)
Kumar Aditya [Tue, 12 Nov 2024 12:31:34 +0000 (18:01 +0530)] 
gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (#126733)

11 months agogh-126209: Fix inconsistency of `skip_file_prefixes` in `warnings.warn`'s C and...
Daehee Kim [Tue, 12 Nov 2024 12:01:56 +0000 (21:01 +0900)] 
gh-126209: Fix inconsistency of  `skip_file_prefixes` in `warnings.warn`'s C and Python implementations (GH-126329)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
11 months agogh-126525: Fix `makeunicodedata.py` output on macOS and Windows (#126526)
sobolevn [Tue, 12 Nov 2024 10:23:57 +0000 (13:23 +0300)] 
gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (#126526)

11 months agogh-126699: allow AsyncIterator to be used as a base for Protocols (#126702)
Stephen Morton [Tue, 12 Nov 2024 09:17:07 +0000 (01:17 -0800)] 
gh-126699: allow AsyncIterator to be used as a base for Protocols (#126702)

11 months agoFix error message of "Check if Autoconf files are up to date" job (#126683)
sobolevn [Tue, 12 Nov 2024 07:51:13 +0000 (10:51 +0300)] 
Fix error message of "Check if Autoconf files are up to date" job (#126683)

11 months agogh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts (#20199)
Sahil Prajapati [Tue, 12 Nov 2024 06:48:38 +0000 (12:18 +0530)] 
gh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts (#20199)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months agoGH-126195: Use M1 JIT memory protection APIs (GH-126196)
Diego Russo [Tue, 12 Nov 2024 01:20:10 +0000 (01:20 +0000)] 
GH-126195: Use M1 JIT memory protection APIs (GH-126196)

11 months agogh-58749: Remove incorrect language spec claims about the global statement (GH-126523)
Beomsoo Kim [Tue, 12 Nov 2024 00:11:40 +0000 (09:11 +0900)] 
gh-58749: Remove incorrect language spec claims about the global statement (GH-126523)

* Removes erroneous explanation of the `global` statement restrictions; a name declared as global can be subsequently bound using any kind of name binding operation.
* Updates `test_global.py` to also test various name-binding scenarios for global
variables to ensure correct behavior

11 months agogh-76785: Improved Subinterpreters Compatibility with 3.12 (1/2) (gh-126704)
Eric Snow [Mon, 11 Nov 2024 22:58:46 +0000 (15:58 -0700)] 
gh-76785: Improved Subinterpreters Compatibility with 3.12 (1/2) (gh-126704)

These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

This involves the following:

* rename several structs and typedefs
* add several typedefs
* stop using the PyThreadState.state field directly in parking_lot.c

11 months agoDocs: re-create pages for removed modules to document their removal. (#126622)
Ned Batchelder [Mon, 11 Nov 2024 22:49:48 +0000 (17:49 -0500)] 
Docs: re-create pages for removed modules to document their removal. (#126622)

Will also need to change the redirects that were created here:
https://github.com/python/psf-salt/pull/521/files

11 months agogh-126413: Add translation tests for getopt and optparse (GH-126698)
Tomas R. [Mon, 11 Nov 2024 22:16:39 +0000 (23:16 +0100)] 
gh-126413: Add translation tests for getopt and optparse (GH-126698)

11 months agogh-76785: Minor Cleanup of Exception-related Cross-interpreter State (gh-126602)
Eric Snow [Mon, 11 Nov 2024 21:49:41 +0000 (14:49 -0700)] 
gh-76785: Minor Cleanup of Exception-related Cross-interpreter State (gh-126602)

This change makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

11 months agogh-89416: Add RFC 9559 MIME types for Matroska formats (#126412)
Hugo van Kemenade [Mon, 11 Nov 2024 21:08:54 +0000 (23:08 +0200)] 
gh-89416: Add RFC 9559 MIME types for Matroska formats (#126412)

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
11 months agogh-84559: gh-103134: Whats new 3.14 entries for multiprocessing. (GH-126697)
Gregory P. Smith [Mon, 11 Nov 2024 19:19:08 +0000 (11:19 -0800)] 
gh-84559: gh-103134: Whats new 3.14 entries for multiprocessing. (GH-126697)

11 months agoUpdate documentation links to Microsoft's documentation pages (GH-126379)
谭九鼎 [Mon, 11 Nov 2024 17:10:49 +0000 (01:10 +0800)] 
Update documentation links to Microsoft's documentation pages (GH-126379)

11 months agogh-126374: Add support of options with optional arguments in the getopt module (GH...
Serhiy Storchaka [Mon, 11 Nov 2024 16:29:28 +0000 (18:29 +0200)] 
gh-126374: Add support of options with optional arguments in the getopt module (GH-126375)

11 months agogh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalActio...
Serhiy Storchaka [Mon, 11 Nov 2024 16:28:30 +0000 (18:28 +0200)] 
gh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalAction (GH-125894)

They never worked correctly.

11 months agogh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557)
Serhiy Storchaka [Mon, 11 Nov 2024 16:27:26 +0000 (18:27 +0200)] 
gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557)

* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region

11 months agogh-126654: Fix crash in several functions in `_interpreters` module (#126678)
sobolevn [Mon, 11 Nov 2024 11:35:56 +0000 (14:35 +0300)] 
gh-126654: Fix crash in several functions in `_interpreters` module (#126678)

11 months agogh-126417: validate ABC methods on multiprocessing proxy types (#126454)
Stephen Morton [Mon, 11 Nov 2024 07:08:58 +0000 (23:08 -0800)] 
gh-126417: validate ABC methods on multiprocessing proxy types (#126454)

Checks that appropriate dunder __ methods exist on the dict and list proxy types.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
11 months agoAdd missing fullstop `.` to whatsnew/3.8.rst (GH-126553)
Rafael Fontenelle [Mon, 11 Nov 2024 06:59:23 +0000 (03:59 -0300)] 
Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553)

11 months agogh-126664: Use `else` instead of `finally` in "The with statement" documentation...
vivodi [Mon, 11 Nov 2024 06:47:56 +0000 (14:47 +0800)] 
gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)

11 months agogh-117378: Clear up the NEWS entry wording (GH-126634)
Gregory P. Smith [Mon, 11 Nov 2024 06:39:58 +0000 (22:39 -0800)] 
gh-117378: Clear up the NEWS entry wording (GH-126634)

gh-117378: Clear up the NEWS entry wording.

Docs are hard.  Lets go shopping!

11 months agogh-126543: Docs: change "bound type var" to "bounded" when used in the context of...
Pedro Fonini [Mon, 11 Nov 2024 00:40:25 +0000 (21:40 -0300)] 
gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (#126584)

12 months agogh-126647: `Doc/using/configure.rst`: Add an entry for ``--enable-experimental-jit...
Kirill Podoprigora [Sun, 10 Nov 2024 21:44:56 +0000 (23:44 +0200)] 
gh-126647: `Doc/using/configure.rst`: Add an entry for ``--enable-experimental-jit`` option (#126648)

Add an entry for the ``--enable-experimental-jit`` option in ``Doc/using/configure.rst``.
This was added as an experimental option in CPython 3.13.
Possible values for it:
* `no` - don't build the JIT.
* `yes` - build the JIT.
* `yes-off` - build the JIT but disable it by default.
* `interpreter` - don't build the JIT but enable tier 2 interpreter instead.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
12 months agogh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)
Gregory P. Smith [Sun, 10 Nov 2024 21:17:05 +0000 (13:17 -0800)] 
gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)

The first version had it running two forkserver and one spawn tests underneath each of the _fork, _forkserver, and _spawn test suites that build off the generic one.

This adds to the existing complexity of the multiprocessing test suite by offering BaseTestCase classes another attribute to control which suites they are invoked under. Practicality vs purity here. :/

Net result: we don't over-run the new test and their internal logic is simplified.

12 months agoSkip test in test_socket.py if `sys.getrefcount` isn't available (#126640)
CF Bolz-Tereick [Sun, 10 Nov 2024 15:16:36 +0000 (16:16 +0100)] 
Skip test in test_socket.py if `sys.getrefcount` isn't available (#126640)

Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.

12 months agogh-126565: Skip `zipfile.Path.exists` check in write mode (#126576)
Jan Hicken [Sun, 10 Nov 2024 14:57:24 +0000 (15:57 +0100)] 
gh-126565: Skip `zipfile.Path.exists` check in write mode (#126576)

When `zipfile.Path.open` is called, the implementation will check
whether the path already exists in the ZIP file. However, this check is
only required when the ZIP file is in read mode. By swapping arguments
of the `and` operator, the short-circuiting will prevent the check from
being run in write mode.

This change will improve the performance of `open()`, because checking
whether a file exists is slow in write mode, especially when the archive
has many members.

12 months agoPostpone `module.__loader__` deprecation to Python 3.16 (#126482)
Hugo van Kemenade [Sun, 10 Nov 2024 00:48:33 +0000 (02:48 +0200)] 
Postpone `module.__loader__` deprecation to Python 3.16 (#126482)

12 months agogh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)
Gregory P. Smith [Sat, 9 Nov 2024 23:01:32 +0000 (15:01 -0800)] 
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)

gh-117378: Fix multiprocessing forkserver preload sys.path inheritance.

`sys.path` was not properly being sent from the parent process when launching
the multiprocessing forkserver process to preload imports.  This bug has been
there since the forkserver start method was introduced in Python 3.4.  It was
always _supposed_ to inherit `sys.path` the same way the spawn method does.

Observable behavior change: A `''` value in `sys.path` will now be replaced in
the forkserver's `sys.path` with an absolute pathname
`os.path.abspath(os.getcwd())` saved at the time that `multiprocessing` was
imported in the parent process as it already was when using the spawn start
method. **This will only be observable during forkserver preload imports**.

The code invoked before calling things in another process already correctly sets `sys.path`.
Which is likely why this went unnoticed for so long as a mere performance issue in
some configurations.

A workaround for the bug on impacted Pythons is to set PYTHONPATH in the
environment before multiprocessing's forkserver process was started. Not perfect
as that is then inherited by other children, etc, but likely good enough for many
people's purposes.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
12 months agopathlib ABCs: tighten up `resolve()` and `absolute()` (#126611)
Barney Gale [Sat, 9 Nov 2024 18:47:49 +0000 (18:47 +0000)] 
pathlib ABCs: tighten up `resolve()` and `absolute()` (#126611)

In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.

12 months agopathlib ABCs: support initializing paths with no arguments (#126608)
Barney Gale [Sat, 9 Nov 2024 18:21:53 +0000 (18:21 +0000)] 
pathlib ABCs: support initializing paths with no arguments (#126608)

In the past I've equivocated about whether to require at least one argument
in the `PurePathBase` (and `PathBase`) initializer, and what the default
should be if we make it optional. I now have a local use case that has
persuaded me to make it optional and default to the empty string (a
`zipp.Path`-like class that treats relative and absolute paths similarly.)
Happily this brings the base class more in line with `PurePath` and `Path`.

12 months agogh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)
Ken Jin [Sat, 9 Nov 2024 03:35:33 +0000 (11:35 +0800)] 
gh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
12 months agogh-126187 Add emscripten.py script to automate emscripten build (#126190)
Hood Chatham [Sat, 9 Nov 2024 02:12:55 +0000 (03:12 +0100)] 
gh-126187 Add emscripten.py script to automate emscripten build (#126190)

Add emscripten.py script to automate emscripten build.

This is modeled heavily on `Tools/wasm/wasi.py`. This will form the basis of an Emscripten build bot.

12 months agoGH-126212: Fix removal of slashes in file URIs on Windows (#126214)
Barney Gale [Fri, 8 Nov 2024 16:47:51 +0000 (16:47 +0000)] 
GH-126212: Fix removal of slashes in file URIs on Windows (#126214)

Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they
don't remove slashes from Windows DOS drive paths and URLs. There was no
basis for this behaviour, and it conflicts with how UNC and POSIX paths are
handled.

12 months agoGH-126547: Pre-assign version numbers for a few common classes (GH-126551)
Mark Shannon [Fri, 8 Nov 2024 16:44:44 +0000 (16:44 +0000)] 
GH-126547: Pre-assign version numbers for a few common classes (GH-126551)

12 months agogh-126497: Add missing venv redirectors to freethreaded installer (GH-126556)
Steve Dower [Fri, 8 Nov 2024 16:09:34 +0000 (16:09 +0000)] 
gh-126497: Add missing venv redirectors to freethreaded installer (GH-126556)

12 months agogh-125298: Remove misleading text in os.kill documentation (GH-125749)
RUANG (James Roy) [Fri, 8 Nov 2024 15:29:16 +0000 (23:29 +0800)] 
gh-125298: Remove misleading text in os.kill documentation (GH-125749)

Windows has not accepted process handles in many releases.

12 months agogh-126072: Set docstring attribute for module and class (#126231)
Xuanteng Huang [Fri, 8 Nov 2024 15:13:18 +0000 (23:13 +0800)] 
gh-126072: Set docstring attribute for module and class (#126231)

12 months agoremove minor redundant code from `_asyncio` (#126578)
Kumar Aditya [Fri, 8 Nov 2024 13:17:03 +0000 (18:47 +0530)] 
remove minor redundant code from `_asyncio` (#126578)

12 months agogh-126579: Adapt sys.audit() to Argument Clinic (GH-126580)
Serhiy Storchaka [Fri, 8 Nov 2024 13:11:44 +0000 (15:11 +0200)] 
gh-126579: Adapt sys.audit() to Argument Clinic (GH-126580)

12 months agoGH-107803: use circular double linked list for tasks in `_asyncio` (#126577)
Kumar Aditya [Fri, 8 Nov 2024 12:51:11 +0000 (18:21 +0530)] 
GH-107803: use circular double linked list for tasks in `_asyncio` (#126577)

12 months agogh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)
Serhiy Storchaka [Fri, 8 Nov 2024 12:23:50 +0000 (14:23 +0200)] 
gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)

Remove _PyArg_UnpackKeywordsWithVararg.
Add comments for integer arguments of _PyArg_UnpackKeywords.

12 months agogh-122943: Move code generation for var-positional parameter to converters (GH-126575)
Serhiy Storchaka [Fri, 8 Nov 2024 12:12:15 +0000 (14:12 +0200)] 
gh-122943: Move code generation for var-positional parameter to converters (GH-126575)

12 months agogh-89640: Restore configure error message on failure to detect float word order ...
Hood Chatham [Fri, 8 Nov 2024 11:57:17 +0000 (12:57 +0100)] 
gh-89640: Restore configure error message on failure to detect float word order (#126569)

Before #126387, if we didn't detect float word order we'd raise the following
configure error:

    Unknown float word ordering. You need to manually preset
    ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This puts it back (except for ARM or WASM, which as hardcoded).

12 months agogh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566)
Valery Fedorenko [Fri, 8 Nov 2024 10:19:15 +0000 (13:19 +0300)] 
gh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566)

12 months agogh-122943: Remove the object converter for var-positional parameter (GH-126560)
Serhiy Storchaka [Fri, 8 Nov 2024 05:41:54 +0000 (07:41 +0200)] 
gh-122943: Remove the object converter for var-positional parameter (GH-126560)

12 months agogh-120017: use 'do-while(0)' in some `{codegen,compile}.c` multi-line macros (#120018)
Bénédikt Tran [Thu, 7 Nov 2024 23:03:11 +0000 (00:03 +0100)] 
gh-120017: use 'do-while(0)' in some `{codegen,compile}.c` multi-line macros (#120018)