125800 Commits

Author SHA1 Message Date
Miss Islington (bot) 59b260c61b [3.13] gh-149096: Remove 'im_*' attribute reference from inspect module docstring (GH-149108) (#149440)
gh-149096: Remove  'im_*' attribute reference from inspect module docstring (GH-149108)

The im_class/func/self names were removed in 3.0.  The prefix appears nowhere else in inspect.py
and nowhere in inspect.rst.
(cherry picked from commit e4444538dc)

Co-authored-by: Vineet Kumar <108144301+whyvineet@users.noreply.github.com>
2026-05-06 02:52:33 +00:00
Miss Islington (bot) 99c9b85ad8 [3.13] gh-149410: Test that typing.NoDefault is final (GH-149411) (#149420)
gh-149410: Test that `typing.NoDefault` is final (GH-149411)
(cherry picked from commit bad9296fb0)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-05 15:22:48 +00:00
Miss Islington (bot) 67c47ce163 [3.13] gh-149403: Fix NameError in Lib/test/test_capi/test_getargs.py (GH-149404) (#149407)
gh-149403: Fix `NameError` in `Lib/test/test_capi/test_getargs.py` (GH-149404)
(cherry picked from commit 114781040c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-05 14:47:46 +03:00
Savannah Ostrowski a02beabe2d [3.13] GH-130750: Restore quoting of choices in argparse error messag… (#149386)
[3.13] GH-130750: Restore quoting of choices in argparse error messages to match documentation and improve clarity (GH-144983)
(cherry picked from commit 53a7f76501)
2026-05-04 23:18:05 +00:00
Miss Islington (bot) 9f9a273267 [3.13] gh-149377: update bundled pip to 26.1.1 (GH-149378) (#149380)
gh-149377: update bundled pip to 26.1.1 (GH-149378)
(cherry picked from commit de66149f66)

Co-authored-by: Stéphane Bidoul <stephane.bidoul@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-05-04 23:43:33 +03:00
Serhiy Storchaka 561d1b95b9 [3.13] gh-138907: Support RFC 9309 in robotparser (GH-138908) (GH-149376)
* empty lines are always ignored instead of separating groups
* the "user-agent" line after a rule starts a new group
* groups matching the same user agent are now merged
* the rule with the longest match wins instead of the first matching rule
* in case of equal matches, the “Allow” rule wins over “Disallow”
* special characters “$” and “*” are now supported in rules
* prefer full match for user agent

(cherry picked from commit bc285e5832)
2026-05-04 18:43:03 +00:00
Miss Islington (bot) 3868444600 [3.13] gh-137337: Clarify import statement namespace binding (GH-144607) (GH-149370)
It is not always in the local namespace.
(cherry picked from commit b8ebd078f9)

Co-authored-by: Kit Dallege <xaum.io@gmail.com>
2026-05-04 14:52:02 +00:00
Miss Islington (bot) 6d6471b7eb [3.13] gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE marshal stream (GH-148419) (GH-149364)
(cherry picked from commit c3972f2795)

Co-authored-by: Wulian233 <1055917385@qq.com>
2026-05-04 14:06:00 +00:00
Miss Islington (bot) 76e250189f [3.13] gh-87245: Improve IPv6Address.ipv4_mapped documentation (GH-92572) (#149361)
gh-87245: Improve IPv6Address.ipv4_mapped documentation (GH-92572)

Avoid the phrasing ‘starting with ::FFFF/96’, which is confusing since
it seems to mix a prefix and a range. Instead, make it clear what the
actual range is, and refer to the relevant RFC.

Closes GH-87245.
(cherry picked from commit 7aedd0a6c6)

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
2026-05-04 13:10:17 +00:00
Miss Islington (bot) 7f9236cf03 [3.13] gh-149351: Avoid possible broken macOS framework install names when DESTDIR is specified during builds (GH-149352) (#149355)
(cherry picked from commit 1504bd671e)

Co-authored-by: Ned Deily <nad@python.org>
2026-05-04 12:10:57 +00:00
Miss Islington (bot) 023ecbd01f [3.13] gh-148093: Raise binascii.Error from binascii.a2b_uu() on empty input (GH-149077) (GH-149349)
Instead of reading past the end of the empty buffer.
(cherry picked from commit 0c6d2f64c0)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-05-04 10:06:25 +00:00
Savannah Ostrowski d82d5c2ddb [3.13] GH-146475: Block Apple Clang for building JIT stencils (#149188) (#149340)
GH-146475: Block Apple Clang for building JIT stencils (#149188)

(cherry picked from commit c0e0640039)
2026-05-04 00:29:26 +00:00
Zachary Ware 46165b116b [3.13] gh-149254: Update CI to use latest OpenSSL versions (GH-149336)
(adapted from commit 68fe899feb)
2026-05-03 21:20:33 +00:00
Miss Islington (bot) db8cdec6b8 [3.13] gh-149254: Update Windows builds to OpenSSL 3.0.20 (GH-149331)
(cherry picked from commit 487ebb478a)
2026-05-03 20:26:07 +00:00
Miss Islington (bot) 6a2f12b031 [3.13] gh-148663: Document that calendar.IllegalMonthError inherits from both ValueError and IndexError (GH-148664) (#148918)
(cherry picked from commit 435be06dd2)

Co-authored-by: Eoin Shaughnessy <45000144+EoinTrial@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-03 17:42:39 +01:00
Miss Islington (bot) a04e3f01ce [3.13] Ignore /jit_unwind_info*.h from git (GH-149311) (#149315)
Ignore `/jit_unwind_info*.h` from git (GH-149311)
(cherry picked from commit db0335887e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-03 09:55:48 +00:00
Miss Islington (bot) e961c00255 [3.13] gh-149267: Document ast.Constant.kind attribute (GH-149268) (#149294)
gh-149267: Document ast.Constant.kind attribute (GH-149268)

The kind attribute of ast.Constant was not mentioned in the
documentation. It is set to 'u' for u-prefixed string literals
and None for all other constants.

---------
(cherry picked from commit 3a1df787e1)

Co-authored-by: Anuj Nitin Bharambe <119653366+anujbharambe@users.noreply.github.com>
Co-authored-by: Anuj Bharambe <anujnitinb@gmail.com>
2026-05-02 20:05:24 +03:00
Miss Islington (bot) b274204657 [3.13] gh-111264: Add a note about untrusted input to tomllib docs (#149226)
(cherry picked from commit 9d41e2a534)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-02 12:13:57 +01:00
Miss Islington (bot) 302ef2122c [3.13] gh-148914: Fix memoization of in-band PickleBuffer in the Python implementation (GH-149052) (GH-149275)
Previously, identical PickleBuffers did not preserve identity.
Also, empty writable PickleBuffer memoized an empty bytearray object
in place of b'' which is a singleton in CPython, so the following
references to b'' were unpickled as an empty bytearray object.
(cherry picked from commit b89735625d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-02 11:11:15 +00:00
Russell Keith-Magee 22fdd355b1 [3.13] gh-149254: Bump OpenSSL version for Android. (#149273)
Bump OpenSSL version to 3.0.20 for Android.
2026-05-02 16:51:21 +08:00
Miss Islington (bot) 15fd467a54 [3.13] gh-149254: Update macOS installer to use OpenSSL 3.0.20. (GH-149263) (#149265)
(cherry picked from commit c2f494c806)

Co-authored-by: Ned Deily <nad@python.org>
2026-05-02 04:10:49 +00:00
Miss Islington (bot) bb2c05b398 [3.13] gh-149117: Set ImportError.name on errors from runpy.run_module/run_path (gh-149159) (#149258)
gh-149117: Set `ImportError.name` on errors from `runpy.run_module`/`run_path` (gh-149159)

Set ImportError.name on errors from runpy.run_module/run_path

`runpy.run_module()` and `runpy.run_path()` now set the `name` attribute
of the `ImportError` they raise to the requested module name, matching
the behaviour of a regular import statement (previously `name` was
always `None`, which broke introspection).

The `name=` kwarg is gated on `issubclass(error, ImportError)` because
`_get_module_details()` is also used by `_run_module_as_main()` with
a private `_Error` sentinel class. `_Error` does not subclass
ImportError, and `BaseException.__init__` rejects unknown kwargs at
the C level, so passing `name=` unconditionally would break the
`python -m foo` codepath.
(cherry picked from commit ff35fe4633)

Co-authored-by: W. H. Wang <mattwang44@gmail.com>
2026-05-02 02:51:06 +00:00
Miss Islington (bot) bed659fa1d [3.13] Fix source link in Doc/howto/descriptor.rst (GH-149215) (#149251)
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-01 22:47:58 +03:00
Miss Islington (bot) 104a38c495 [3.13] gh-148518 fix index error in local part attribute (GH-148522) (#149199)
As part of fixing bpo-27931 code was introduced to get_bare_quoted_string
that added an empty Terminal if the quoted string was empty.  This isn't
the best answer in terms of the parse tree; we really want the token
list to be empty in that case.  But having it be empty resulted in
local_part raising the index error.  We find that same problem if we
try to parse an address consisting of a single dquote.  By fixing
local_part to not raise on an empty token list, we can have the
bare_quoted_string code correctly return an empty token list for
the empty string cases (two dquotes or a single dquote as the
entire addrespec, at the end of a line).
(cherry picked from commit bdbb55c403)

Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2026-04-30 18:13:27 -04:00
Miss Islington (bot) b3e0c72fa4 [3.13] bpo-39100: _header_value_parser: do not treat a Group as invalid-mailbox (GH-24872) (#149192)
When an address in an address-list has garbage at the end, the code will
currently:

1. change the mailbox in the last parsed address into invalid-mailbox by
   overriding its token_type;
2. wrap the trailing garbage into another invalid-mailbox and append it
   to the last parsed address.

However, that does not take into account that an address may
also contain a Group instead of a single mailbox. In that case,
overwriting token_type leads to undesirable results, e.g. parsing an
email with the following 'To' header:

unlisted-recipients:; (no To-header on input)

raises an AttributeError from trying to treat the Group as a Mailbox.

Moreover it is questionable whether the previously parsed mailbox should
be treated as invalid in addition to the trailing garbage.

Address both of the above by wrapping the trailing garbage in a new
Address with a single invalid-mailbox, and append it to the AddressList
directly.

Changes the results of the
test_get_address_list_mailboxes_invalid_addresses test, where the
address list is now parsed into 4 mailboxes instead of 3 (all but the
first one are invalid).
(cherry picked from commit b413bc7a1f)

Co-authored-by: elenril <anton@khirnov.net>
2026-04-30 14:15:43 -04:00
Miss Islington (bot) c38c463c14 [3.13] gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945) (#139510)
* gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945)

The section provides a brief overview of the Python runtime's execution environment.  It is meant to be implementation agnostic,
(cherry picked from commit 46a1f0a9ff)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

* concurrent.interpreters was added to Python 3.14

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-30 10:42:34 +00:00
Miss Islington (bot) d424d8847a [3.13] gh-149148: Upgrade bundled pip to 26.1 (GH-149150) (#149155)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-29 14:53:55 +00:00
Miss Islington (bot) c1fb21b150 [3.13] gh-97032: avoid test_squeezer crash on macOS buildbots (gh-115508) (GH-148141) (#148415)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Ned Deily <nad@python.org>
2026-04-29 13:01:04 +03:00
Miss Islington (bot) d6d68494be [3.13] gh-148169: Fix webbrowser %action substitution bypass of dash-prefix check (GH-148170) (#148517)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-29 13:00:10 +03:00
Miss Islington (bot) 0c83e503cd [3.13] gh-140287: Handle PYTHONSTARTUP script exceptions in the asyncio REPL (GH-140288) (#148988)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-04-29 12:57:19 +03:00
Miss Islington (bot) 2a64c966af [3.13] gh-149035: Modernize legacy Python patterns in Doc/tutorial/stdlib2.rst (GH-149036) (#149090)
Co-authored-by: ByteFlow <fakeshadow1337@gmail.com>
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 05:16:36 +00:00
Serhiy Storchaka 0fd4fd4496 [3.13] gh-148529: Minor improvements of the struct module documentation (GH-148565) (GH-149072)
* Document that 's' and 'p' accept bytes and bytearray.
* Fix some footnotes.
* Clarify that "string" is a byte string.
* Fix the module docstring.
(cherry picked from commit 3e5a3cb2bd)
2026-04-27 20:22:47 +00:00
Miss Islington (bot) ab5ef98af6 [3.13] gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591) (GH-149065)
Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.
(cherry picked from commit fc829e8875)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 22:54:45 +03:00
Miss Islington (bot) a724c9f6fb [3.13] gh-82665 Mention that HTMLParser.handle_starttag value can be None (GH-134312) (#149038)
gh-82665 Mention that HTMLParser.handle_starttag value can be None (GH-134312)

* Specify boolean attribute behavior in parser

* Tweak wording and example




* Fix backticks

---------
(cherry picked from commit 804c213c89)

Co-authored-by: Micah Najacht <micah.najacht@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 22:31:35 +08:00
Miss Islington (bot) 9e68f174c2 [3.13] Document that multiprocessing treats local same-user processes as trusted (GH-149001) (#149034)
Document that multiprocessing treats local same-user processes as trusted (GH-149001)

Clarify in the Authentication keys section that the authkey handshake
covers Listener/Client (addressable endpoints) only, not the anonymous
pipes behind Pipe() and Queue, and that isolation between same-user
processes must be arranged at the OS level.
(cherry picked from commit f27e91e372)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-27 01:48:39 +00:00
Gregory P. Smith 9651429aa7 [3.13] gh-105936: Properly update closure cells for __setattr__ and __delattr__ in frozen dataclasses with slots (GH-144021) (GH-148476)
gh-105936: Properly update closure cells for `__setattr__` and `__delattr__` in frozen dataclasses with slots (GH-144021)
(cherry picked from commit 8a398bfbbc)

The cherry-pick required additional changes beyond the original commit
because 3.13 lacks the `__class__` closure cell fixup machinery that
was added in 3.14 by GH-124455 (gh-90562). Specifically:

- Backported `_update_func_cell_for__class__()` helper function and the
  closure fixup loop in `_add_slots()` from GH-124455. Without these,
  renaming the closure variable from `cls` to `__class__` has no effect
  because nothing updates the cell when the class is recreated with slots.
- Changed `_add_slots()` to use `newcls` instead of reusing `cls` for the
  recreated class, so both old and new class references are available for
  the fixup loop.
- Replaced `assertNotHasAttr` with `assertFalse(hasattr(...))` in tests
  (assertNotHasAttr was added in 3.14).
- Dropped `test_original_class_is_gced` additions (that test does not
  exist on 3.13; it was added by GH-137047 for gh-135228 which was not
  backported to 3.13).

gh-148947: dataclasses: fix error on empty __class__ cell  (GH-148948)

Also add a test demonstrating the need for the existing "is oldcls" check.
(cherry picked from commit 6d7bbee1d5)

---------

Co-authored-by: Prometheus3375 <prometheus3375@gmail.com>
Co-authored-by: Sviataslau <35541026+Prometheus3375@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-04-25 22:55:20 -07:00
Miss Islington (bot) 898ecdd2e9 [3.13] gh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (GH-149003) (#149005)
gh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (GH-149003)

gh-141473: Speed up test_communicate_timeout_large_input

Replace the slow reader's 30s sleep with a parent-driven wake over a
loopback socket so post-timeout communicate() doesn't block waiting
for the child to wake on its own. Worst-case runtime: ~30s -> <1s.
(cherry picked from commit e1384cfd25)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-26 04:27:03 +00:00
Irit Katriel 8da3d39c51 [3.13] gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974) (#148997) 2026-04-25 22:59:40 +01:00
Stan Ulbrych feafd5f69c [3.13] gh-148735: Fix a UAF in Element.findtext() (GH-148738) (#148923)
(cherry picked from commit 0469e6d38d)
2026-04-25 10:38:14 +01:00
Miss Islington (bot) e4ae72a6d9 [3.13] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148922)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-04-23 19:30:13 +00:00
Miss Islington (bot) 813498411a [3.13] gh-148484: Fix memory leak of iterator in array.array constructor (GH-148523) (GH-148679)
(cherry picked from commit afde75664e)

Co-authored-by: Gleb Popov <gvpopov.dev@gmail.com>
2026-04-23 16:00:47 +02:00
Miss Islington (bot) 3c59b8b53f [3.13] gh-90309: Base64-encode cookie values embedded in JS (GH-148888)
(cherry picked from commit 76b3923d68)

Co-authored-by: Seth Larson <seth@python.org>
2026-04-23 15:05:17 +02:00
Miss Islington (bot) 7dd784e701 [3.13] gh-142965: Fix Concatenate documentation to reflect valid use cases (GH-143316) (#148900)
The documentation previously stated that Concatenate is only valid
when used as the first argument to Callable, but according to PEP 612,
it can also be used when instantiating user-defined generic classes
with ParamSpec parameters.
(cherry picked from commit 75ff1afcb6)

Co-authored-by: John Seong <39040639+sandole@users.noreply.github.com>
2026-04-22 19:57:40 -07:00
Miss Islington (bot) f540bc9d4a [3.13] gh-146553: Fix infinite loop in typing.get_type_hints() on circular __wrapped__ (GH-148595) (#148896)
(cherry picked from commit be833e658a)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-04-23 02:55:40 +00:00
Miss Islington (bot) a52c8cbbf5 [3.13] gh-145194: Fix typing in re tokenizer example (GH-145198) (#148898)
(cherry picked from commit bd7352d807)

Co-authored-by: Vikash Kumar <163628932+Vikash-Kumar-23@users.noreply.github.com>
2026-04-23 02:46:31 +00:00
Sam Gross 1b2301c009 [3.13] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) (#148885)
_PyRawMutex_UnlockSlow CAS-removes the waiter from the list and then
calls _PySemaphore_Wakeup, with no handshake. If _PySemaphore_Wait
returns Py_PARK_INTR, the waiter can destroy its stack-allocated
semaphore before the unlocker's Wakeup runs, causing a fatal error from
ReleaseSemaphore / sem_post.

Loop in _PyRawMutex_LockSlow until _PySemaphore_Wait returns Py_PARK_OK,
which is only signalled when a matching Wakeup has been observed.

Also include GetLastError() and the handle in the Windows fatal messages
in _PySemaphore_Init, _PySemaphore_Wait, and _PySemaphore_Wakeup to make
similar races easier to diagnose in the future.

(cherry picked from commit ad3c5b7958)
2026-04-22 18:56:24 +00:00
Miss Islington (bot) 95633d2aad [3.13] gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (GH-148809) (#148836)
gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (GH-148809)
(cherry picked from commit 1274766d3c)

Co-authored-by: Seth Larson <seth@python.org>
2026-04-21 21:56:37 +05:30
Miss Islington (bot) df47919a9b [3.13] Docs: Fix some typos in calendar.rst (GH-148756) (GH-148796)
Docs: Fix some typos in `calendar.rst` (GH-148756)
(cherry picked from commit 983c7462d6)

Co-authored-by: Manoj K M <manojkmdev24@gmail.com>
2026-04-20 14:43:55 +00:00
Miss Islington (bot) bef4d84e7f [3.13] gh-148763: Fix paramter name in multiprocessing.connection.send_bytes/recv_bytes_into docs (GH-126603) (#148787)
gh-148763: Fix paramter name in `multiprocessing.connection.send_bytes/recv_bytes_into` docs (GH-126603)
(cherry picked from commit e50acef0b2)


Doc: Fix buf argument name in multiprocessing connection send_bytes

Co-authored-by: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com>
2026-04-20 00:12:30 +00:00
Miss Islington (bot) 01f7218983 [3.13] gh-148779: Update Briefcase link in android.rst documentation (GH-148777) (#148781)
Use canonical beeware.org URL for link to Briefcase.
(cherry picked from commit 82767780f8)

Co-authored-by: partev <petrosyan@gmail.com>
2026-04-19 21:50:45 +00:00