Commit graph

131504 commits

Author SHA1 Message Date
Miss Islington (bot)
b17bcfdf7e
[3.15] gh-150766: export _PyGC_VisitFrameStack and _PyGC_VisitStackRef functions (GH-150767) (#150787)
gh-150766: export `_PyGC_VisitFrameStack` and `_PyGC_VisitStackRef` functions (GH-150767)
(cherry picked from commit df34a2f712)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-02 13:36:52 +00:00
Miss Islington (bot)
c5248b7acf
[3.15] gh-89554: Document _thread.LockType as a class (GH-150684) (#150785)
gh-89554: Document _thread.LockType as a class (GH-150684)

_thread.LockType is a class (the type of lock objects), but was documented
with the ".. data::" directive, so ":class:" cross-references to it cannot
resolve against a py:class target.

Switch the entry to ".. class::", move it next to the lock methods, and
document acquire(), release() and locked() as methods of the class.  Keep
the old _thread.lock.* URL fragments working with raw HTML anchors.
(cherry picked from commit e37ce56977)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-02 13:07:05 +00:00
Hugo van Kemenade
de7576edfa
[3.15] Update SOURCE_URI for 3.15 branch (#150783) 2026-06-02 12:05:14 +00:00
Miss Islington (bot)
80f3d798a7
[3.15] gh-150720: Remove '-d 1' in test_script_error_treatment (GH-150736) (#150746)
Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
2026-06-02 14:32:04 +03:00
Miss Islington (bot)
8fcec28e66
[3.15] Fix typos in C API documentation (GH-149588) (#149662)
Co-authored-by: pengyu lee <lipengyu@kylinos.cn>
2026-06-02 14:31:13 +03:00
Miss Islington (bot)
c5512bd7c1
[3.15] gh-149079: Fix O(n^2) canonical ordering in unicodedata.normalize() (GH-149080) (#150776)
Replace the insertion sort used for canonical ordering of combining
characters with a hybrid approach: insertion sort for short runs (< 20)
and counting sort for longer runs, reducing worst-case complexity from
O(n^2) to O(n). This prevents denial of service via crafted Unicode
strings with many combining characters in alternating CCC order.
(cherry picked from commit 991224b1e8)

Co-authored-by: Seth Larson <seth@python.org>
Co-authored-by: ch4n3-yoon <ch4n3.yoon@gmail.com>
Co-authored-by: Seokchan Yoon <13852925+ch4n3-yoon@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-06-02 10:10:04 +00:00
Miss Islington (bot)
1835400ff5
[3.15] gh-149738: Fix segmentation fault bug in sqllite3 (GH-149754) (#150768)
gh-149738: Fix segmentation fault bug in sqllite3 (GH-149754)

Deleting the `row_factory` or `text_factory` attribute is no longer allowed.
(cherry picked from commit 60fdb3192b)

Co-authored-by: Sepehr Rasouli <sepehrrasouli06@gmail.com>
2026-06-02 09:36:03 +00:00
Miss Islington (bot)
94c58db977
[3.15] gh-123138: Updated email.headerregistry docs to include required keyword parse_tree (GH-134450) (GH-150623)
(cherry picked from commit 2c20f9ce17)

Co-authored-by: Gustaf <79180496+gostak-dd@users.noreply.github.com>
2026-06-02 09:26:05 +00:00
Miss Islington (bot)
0472179937
[3.15] Fix two typos in 'Exception Handling' C-API documentation (GH-150674) (#150772)
(cherry picked from commit cee3327b92)

Co-authored-by: Manoj K M <manojkm24dev@gmail.com>
2026-06-02 09:22:17 +00:00
Miss Islington (bot)
35dc248372
[3.15] gh-89554: Document typing.ParamSpecArgs and ParamSpecKwargs as classes (GH-150677) (GH-150763)
Use the directive "class" instead of "data" for ParamSpecArgs and ParamSpecKwargs.
(cherry picked from commit 35c314d2b7)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-02 08:16:05 +00:00
Miss Islington (bot)
b48cf0ec0c
[3.15] gh-89554: Document standard type objects in types as classes (GH-150676) (GH-150761)
Use the directive and the role "class" instead of "data" for classes
exposed in the types module.
(cherry picked from commit bc055444e4)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-02 08:11:19 +00:00
Miss Islington (bot)
506b41d458
[3.15] gh-89554: Document weakref type objects as classes (GH-150678) (GH-150760)
Use the "class" directive instead of "data" for ReferenceType,
ProxyType and CallableProxyType.
(cherry picked from commit 10c421970b)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-02 08:08:01 +00:00
Miss Islington (bot)
ef45089660
[3.15] gh-89554: Document NoneType, NotImplementedType and EllipsisType as classes (GH-150682) (GH-150755)
Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.
(cherry picked from commit e40190e104)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-02 08:03:51 +00:00
Miss Islington (bot)
848ba18bcd
[3.15] gh-150228: Improve the PEP 829 batch processing APIs (GH-150542) (#150748)
gh-150228: Improve the PEP 829 batch processing APIs (GH-150542)

* gh-150228: Improve the PEP 829 batch processing APIs

As previously discussed with @ncoghlan and approved for 3.15b2 by @hugovk,
this implements the batch processing APIs for addsitedir() and friends.  We
remove the `defer_processing_start_files` flag which required some implicit
module global state, and promote StartupState to the public documented API.

This also moves the bulk of the module global functions into methods of the
`StartupState` class, so it removes the awkward APIs in 3.15b1.  Now, instances
of this class are an accumulator for startup state, using `StartupState.process()`
to process them.  Callers can now batch up startup state themselves by using
the methods on this class.  The module global functions are shims for this
which preserve the legacy APIs and semantics using the new state class.

This PR also fixes the interleaving regression identified by @ncoghlan in the
same issue.  Now, .pth file sys.path extensions are added to sys.path after
the sitedir that the .pth file is found in, restoring the legacy behavior.

Along the way, I've made a lot of improvements to function docstrings,
site.rst documentation, and comments in the code explaining what's going on.

* Add a note that if known_paths is provided to StartupState.__init__(), it
  will get mutated in place.
* Improve some conditional flows.
* Improve some comments.
* Improve the what's new entry.

* Make test_impl_exec_imports_suppressed_by_matching_start() more robust

Based on PR comment, we need to read both the .pth and .start files, and prove
that the .pth file's import line (which passes a bigger increment) is not
called, but the .start file's entry point (which uses the default increment)
is called.

* As per review, move some methods to the private API

_read_pth_file() and _read_start_file() are not intended to be part of the
public API surface outside of the site module, so even though they are used by
methods outside of the StartupState class, make them privately named.

* Resolve several review feedbacks

* Move a `versionadded`
* Better list comprehension formatting (use the output from
  `ruff format --line-length 78`)

* Add docs for site.makepath() and point the case-normalization requirement to
  this utility function.
* Note that StartupState.process() is not idempotent.

* Address another feedback comment

This time, we get rid of the legacy implementation `reset` local, which was
always difficult to understand, and just implement a return value based on the
processing mode selected.

* Changes based on gh-150228 review

The comment by @encukou that started this change:

```
I still see two red flags here though: an argument that doesn't combine with
other arguments, and (another instance of) changing the return type based on
an argument.

Did you consider adding a StartupState.addsitedir(sitedir) method, instead of
the startup_state argument?
```

As it turns out, this is an even cleaner design.  By moving the bulk of the
previous module global functions into `StartupState` methods, we can get rid
of all the awkward `startup_state` keyword-only arguments which conflict
with `known_path` (Petr's first point).  We can also get rid of the
return value dichotomy (Petr's second point) because now we can preserve
exactly the Python 3.14 API in the module global functions, and implement
the better APIs in the class methods.  We also generally don't have to
pass around `process_known_sitedirs`.

Now the following module global functions are essentially shims around
class methods:

* site.addsitedir() -> StartupState.addsitedir()
* site.addusersitepackages() -> StartupState.addusersitepackages()
* site.addsitepackages() -> StartupState.addsitepackages()
* Additional minor changes
* Remove a now unused parameter

(cherry picked from commit 27ebd9abce)

Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-06-02 02:11:51 +00:00
Miss Islington (bot)
042428f443
[3.15] gh-150644: Tag Apple system log messages as public. (GH-150645) (#150738)
macOS 26 changed the default visibility of "dynamic" system messages. This
changes the logging strategy to tag all messages as "public" so they are
visible in the system log without special configuration.
(cherry picked from commit 71fc4c66d3)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-06-01 22:53:51 +00:00
Miss Islington (bot)
a4f3336870
[3.15] gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442) (#150697)
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442)

Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'.
(cherry picked from commit 540b3d0a7f)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-06-01 22:24:31 +00:00
Miss Islington (bot)
a4781e6014
[3.15] gh-150429: Fix sampling profiler generator stack test (GH-150433) (#150734) 2026-06-01 20:58:05 +00:00
Miss Islington (bot)
7e9057d892
[3.15] gh-148672: Document namespace subpackages inside regular packages (GH-150056) (#150729)
gh-148672: Document namespace subpackages inside regular packages (GH-150056)
(cherry picked from commit 9ba2a89179)

Co-authored-by: Taeknology <20297177+Taeknology@users.noreply.github.com>
2026-06-01 19:31:36 +00:00
Miss Islington (bot)
9c1e3af17a
[3.15] gh-121109: Fix performance of tarfile reading with "r|*" (GH-121296) (GH-150604)
(cherry picked from commit 6d7a19e533)

Co-authored-by: Tomi Belan <tomi.belan@gmail.com>
2026-06-01 17:39:51 +00:00
Miss Islington (bot)
3a12e9f524
[3.15] gh-149534: Fix unification of defaultdict and frozendict with | (GH-149539) (#150709)
gh-149534: Fix unification of `defaultdict` and `frozendict` with `|` (GH-149539)
(cherry picked from commit cc0269334f)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-01 16:07:33 +00:00
Miss Islington (bot)
b65c28206f
[3.15] gh-150157: Fix critical section for PyDict_Next() in _pickle.c (GH-150158) (#150711)
(cherry picked from commit c5516e7e37)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-01 14:59:09 +00:00
Miss Islington (bot)
e60e8cfe8b
[3.15] gh-149046: fix: correctly handle str subclasses in io.StringIO (GH-149047) (#150706)
gh-149046: fix: correctly handle `str` subclasses in `io.StringIO` (GH-149047)
(cherry picked from commit c98773633c)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-01 13:33:02 +00:00
Miss Islington (bot)
58335eebef
[3.15] gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369) (#150701)
gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369)
(cherry picked from commit 9d64c355b5)

Co-authored-by: Dawid Konrad Kohnke <51542233+anytokin@users.noreply.github.com>
2026-06-01 12:05:52 +00:00
Miss Islington (bot)
4ce8de3550
[3.15] gh-150372: Add missing null check on completer_word_break_characters in readline.c (GH-150251) (GH-150628)
(cherry picked from commit 56bd9ea676)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-01 10:00:55 +00:00
Miss Islington (bot)
2c1e4bb6e2
[3.15] gh-148605: Remove irepeat() thread test from test_bytes (GH-150576) (#150660)
gh-148605: Remove irepeat() thread test from test_bytes (GH-150576)
(cherry picked from commit 350e9de765)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-01 15:01:52 +05:30
Miss Islington (bot)
487b23d546
[3.15] gh-150685: update bundled pip to 26.1.2 (gh-150686) (gh-150687) 2026-05-31 21:12:22 +01:00
Miss Islington (bot)
fed5c744df
[3.15] gh-140553: Mark *gettext parameters as positionaly only in documentation (GH-140598)
(cherry picked from commit 1837c17bc7)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-31 20:21:08 +01:00
Miss Islington (bot)
ea58c352b7
[3.15] Clarify docs for scheduler.run(blocking=False) (GH-129575) (GH-150668)
(cherry picked from commit 2f8f569ba9)

Co-authored-by: M. Greyson Christoforo <grey@christoforo.net>
2026-05-31 12:19:43 +00:00
Miss Islington (bot)
2fb2a23cbd
[3.15] gh-150636: Clarify difference between copy.copy() and the copy() methods (GH-150637) (GH-150665)
(cherry picked from commit 1de909b324)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-31 12:16:58 +00:00
Miss Islington (bot)
c5655dfe51
[3.15] Correct frexp() docs for zero and non-finite numbers (GH-149753) (GH-150652)
0.5 <= abs(m) < 1 is only true for finite nonzero numbers
(cherry picked from commit 5b5ffce05c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-05-31 10:04:18 +00:00
Miss Islington (bot)
2ff80c7533
[3.15] gh-131178: Fix mimetypes CLI docs, mention that errors go to stdout (GH-149683) (#150655)
gh-131178: Fix mimetypes CLI docs, mention that errors go to stdout (GH-149683)
(cherry picked from commit 2b94b92394)

Co-authored-by: htjworld <116538001+htjworld@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-31 08:14:15 +00:00
Miss Islington (bot)
3084bdc54b
[3.15] gh-150524: Remove outdated note in binascii.a2b_hex() documentation (GH-150525) (GH-150627)
bytes.fromhex() accepts ASCII bytes and bytes-like objects as input since 3.14
(cherry picked from commit af10734907)

Co-authored-by: Joshix-1 <57299889+Joshix-1@users.noreply.github.com>
2026-05-31 10:52:55 +03:00
Miss Islington (bot)
d03250657a
[3.15] gh-117291: Explain usage of null bytes in Array(c_char).value (GH-117292) (GH-150649)
(cherry picked from commit 73d8e9a47c)

Co-authored-by: Patrick Rauscher <prauscher@prauscher.de>
2026-05-31 07:28:45 +00:00
Miss Islington (bot)
9a393438a7
[3.15] gh-149857: Clarify multiprocessing Process argument wording (GH-149919) (#149933)
gh-149857: Clarify multiprocessing Process argument wording (GH-149919)

Use consistent 'picklable' wording
(cherry picked from commit 1bab6c9192)

Co-authored-by: Mani Salahmand <78011313+ManiSalahmand@users.noreply.github.com>
2026-05-31 04:22:11 +00:00
Miss Islington (bot)
ccfa50a078
[3.15] gh-141444:fix broken URLs and examples in urllib.request.rst (GH-144863) (#150642)
gh-141444:fix broken URLs and examples in urllib.request.rst (GH-144863)

* Doc: fix broken URLs and examples in urllib.request.rst (gh-141444)

* Doc: update urllib.request examples to handle gzip compression

---------
(cherry picked from commit 0f1f7c7889)

Co-authored-by: Paper Moon <tangyuan0821@email.cn>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2026-05-30 21:08:20 -07:00
Miss Islington (bot)
7cf2b37b66
[3.15] gh-150406: Check result of PyThread_allocate_lock() for netdb_lock (GH-150407) (GH-150616)
(cherry picked from commit 1e18c45495)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-05-30 17:15:02 +00:00
Miss Islington (bot)
e4cdee6c19
[3.15] gh-129851: Fix the documentation for -m command (GH-129862) (GH-150614)
(cherry picked from commit 9baa7c63be)

Co-authored-by: Dhruv Singla <68206552+d-s-dc@users.noreply.github.com>
2026-05-30 20:03:58 +03:00
Miss Islington (bot)
b952986ced
[3.15] gh-135898: Add section to free-threading howto about memory usage (GH-143279) (#150607)
gh-135898: Add section to free-threading howto about memory usage (GH-143279)
(cherry picked from commit 62a45fa91c)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-30 10:49:26 +00:00
Miss Islington (bot)
187982aa7d
[3.15] gh-150501: Correct inspect.getattr_static docs signature (GH-150504) (#150601)
gh-150501: Correct `inspect.getattr_static` docs signature (GH-150504)
(cherry picked from commit 678fd8452c)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-05-30 09:25:38 +00:00
Serhiy Storchaka
2f9131575b
[3.15] gh-149489: Fix ElementTree serialization to HTML (GH-149490) (GH-150595)
* The content of comments, processing instructions and elements "xmp",
  "iframe", "noembed", "noframes", and "plaintext" is no longer escaped.
* The "plaintext" element no longer have the closing tag.
* Add support of empty attributes (with value None).
(cherry picked from commit bcd29e466f)
2026-05-29 21:48:10 +00:00
Miss Islington (bot)
863c7e0f9f
[3.15] gh-149056: Properly pass array_hook in json.load() to json.loads() (GH-149057) (GH-150591)
(cherry picked from commit f87d9605d3)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-05-29 21:30:50 +00:00
Miss Islington (bot)
a2ba8b192e
[3.15] gh-150403: Document frozendict in language reference Mappings section (GH-150404) (GH-150590)
(cherry picked from commit 779694faba)

Co-authored-by: Oral Ersoy Dokumacı <oral.ersoy.dokumaci@gmail.com>
2026-05-29 19:48:48 +00:00
Miss Islington (bot)
59e709b17e
[3.15] Add a security warning about pydoc's HTTP server (#150573)
(cherry picked from commit 5535c1f9c0)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-29 20:07:29 +01:00
Miss Islington (bot)
b980552f34
[3.15] gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270) (#150570)
gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea638)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-29 18:40:56 +05:30
Petr Viktorin
d842895a9d
[3.15] gh-141984: Reword docs on "enclosed" atom grammar (GH-148622) (GH-150552)
Reorganize and reword the docs on atoms in parentheses, brackets and braces:
parenthesized groups, list/set/dict/tuple displays, and comprehensions.
(Generator expressions and yield atoms are left for later.)

In the spirit of better matching the underlying grammar, *comprehensions* are
covered separately from non-comprehension displays. Also, parenthesized forms
(with a single expression) and tuple displays are separated.
All sections are rewritten to start with simple cases and build up to the full
formal grammar.



(cherry picked from commit 55f2518326)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-05-29 10:09:38 +02:00
Miss Islington (bot)
21fa311c04
[3.15] gh-149029: Update SQLite to 3.53.1 for binary releases (GH-149767) (#150559)
(cherry picked from commit 9242700c14)

Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Ned Deily <nad@python.org>
2026-05-28 18:57:04 -04:00
Miss Islington (bot)
77666483b7
[3.15] gh-150046: Fix test_add_python_opts to ignore PYTHON* env vars (GH-150089) (#150561)
gh-150046: Fix `test_add_python_opts` to ignore `PYTHON*` env vars (GH-150089)

Avoid the runtime environment from affecting the tests' behaviours,
which notably checks the warning filters which can be controlled by
various PYTHON environment variables.
(cherry picked from commit ef2246f788)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2026-05-28 17:15:27 +00:00
Miss Islington (bot)
0e08bba32e
[3.15] Add prominent crash warning to ctypes docs (GH-150410) (GH-150547)
(cherry picked from commit b53f6ca850)

Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-28 12:23:56 +02:00
Miss Islington (bot)
f216c89631
[3.15] gh-84353: Preserve non-UTF-8 filenames when appending to ZipFile (GH-150091) (GH-150527)
Preserve non-UTF-8 filenames when appending to a ZipFile.

---------
(cherry picked from commit 24c6bbc92b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-27 21:47:03 +00:00
Miss Islington (bot)
e565d12acb
[3.15] gh-149861: Fix rule in match statement case_block PEG grammar (GH-149908)
(cherry picked from commit 99c254e2f7)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
2026-05-27 16:24:47 +01:00