]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
6 months agogh-132775: Add _PyPickle_GetXIData() (gh-133107)
Eric Snow [Wed, 30 Apr 2025 23:34:05 +0000 (17:34 -0600)] 
gh-132775: Add _PyPickle_GetXIData() (gh-133107)

There's some extra complexity due to making sure we we get things right when handling functions and classes defined in the __main__ module.  This is also reflected in the tests, including the addition of extra functions in test.support.import_helper.

6 months agoGH-125515: Remove two unused error branches. (#133181)
Russell Keith-Magee [Wed, 30 Apr 2025 22:21:57 +0000 (06:21 +0800)] 
GH-125515: Remove two unused error branches. (#133181)

Remove two unused error branches in the generated bytecode handling.

6 months agogh-133153: Use rlcompleter for pdb's interact command (#133176)
Tian Gao [Wed, 30 Apr 2025 22:19:13 +0000 (15:19 -0700)] 
gh-133153: Use rlcompleter for pdb's interact command (#133176)

6 months agogh-133213: Add tests for `string.templatelib.TemplateIter` (#133215)
sobolevn [Wed, 30 Apr 2025 19:38:25 +0000 (22:38 +0300)] 
gh-133213: Add tests for `string.templatelib.TemplateIter` (#133215)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
6 months agogh-132775: Add _PyCode_GetVarCounts() (gh-133128)
Eric Snow [Wed, 30 Apr 2025 18:19:20 +0000 (12:19 -0600)] 
gh-132775: Add _PyCode_GetVarCounts() (gh-133128)

This helper is useful in a variety of ways, including in demonstrating how the different counts relate to one another.

It will be used in a later change to help identify if a function is "stateless", meaning it doesn't have any free vars or globals.

Note that a majority of this change is tests.

6 months agoGH-114809: Add support for macOS multi-arch builds with the JIT enabled (#131751)
Savannah Ostrowski [Wed, 30 Apr 2025 18:03:57 +0000 (11:03 -0700)] 
GH-114809: Add support for macOS multi-arch builds with the JIT enabled (#131751)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
6 months agoApply 'mod' role to typing module (#133201)
Rafael Fontenelle [Wed, 30 Apr 2025 16:52:03 +0000 (13:52 -0300)] 
Apply 'mod' role to typing module (#133201)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
6 months agogh-133197: Improve error message for `ft""` and `bt""` cases (#133202)
sobolevn [Wed, 30 Apr 2025 16:20:44 +0000 (19:20 +0300)] 
gh-133197: Improve error message for `ft""` and `bt""` cases (#133202)

6 months agoRemove redundant ``--keep-going`` when running Sphinx (#133156)
Hugo van Kemenade [Wed, 30 Apr 2025 16:12:28 +0000 (19:12 +0300)] 
Remove redundant ``--keep-going`` when running Sphinx (#133156)

6 months agogh-133211: Test that PEP750 types are final (#133212)
sobolevn [Wed, 30 Apr 2025 16:03:19 +0000 (19:03 +0300)] 
gh-133211: Test that PEP750 types are final (#133212)

6 months agogh-133167: Fix compilation process with `--enable-optimizations` and `--without-docst...
sobolevn [Wed, 30 Apr 2025 13:41:50 +0000 (16:41 +0300)] 
gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (#133187)

6 months agogh-87135: test_threading: Wait on thread, not an Event it sets (GH-133198)
Petr Viktorin [Wed, 30 Apr 2025 13:14:24 +0000 (15:14 +0200)] 
gh-87135: test_threading: Wait on thread, not an Event it sets (GH-133198)

When the event is set the thread might not be done yet.

This is a fix-up for commit 4ebbfcf30e0e2d87ff6036d4d1de0f6f0ef7c46a

6 months agogh-131591: Add tests for _PdbClient (#132976)
Matt Wozniski [Wed, 30 Apr 2025 13:09:41 +0000 (09:09 -0400)] 
gh-131591: Add tests for _PdbClient (#132976)

6 months agogh-89867: string.Formatter auto numbering doc updates (GH-129617)
dgpb [Wed, 30 Apr 2025 12:24:40 +0000 (15:24 +0300)] 
gh-89867: string.Formatter auto numbering doc updates (GH-129617)

6 months agogh-133194: Add `CHECK_VERSION` to new PEP758 grammar (#133195)
sobolevn [Wed, 30 Apr 2025 10:39:26 +0000 (13:39 +0300)] 
gh-133194: Add `CHECK_VERSION` to new PEP758 grammar (#133195)

6 months agoGH-124715: Move trashcan mechanism into `Py_Dealloc` (GH-132280)
Mark Shannon [Wed, 30 Apr 2025 10:37:53 +0000 (11:37 +0100)] 
GH-124715: Move trashcan mechanism into `Py_Dealloc` (GH-132280)

6 months agogh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86 (#133155)
Victor Stinner [Wed, 30 Apr 2025 10:01:06 +0000 (12:01 +0200)] 
gh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86 (#133155)

Reduce also the number of iterations from 1000 to 10 to ease
debugging failures and prevent "command line too line" error when
tests are re-run.

6 months agogh-132661: Implement PEP 750 (#132662)
Lysandros Nikolaou [Wed, 30 Apr 2025 09:46:41 +0000 (11:46 +0200)] 
gh-132661: Implement PEP 750 (#132662)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
6 months agogh-133117: Run mypy on `tomllib` in CI (#133118)
sobolevn [Wed, 30 Apr 2025 08:45:58 +0000 (11:45 +0300)] 
gh-133117: Run mypy on `tomllib` in CI (#133118)

6 months agoRemove trailing whitespace from python.gram (#133175)
Rafael Fontenelle [Wed, 30 Apr 2025 08:35:15 +0000 (05:35 -0300)] 
Remove trailing whitespace from python.gram (#133175)

6 months agogh-127604: Optimize -ldl usage on platforms that use dlopen for libFFI. (#133081)
Russell Keith-Magee [Wed, 30 Apr 2025 08:28:31 +0000 (16:28 +0800)] 
gh-127604: Optimize -ldl usage on platforms that use dlopen for libFFI. (#133081)

Optimize -ldl usage on platforms that use dlopen for libFFI.

6 months agoAdd `profile-gen-stamp` to `.gitignore` (#133188)
sobolevn [Wed, 30 Apr 2025 07:53:45 +0000 (10:53 +0300)] 
Add `profile-gen-stamp` to `.gitignore` (#133188)

6 months agogh-116436: Improve error message when TypeError occurs during dict update (#116443)
Shantanu [Wed, 30 Apr 2025 05:18:06 +0000 (22:18 -0700)] 
gh-116436: Improve error message when TypeError occurs during dict update (#116443)

6 months agogh-133036: Deprecate codecs.open (#133038)
Inada Naoki [Wed, 30 Apr 2025 01:11:09 +0000 (10:11 +0900)] 
gh-133036: Deprecate codecs.open (#133038)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
6 months agoGet rid of ERROR_IF's "label" parameter (GH-132654)
Brandt Bucher [Wed, 30 Apr 2025 00:21:53 +0000 (17:21 -0700)] 
Get rid of ERROR_IF's "label" parameter (GH-132654)

6 months agoGH-125515: Mark code after "return" as unreachable in the cases generator (#133178)
Brandt Bucher [Wed, 30 Apr 2025 00:21:14 +0000 (17:21 -0700)] 
GH-125515: Mark code after "return" as unreachable in the cases generator (#133178)

Mark code after "return" as unreachable

6 months agogh-133131: Discover an appropriate iOS simulator rather than hard-coding iPhone SE...
Russell Keith-Magee [Tue, 29 Apr 2025 21:35:36 +0000 (05:35 +0800)] 
gh-133131: Discover an appropriate iOS simulator rather than hard-coding iPhone SE 3rd gen (#133132)

Determines a candidate simulator at runtime rather than hardcoding iPhone SE.

6 months agogh-120220: Deprecate legacy methods for tracing variables in Tkinter (GH-120223)
Serhiy Storchaka [Tue, 29 Apr 2025 17:26:51 +0000 (20:26 +0300)] 
gh-120220: Deprecate legacy methods for tracing variables in Tkinter (GH-120223)

They do not work with Tcl 9.0.
Use new methods added in Python 3.6.

6 months agoDocs: fix typo in `InternalDocs/garbage_collector.md` (gh-133151)
Yongzi Li [Tue, 29 Apr 2025 17:20:50 +0000 (01:20 +0800)] 
Docs: fix typo in `InternalDocs/garbage_collector.md` (gh-133151)

Fix typo in `InternalDocs/garbage_collector.md`.

6 months agoGH-132508: Use tagged integers on the evaluation stack for the last instruction offse...
Mark Shannon [Tue, 29 Apr 2025 17:00:35 +0000 (18:00 +0100)] 
GH-132508: Use tagged integers on the evaluation stack for the last instruction offset (GH-132545)

6 months agogh-121468: Support async breakpoint in pdb (#132576)
Tian Gao [Tue, 29 Apr 2025 16:28:24 +0000 (09:28 -0700)] 
gh-121468: Support async breakpoint in pdb (#132576)

6 months agogh-132987: Support __index__() in the socket module (GH-133093)
Serhiy Storchaka [Tue, 29 Apr 2025 16:27:07 +0000 (19:27 +0300)] 
gh-132987: Support __index__() in the socket module (GH-133093)

ntohl(), htonl(), if_indextoname(), getaddrinfo() now use __index__() if
available.

Also fix the Argument Clinic names for module-level functions (although
this does not affect the user).

6 months agogh-132987: Support __index__() in the stat module (GH-133097)
Serhiy Storchaka [Tue, 29 Apr 2025 16:25:44 +0000 (19:25 +0300)] 
gh-132987: Support __index__() in the stat module (GH-133097)

Use it for the mode arguments in filemode(), S_IMODE(), S_ISDIR(), etc.

6 months agoGH-130328: pasting in new REPL is slow on Windows (GH-132884)
Chris Eibl [Tue, 29 Apr 2025 16:03:45 +0000 (18:03 +0200)] 
GH-130328: pasting in new REPL is slow on Windows (GH-132884)

6 months agogh-132930: Fixes PEP 514 registration for PyManager packages on x64 (GH-133154)
Steve Dower [Tue, 29 Apr 2025 15:20:41 +0000 (16:20 +0100)] 
gh-132930: Fixes PEP 514 registration for PyManager packages on x64 (GH-133154)

6 months agogh-130317: Fix strict aliasing in PyFloat_Pack8() (#133150)
Victor Stinner [Tue, 29 Apr 2025 14:27:50 +0000 (16:27 +0200)] 
gh-130317: Fix strict aliasing in PyFloat_Pack8() (#133150)

* Fix strict aliasing in PyFloat_Pack8() and PyFloat_Pack4().
* Fix _testcapi.float_set_snan() on x86 (32-bit).

6 months agogh-132933: zipapp - apply the filter when creating the list of files to add (gh-132934)
Johannes Holmberg [Tue, 29 Apr 2025 14:14:46 +0000 (16:14 +0200)] 
gh-132933: zipapp - apply the filter when creating the list of files to add (gh-132934)

6 months agogh-132987: Support __index__() in the lzma module (GH-133099)
Serhiy Storchaka [Tue, 29 Apr 2025 14:14:33 +0000 (17:14 +0300)] 
gh-132987: Support __index__() in the lzma module (GH-133099)

6 months agogh-132987: Support __index__() in the select.kqueue_event constructor (GH-133094)
Serhiy Storchaka [Tue, 29 Apr 2025 13:55:14 +0000 (16:55 +0300)] 
gh-132987: Support __index__() in the select.kqueue_event constructor (GH-133094)

6 months agogh-132987: Support __index__() in the ssl.SSLContext.options setter (GH-133098)
Serhiy Storchaka [Tue, 29 Apr 2025 13:28:47 +0000 (16:28 +0300)] 
gh-132987: Support __index__() in the ssl.SSLContext.options setter (GH-133098)

6 months agogh-132987: Support __index__() in hashlib.scrypt() (GH-133100)
Serhiy Storchaka [Tue, 29 Apr 2025 13:16:05 +0000 (16:16 +0300)] 
gh-132987: Support __index__() in hashlib.scrypt() (GH-133100)

Even if such signature is not supported by PyArg_ParseTupleAndKeywords(),
Argument Clinic supports it with inlined converters.

6 months agogh-132987: Support __index__() in the posix module (GH-133096)
Serhiy Storchaka [Tue, 29 Apr 2025 13:14:47 +0000 (16:14 +0300)] 
gh-132987: Support __index__() in the posix module (GH-133096)

Support it for the dev_t values in mknod(), major(), minor() and makedev(),
CPU numbers in sched_setaffinity(), group numbers in setgroups(),
configuration name in fpathconf(), pathconf(), confstr(), and sysconf().

6 months agogh-46236: Document `PyUnicodeIter_Type` (GH-132925)
Stan Ulbrych [Tue, 29 Apr 2025 12:23:06 +0000 (13:23 +0100)] 
gh-46236: Document `PyUnicodeIter_Type` (GH-132925)

6 months agogh-57281: Fix duplicate deprecation note: array 'u' format (#133113)
Stan Ulbrych [Tue, 29 Apr 2025 11:22:15 +0000 (12:22 +0100)] 
gh-57281: Fix duplicate deprecation note: array 'u' format (#133113)

6 months agogh-133079: Remove Py_C_RECURSION_LIMIT & PyThreadState.c_recursion_remaining (GH...
Petr Viktorin [Tue, 29 Apr 2025 10:56:20 +0000 (12:56 +0200)] 
gh-133079: Remove Py_C_RECURSION_LIMIT & PyThreadState.c_recursion_remaining (GH-133080)

Both were added in 3.13, are undocumented, and don't make sense in 3.14 due to
changes in the stack overflow detection machinery (gh-112282).

PEP 387 exception for skipping a deprecation period: https://github.com/python/steering-council/issues/288

6 months agogh-132930: Fix use of ALIAS_WPREFIX in pymanager builds (GH-133120)
Adam Turner [Tue, 29 Apr 2025 08:53:43 +0000 (09:53 +0100)] 
gh-132930: Fix use of ALIAS_WPREFIX in pymanager builds (GH-133120)

6 months agoGH-132930: Display 'free-threaded' in pymanager builds (GH-133119)
Adam Turner [Tue, 29 Apr 2025 08:28:04 +0000 (09:28 +0100)] 
GH-132930: Display 'free-threaded' in pymanager builds (GH-133119)

6 months agoGH-132554: Add stats for GET_ITER (GH-132592)
Mark Shannon [Tue, 29 Apr 2025 08:00:14 +0000 (09:00 +0100)] 
GH-132554: Add stats for GET_ITER (GH-132592)

* Add stats for GET_ITER

* Look for common iterable types, not iterator types

* Add stats for self iter and fix naming in summary

6 months agoRun mypy workflow on `_colorize.py` and `Misc/mypy/**` changes (#133116)
sobolevn [Tue, 29 Apr 2025 07:53:12 +0000 (10:53 +0300)] 
Run mypy workflow on `_colorize.py` and `Misc/mypy/**` changes (#133116)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 months agoRevert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)
Neil Schemenauer [Tue, 29 Apr 2025 06:38:29 +0000 (23:38 -0700)] 
Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)

This is triggering deadlocks in test_opcache.  See GH-133130 for stack trace.

6 months agogh-132893: Minor edits to the statistics module PR (gh-133106)
Raymond Hettinger [Tue, 29 Apr 2025 04:05:37 +0000 (23:05 -0500)] 
gh-132893: Minor edits to the statistics module PR (gh-133106)

6 months agogh-87859: Track Code Object Local Kinds For Arguments (gh-132980)
Eric Snow [Tue, 29 Apr 2025 02:21:47 +0000 (20:21 -0600)] 
gh-87859: Track Code Object Local Kinds For Arguments (gh-132980)

Doing this was always the intention. I was finally motivated to find the time to do it.

See #87859 (comment).

6 months agogh-132775: Add _PyCode_ReturnsOnlyNone() (gh-132981)
Eric Snow [Tue, 29 Apr 2025 02:12:52 +0000 (20:12 -0600)] 
gh-132775: Add _PyCode_ReturnsOnlyNone() (gh-132981)

The function indicates whether or not the function has a return statement.

This is used by a later change related treating some functions like scripts.

6 months agogh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039)
Donghee Na [Tue, 29 Apr 2025 00:48:53 +0000 (09:48 +0900)] 
gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039)

---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
6 months agogh-132775: Add _PyMarshal_GetXIData() (gh-133108)
Eric Snow [Mon, 28 Apr 2025 23:23:46 +0000 (17:23 -0600)] 
gh-132775: Add _PyMarshal_GetXIData() (gh-133108)

Note that the bulk of this change is tests.

6 months agogh-125142: add REPL help text for keyboard shortcuts (gh-125143)
Neil Schemenauer [Mon, 28 Apr 2025 21:17:34 +0000 (14:17 -0700)] 
gh-125142: add REPL help text for keyboard shortcuts (gh-125143)

6 months agoAdd internal docs about the free-threaded GC. (gh-132562)
Neil Schemenauer [Mon, 28 Apr 2025 20:32:39 +0000 (13:32 -0700)] 
Add internal docs about the free-threaded GC. (gh-132562)

6 months agogh-127266: avoid data races when updating type slots (gh-131174)
Neil Schemenauer [Mon, 28 Apr 2025 20:28:44 +0000 (13:28 -0700)] 
gh-127266: avoid data races when updating type slots (gh-131174)

In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created.  For those (typically
rare) cases, use the stop-the-world mechanism.  Remove the use of atomics
when reading or writing type flags.  The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.

6 months agogh-122320: Limit dict key versions used by test_opcache. (gh-132961)
Neil Schemenauer [Mon, 28 Apr 2025 19:54:55 +0000 (12:54 -0700)] 
gh-122320: Limit dict key versions used by test_opcache. (gh-132961)

The `test_load_global_module()` test consumes a lot of dict key versions.
Skip the test if we have consumed half of the available versions that can be
used for the "load global" cache.

6 months agoGH-128520: pathlib ABCs tests: use explicit text encoding (#133105)
Barney Gale [Mon, 28 Apr 2025 19:18:56 +0000 (20:18 +0100)] 
GH-128520: pathlib ABCs tests: use explicit text encoding (#133105)

Follow-up to fbffd70. Set `encoding='utf-8'` when reading and writing text
in the tests for the private pathlib ABCs, which allows the tests to run
with `-W error -X warn_default_encoding`

6 months agogh-132775: Add _PyBytes_GetXIData() (gh-133101)
Eric Snow [Mon, 28 Apr 2025 18:52:36 +0000 (12:52 -0600)] 
gh-132775: Add _PyBytes_GetXIData() (gh-133101)

This is the base for several other XIData wrappers, like pickle and marshal. It is essentially a refactor of the existing bytes XIData code.

6 months agogh-132942: Fix races in type lookup cache (gh-133032)
Neil Schemenauer [Mon, 28 Apr 2025 18:52:08 +0000 (11:52 -0700)] 
gh-132942: Fix races in type lookup cache (gh-133032)

Two races related to the type lookup cache, when used in the
free-threaded build.  This caused test_opcache to sometimes fail (as
well as other hard to re-produce failures).

6 months agogh-132775: Drop PyUnstable_InterpreterState_GetMainModule() (gh-132978)
Eric Snow [Mon, 28 Apr 2025 18:46:22 +0000 (12:46 -0600)] 
gh-132775: Drop PyUnstable_InterpreterState_GetMainModule() (gh-132978)

We replace it with _Py_GetMainModule(), and add _Py_CheckMainModule(), but both in the internal-only C-API.  We also add _PyImport_GetModulesRef(), which is the equivalent of _PyImport_GetModules(), but which increfs before the lock is released.

This is used by a later change related to pickle and handling __main__.

6 months agogh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() (gh...
Eric Snow [Mon, 28 Apr 2025 18:41:32 +0000 (12:41 -0600)] 
gh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() (gh-132979)

They are derived from the existing `PyModule_GetFilenameObject().

They are used by a later change related to pickle and handling __main__.

6 months agogh-132742: Fix newly added tcflush() tests on Android (GH-133070)
Serhiy Storchaka [Mon, 28 Apr 2025 18:41:09 +0000 (21:41 +0300)] 
gh-132742: Fix newly added tcflush() tests on Android (GH-133070)

6 months agogh-132930: Improve the names of IDLE and PyDoc shortcuts (GH-133091)
Steve Dower [Mon, 28 Apr 2025 18:09:20 +0000 (19:09 +0100)] 
gh-132930: Improve the names of IDLE and PyDoc shortcuts (GH-133091)

6 months agoGH-128520: pathlib ABCs: raise text encoding warnings at correct stack level (#133051)
Barney Gale [Mon, 28 Apr 2025 18:04:20 +0000 (19:04 +0100)] 
GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level (#133051)

Ensure that warnings about unspecified text encodings are emitted from
`ReadablePath.read_text()`, `WritablePath.write_text()` and `magic_open()`
with the correct stack level set.

6 months agogh-132775: Cleanup Related to crossinterp.c Before Further Changes (gh-132974)
Eric Snow [Mon, 28 Apr 2025 17:55:15 +0000 (11:55 -0600)] 
gh-132775: Cleanup Related to crossinterp.c Before Further Changes (gh-132974)

This change consists of adding tests and moving code around, with some renaming thrown in.

6 months agogh-133054: Skip `test_pyrepl` tests when `cannot use pyrepl` is reported (#133055)
sobolevn [Mon, 28 Apr 2025 16:09:28 +0000 (19:09 +0300)] 
gh-133054: Skip `test_pyrepl` tests when `cannot use pyrepl` is reported (#133055)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
6 months agogh-132952: Speed up startup by importing _io instead of io (#132957)
Jelle Zijlstra [Mon, 28 Apr 2025 15:38:56 +0000 (08:38 -0700)] 
gh-132952: Speed up startup by importing _io instead of io (#132957)

6 months agotyping, annotationlib: clean tests (#133087)
Jelle Zijlstra [Mon, 28 Apr 2025 15:38:11 +0000 (08:38 -0700)] 
typing, annotationlib: clean tests (#133087)

- Add @cpython_only decorator to lazy import tests
- Rename reference to SOURCE format
- Always two newlines between test case classes
- Merge two classes of ForwardRef tests
- Use get_annotations instead of annotationlib.get_annotations
- Format test_annotationlib with Black (not expecting that we'll keep this up
  but it's close to Black-formatted right now)

6 months agogh-129965: Add more missing MIME types (#132845)
Hugo van Kemenade [Mon, 28 Apr 2025 15:30:35 +0000 (18:30 +0300)] 
gh-129965: Add more missing MIME types (#132845)

6 months agogh-132915: Try to detect a buffer overflow in fcntl() and ioctl() (GH-132919)
Serhiy Storchaka [Mon, 28 Apr 2025 14:56:10 +0000 (17:56 +0300)] 
gh-132915: Try to detect a buffer overflow in fcntl() and ioctl() (GH-132919)

SystemError is raised when buffer overflow is detected.
The stack and memory can already be corrupted, so treat this error as fatal.

6 months agogh-132726: Change the heading of `sysconfig` CLI section (#133035)
Semyon Moroz [Mon, 28 Apr 2025 14:44:49 +0000 (18:44 +0400)] 
gh-132726: Change the heading of `sysconfig` CLI section (#133035)

6 months agogh-75223: Deprecate undotted extensions in `mimetypes.MimeTypes.add_type` (#128638)
Hugo van Kemenade [Mon, 28 Apr 2025 14:23:57 +0000 (17:23 +0300)] 
gh-75223: Deprecate undotted extensions in `mimetypes.MimeTypes.add_type` (#128638)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
6 months agogh-132983: Convert compression._common to a package (#133086)
Victor Stinner [Mon, 28 Apr 2025 14:13:06 +0000 (16:13 +0200)] 
gh-132983: Convert compression._common to a package (#133086)

Add an "__init__.py" file. Fix test_tools.test_freeze.

6 months agogh-133073: avoid `NULL + 0` arithmetic in `list_extend_*` functions (#133074)
Bénédikt Tran [Mon, 28 Apr 2025 13:59:09 +0000 (15:59 +0200)] 
gh-133073: avoid `NULL + 0` arithmetic in `list_extend_*` functions (#133074)

6 months agogh-87135: Raise PythonFinalizationError when joining a blocked daemon thread (gh...
Petr Viktorin [Mon, 28 Apr 2025 13:48:48 +0000 (15:48 +0200)] 
gh-87135: Raise PythonFinalizationError when joining a blocked daemon thread (gh-130402)

If `Py_IsFinalizing()` is true, non-daemon threads (other than the current one)
are done, and daemon threads are prevented from running, so they
cannot finalize themselves and become done. Joining them (without timeout)
would block forever.

Raise PythonFinalizationError instead of hanging.

Raise even when a timeout is given, for consistency with trying to join your own thread.

See gh-123940 for a use case: calling `join()` from `__del__`. This is
ill-advised, but an exception should at least make it easier to diagnose.

6 months agoFixed a typo in the `PCbuild/readme.txt` about PGO clang-cl (#133083)
Wulian233 [Mon, 28 Apr 2025 13:39:16 +0000 (21:39 +0800)] 
Fixed a typo in the `PCbuild/readme.txt` about PGO clang-cl (#133083)

Fixed a typo in the readme.txt section about PGO clang-cl

6 months agogh-130317: Fix PyFloat_Pack/Unpack[24] for NaN's with payload (#130452)
Sergey B Kirpichev [Mon, 28 Apr 2025 13:23:26 +0000 (16:23 +0300)] 
gh-130317: Fix PyFloat_Pack/Unpack[24] for NaN's with payload (#130452)

Co-authored-by: Victor Stinner <vstinner@python.org>
6 months agogh-130907: Treat all module-level annotations as conditional (#131550)
Jelle Zijlstra [Mon, 28 Apr 2025 13:10:28 +0000 (06:10 -0700)] 
gh-130907: Treat all module-level annotations as conditional (#131550)

6 months agogh-53032: support IEEE 754 contexts in the decimal module (#122003)
Sergey B Kirpichev [Mon, 28 Apr 2025 13:05:56 +0000 (16:05 +0300)] 
gh-53032: support IEEE 754 contexts in the decimal module (#122003)

This was in C version from beginning, but available only
on conditional compilation (EXTRA_FUNCTIONALITY).  Current
patch adds function to create IEEE contexts to the
pure-python module as well.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
6 months agogh-132930: Implement PEP 773 (GH-132931)
Steve Dower [Mon, 28 Apr 2025 12:57:47 +0000 (13:57 +0100)] 
gh-132930: Implement PEP 773 (GH-132931)

This change to the core CPython repo:
* Adds PyManager support to PC/layout
* Adds a warning message to the legacy py.exe if subcommands are invoked
* Add deprecation message to traditional installer
* Updates using/windows docs

6 months agoGH-114911: use time.perf_counter in Stopwatch (GH-131469)
Chris Eibl [Mon, 28 Apr 2025 11:55:08 +0000 (13:55 +0200)] 
GH-114911: use time.perf_counter in Stopwatch (GH-131469)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 months agogh-131423: update note in `Tools/ssl/make_ssl_data.py` (#133077)
Bénédikt Tran [Mon, 28 Apr 2025 11:11:46 +0000 (13:11 +0200)] 
gh-131423: update note in `Tools/ssl/make_ssl_data.py` (#133077)

6 months agogh-111178: fix incorrect function signatures for Windows builds (#133072)
Bénédikt Tran [Mon, 28 Apr 2025 11:05:39 +0000 (13:05 +0200)] 
gh-111178: fix incorrect function signatures for Windows builds (#133072)

6 months agogh-133033: Add docs for `TypeIgnore` (#133034)
Yuki Kobayashi [Mon, 28 Apr 2025 10:49:07 +0000 (19:49 +0900)] 
gh-133033: Add docs for `TypeIgnore` (#133034)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
6 months agogh-127604: ensure `-ldl` is passed only once to the linker (#133071)
Bénédikt Tran [Mon, 28 Apr 2025 09:55:02 +0000 (11:55 +0200)] 
gh-127604: ensure `-ldl` is passed only once to the linker (#133071)

6 months agogh-132987: Support __index__() for unsigned integers in Argument Clinic (GH-133011)
Serhiy Storchaka [Mon, 28 Apr 2025 08:02:18 +0000 (11:02 +0300)] 
gh-132987: Support __index__() for unsigned integers in Argument Clinic (GH-133011)

6 months agogh-132742: Improve tests for fcntl.ioctl() (GH-132791)
Serhiy Storchaka [Mon, 28 Apr 2025 07:42:40 +0000 (10:42 +0300)] 
gh-132742: Improve tests for fcntl.ioctl() (GH-132791)

* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().

6 months agogh-132983: Install compression package contents (#133063)
Emma Smith [Mon, 28 Apr 2025 06:44:20 +0000 (23:44 -0700)] 
gh-132983: Install compression package contents (#133063)

Include compression package contents as part of installs.

6 months agogh-133061: do not mention `UINT32_MAX` in HMAC user-facing messages (#133062)
Bénédikt Tran [Sun, 27 Apr 2025 23:14:12 +0000 (01:14 +0200)] 
gh-133061: do not mention `UINT32_MAX` in HMAC user-facing messages (#133062)

6 months agoDocs: fix a couple typos in `Doc/` (GH-132927)
Yongzi Li [Sun, 27 Apr 2025 22:56:58 +0000 (06:56 +0800)] 
Docs: fix a couple typos in `Doc/` (GH-132927)

fix minor typos

6 months agogh-127604: ensure `-ldl` is passed to the linker when `dladdr1` is found (#133040)
Bénédikt Tran [Sun, 27 Apr 2025 22:28:42 +0000 (00:28 +0200)] 
gh-127604: ensure `-ldl` is passed to the linker when `dladdr1` is found (#133040)

6 months agogh-132993: expose `HASHLIB_GIL_MINSIZE` to private extension modules (#132999)
Bénédikt Tran [Sun, 27 Apr 2025 22:20:15 +0000 (00:20 +0200)] 
gh-132993: expose `HASHLIB_GIL_MINSIZE` to private extension modules (#132999)

6 months agogh-133005: Support `tarfile.open(mode="w|xz", preset=...)` (GH-133007)
Michał Górny [Sun, 27 Apr 2025 22:19:59 +0000 (00:19 +0200)] 
gh-133005: Support `tarfile.open(mode="w|xz", preset=...)` (GH-133007)

* gh-133005: Support `tarfile.open(mode="w|xz", preset=...)`

Support passing the `preset` option to `tarfile.open` when the file
is open with `mode="w|xz"`.  This aligns the behavior with `"w:xz"`
mode.

* Also raise an error for `compresslevel` or `preset` with wrong mode

Raise an error if `compresslevel` or `preset` argument is specified
for stream mode with incorrect compression. This should reduce the risk
of mistakes and align the stream modes with regular modes, that raise
an implicit TypeError on unsupported arguments.

* Apply suggestions from code review

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
6 months agoSilence system utils tests in emscripten python.sh (#133044)
Lukas [Sun, 27 Apr 2025 22:13:02 +0000 (00:13 +0200)] 
Silence system utils tests in emscripten python.sh (#133044)

Ensure that checks for system functions don't leak onto stdout on failure.

6 months agogh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-132027)
Valters Jansons [Sun, 27 Apr 2025 21:56:00 +0000 (00:56 +0300)] 
gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-132027)

When built on a MIPS architecture, `_MIPS_SIM` is used to determine
architecture specifics. The value is expected to match either
`_ABIO32`, `_ABIN32` or `_ABI64`.

In `gcc` config/mips/mips.h these values are defined as compiler
`builtin_define` inside of a switch/case. That means, mips64el and
mips64 architectures know about `_ABI64` but don't know about `_ABIO32`
and `_ABIN32`. In turn, when CPython tries to use them in comparison,
they may be undefined identifiers.

In default compiler behavior, the undefined identifier will be
evaluated as zero, and it will not match `_MIPS_SIM`. However, the
issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler
flag is enabled. Then suddenly it's visible as a warning or error.

6 months agogh-132983: Introduce `compression` package and move `_compression` module (GH-133018)
Emma Smith [Sun, 27 Apr 2025 21:41:30 +0000 (14:41 -0700)] 
gh-132983: Introduce `compression` package and move `_compression` module (GH-133018)

* Introduces `compression` package for https://peps.python.org/pep-0784/

This commit introduces the `compression` package, specified in PEP 784
to re-export the `lzma`, `bz2`, `gzip`, and `zlib` modules. Introduction
of `compression.zstd` will be completed in a future commit once the
`_zstd` module is merged.

This commit also moves the `_compression` private module to
`compression._common._streams`.

* Re-exports existing module docstrings.

6 months agogh-133046: Reformat the ``ast`` module docstring (GH-133050)
Hunter Hogan [Sun, 27 Apr 2025 21:35:56 +0000 (16:35 -0500)] 
gh-133046: Reformat the ``ast`` module docstring (GH-133050)

* Fix formatting in module docstring for `ast` https://github.com/python/cpython/issues/133046
* #133046 ast docstring: remove header, dedent, 80-char width.
* Keep existing wrapping

---------

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>