Commit graph

124008 commits

Author SHA1 Message Date
Miss Islington (bot)
25ae2045a8
[3.13] gh-116666: Add "token" glossary term (GH-130888) (GH-131367)
gh-116666: Add "token" glossary term (GH-130888)

Add glossary entry for `token`, and link to it.
Avoid talking about tokens in the SyntaxError intro (errors.rst); at this point
tokenization is too much of a technical detail. (Even to an advanced reader,
the fact that a *single* token is highlighted isn't too relevant. Also, we don't
need to guarantee that it's a single token.)
(cherry picked from commit 30d5205849)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-18 12:51:02 +01:00
Miss Islington (bot)
e425b075fe
[3.13] gh-131002: clarify how to enforce sqlite3 column types for generated fields (GH-131006) (#131385)
(cherry picked from commit f48887fb97)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-03-18 12:09:41 +01:00
Miss Islington (bot)
f297dabbe0
[3.13] gh-130132: properly free resources in urrlib.urlopen examples (GH-130280) (#131394)
gh-130132: properly free resources in `urrlib.urlopen` examples (GH-130280)
(cherry picked from commit 77d2fd4413)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-18 09:33:19 +00:00
Miss Islington (bot)
98195b2108
[3.13] gh-131094: Refine math.isclose docs (GH-131139) (#131392)
gh-131094: Refine `math.isclose` docs (GH-131139)
(cherry picked from commit 3f50f96586)

Co-authored-by: Guy Jacoby <49398101+guyjacoby@users.noreply.github.com>
2025-03-18 09:21:13 +00:00
Bénédikt Tran
170abd2199
[3.13] gh-127667: refactor and improve _hashopenssl.c error branches (#131145) (#131347)
gh-127667: refactor and improve `_hashopenssl.c` error branches (#131145)

Refactor `_setException()` into different helpers that can be used separately:

- set_ssl_exception_from_errcode(): set an exception from an explicit SSL error code.
- raise_ssl_error(): set an exception from the last SSL error code or use a user-defined message.
- notify_ssl_error_occurred(): same as raise_ssl_error() but with a generic default message.

(cherry-picked from commit ac50ece6ce).
2025-03-18 10:16:49 +01:00
Malcolm Smith
e8e6e30054
[3.13] gh-118201: Simplify conv_confname (#126089) (#131375)
gh-118201: Simplify conv_confname (#126089)

(cherry picked from commit c5c9286804)
2025-03-18 12:53:10 +08:00
Miss Islington (bot)
9a43485830
[3.13] gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376) (#131377)
gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376)
(cherry picked from commit 94f4d87aeb)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-03-17 19:46:30 +00:00
Miss Islington (bot)
3feebdd61d
[3.13] Docs: Fix incorrect sphinx markup for a class member (GH-130970) (GH-131366)
(cherry picked from commit 9a634c5c0c)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-03-17 16:46:05 +01:00
Miss Islington (bot)
6ceb8fcfb6
[3.13] gh-129675: Update documentation for tp_basicsize & tp_itemsize (GH-129850) (GH-131079)
- Add alignment requirement
- Mention that ob_size is unreliable if you don't control it
- Add some links for context
- basicsize should include the base type in generaly not just PyObject
- suggest Py_SIZE & Py_SET_SIZE

This adds a “by-the-way” link to `PyObject_New`, which shouldn't be
used for GC types. In order to be comfortable linking to it, I also
add a link to `PyObject_GC_New` from its docs. And the same for
`*Var` variants, while I'm here.

(cherry picked from commit ad0f618ab3)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-17 16:18:26 +01:00
Petr Viktorin
6af54d298d
[3.13] gh-131261: Update libexpat to 2.7.0 (CVE-2024-8176)
(cherry picked from commit bb0268f60d)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-03-17 09:44:28 -05:00
Miss Islington (bot)
83cfd4649e
[3.13] gh-129843: fix pure Python implementation of warnings.warn_explicit (GH-129848) (#131349)
gh-129843: fix pure Python implementation of `warnings.warn_explicit` (GH-129848)

The pure Python implementation of `warnings.warn_explicit` constructs a `WarningMessage`
with an incorrect source (it incorrectly sets the WarningMessage's line to the given `source`).
(cherry picked from commit 80e00ecc39)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
2025-03-17 12:18:42 +01:00
Miss Islington (bot)
3930b7c258
[3.13] gh-131339: test PyBytes_Size for a zero-size bytes object (GH-131340) (#131343)
gh-131339: test PyBytes_Size for a zero-size bytes object (GH-131340)
(cherry picked from commit 3ae67ba97e)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2025-03-17 09:01:40 +00:00
Miss Islington (bot)
4d7d249a05
[3.13] gh-131327: Document winsound.SND_APPLICATION (GH-131328) (#131330)
gh-131327: Document winsound.SND_APPLICATION (GH-131328)
(cherry picked from commit bf4c1bf344)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-16 15:52:48 +00:00
Miss Islington (bot)
1512cc0a81
[3.13] gh-130160: use .. program:: directive for documenting doctest CLI (GH-131034) (#131320)
gh-130160: use `.. program::` directive for documenting `doctest` CLI (GH-131034)
(cherry picked from commit 9558d22ac3)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-16 11:59:26 +00:00
Miss Islington (bot)
b7e15a93b4
[3.13] gh-130160: use .. program:: directive for documenting http.server CLI (GH-131010) (#131293)
gh-130160: use `.. program::` directive for documenting `http.server` CLI (GH-131010)
(cherry picked from commit 7ae9c5dd25)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-15 21:12:40 +02:00
Sam Gross
5646f6f739
[3.13] gh-130382: add missing _PyReftracerTrack to ceval Py_DECREF (GH-130689) (#131195)
(cherry picked from commit c5abded099)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-03-14 09:52:05 -04:00
Wulian233
130fa4c94f
[3.13] gh-131204: Fix difflib.HtmlDiff may not use monospaced font (GH-131221) (#131242)
(cherry picked from commit 7fd6160)
2025-03-14 12:27:13 +00:00
Miss Islington (bot)
a3ca70c527
[3.13] gh-131234: Improve test_popen with more asserts (GH-131235) (#131240)
gh-131234: Improve `test_popen` with more asserts (GH-131235)
(cherry picked from commit fc07f863ee)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-14 12:02:47 +00:00
Miss Islington (bot)
7d498aae2c
[3.13] gh-131219: Improve tests in test_lzma.py by adding more asserts (GH-131220) (#131231)
gh-131219: Improve tests in `test_lzma.py` by adding more asserts (GH-131220)
(cherry picked from commit f6c24a5c89)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-14 11:05:59 +00:00
Miss Islington (bot)
6c10767232
[3.13] gh-130814: Enhance documentation for Python C API type objects (GH-130817) (#131225)
gh-130814: Enhance documentation for Python C API type objects (GH-130817)

The "Type Objects" title in `c-api/typeobj.rst`, duplicating the title of `c-api/type.rst`,
has been changed to "Type Objects Structures", thereby slightly improving Sphinx
search.
(cherry picked from commit 6b932edc52)

Co-authored-by: sharktide <meherrihaan@gmail.com>
2025-03-14 09:59:19 +00:00
Miss Islington (bot)
0f97abf498
[3.13] gh-124269: Simplify typing.Annotated docs (GH-130770) (#131222)
gh-124269: Simplify `typing.Annotated` docs (GH-130770)

---------
(cherry picked from commit e4ac196aaa)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-14 09:53:03 +00:00
Serhiy Storchaka
78f75d330a
[3.13] gh-85012: Properly reset msgctxt when compiling messages with msgfmt (GH-130525) (GH-131205)
Add also human-readable snapshots for tests.
(cherry picked from commit 7ea6e88eb4)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-03-13 19:15:28 +00:00
Victor Stinner
050813c026
[3.13] gh-131032: Add support.linked_to_musl() function (#131071) (#131179)
gh-131032: Add support.linked_to_musl() function (#131071)

Skip test_math.test_fma_zero_result() if Python is linked to the musl
C library.

(cherry picked from commit 68922ace4d)
2025-03-13 09:59:57 +00:00
Kumar Aditya
589382bd04
[3.13] gh-131141: fix data race in instrumentation while registering callback (#131166) 2025-03-13 09:41:26 +00:00
Russell Keith-Magee
589f422d1b
[3.13] gh-130940: Remove PyConfig.use_system_logger (#131129)
Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
2025-03-13 11:53:11 +08:00
Miss Islington (bot)
65b58291b0
[3.13] gh-93096: Load doctests in test_itertools (GH-131133) (#131136)
gh-93096: Load doctests in `test_itertools` (GH-131133)
(cherry picked from commit 15a8412b5e)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-12 08:03:24 +00:00
Miss Islington (bot)
d23a0f2d86
[3.13] Use subTest() in math.fma() tests (GH-131125) (#131132)
Use subTest() in math.fma() tests (GH-131125)
(cherry picked from commit 52756c30db)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-12 06:47:01 +00:00
Pablo Galindo Salgado
0980e2e370
[3.13] gh-117174: Fix reference leak and gdb tests (GH-131095) (#131120)
(cherry picked from commit ebc24d54bc)
2025-03-11 23:43:07 +00:00
Miss Islington (bot)
9e0fce413a
[3.13] gh-131113: Fix data race in dict.popitem() (gh-131115) (#131119)
The clearing of the key, hash, and value need to use atomic operations
to avoid a data race with concurrent read operations.
(cherry picked from commit c00ac57824)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-11 23:39:29 +00:00
Miss Islington (bot)
98c7ae3f7e
[3.13] gh-130957: Use sleeping_retry in test_free_reference (GH-130958) (#131091)
The weak reference may not be immediately dead.
(cherry picked from commit 1908115871)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-11 14:14:28 +00:00
Yuki Kobayashi
a49f85a694
[3.13] gh-101100: Fix sphinx warnings in library/asyncio-subprocess.rst (GH-130994) (#131074)
(cherry picked from commit 7cc99a54b7)
2025-03-11 14:30:47 +02:00
Miss Islington (bot)
f9d19a3ada
[3.13] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (GH-131044) (#131084)
(cherry picked from commit de8818ae23)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
2025-03-11 11:56:54 +00:00
Victor Stinner
27fd328cf6
[3.13] gh-130959: Reject whitespace in fractions, in pure Python fromisoformat() (#130962) (#131076)
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962)

Fix the pure Python implementation of `fromisoformat()` to reject any
non-digit characters, including whitespace, in the fractional part
of time specification.  This makes the behavior consistent with the C
implementation, and prevents incorrect parsing of these fractions
(e.g. `.400 ` would be misinterpreted as `.04`).

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
(cherry picked from commit 33494b4d0d)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-03-11 12:39:27 +01:00
Miss Islington (bot)
68a1591bec
[3.13] gh-93096: Fix loading doctests in test_pickle (GH-131069) (GH-131080)
(cherry picked from commit 3bb20d13a8)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-11 10:49:14 +00:00
Miss Islington (bot)
3e173e505a
[3.13] gh-130932: cwd cannot be removed on Solaris/Illumos (GH-131037) (#131073)
gh-130932: cwd cannot be removed on Solaris/Illumos (GH-131037)
(cherry picked from commit 69309a55bc)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-03-11 09:33:50 +00:00
Miss Islington (bot)
c7022230d2
[3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b324)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 23:11:24 +00:00
Miss Islington (bot)
ebd2ed7ad8
[3.13] gh-125331: Allow the parser to activate future imports on the fly (GH-125482) (#131062)
gh-125331: Allow the parser to activate future imports on the fly (GH-125482)
(cherry picked from commit 3bd3e09588)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 22:20:38 +00:00
Miss Islington (bot)
977af3a6a2
[3.13] gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001) (#131061)
gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001)
(cherry picked from commit 6ab5c4aa05)

Co-authored-by: FeH2 <i@feh2.im>
2025-03-10 22:18:13 +00:00
Miss Islington (bot)
cf829f49de
[3.13] gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021) (#131047)
gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021)
(cherry picked from commit 36ef3bfe39)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-03-10 19:54:10 +00:00
Miss Islington (bot)
30e8bd2a41
[3.13] gh-130711: Document PyBaseObject_Type (GH-130712) (GH-130792)
(cherry picked from commit b3c18bfd82)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-03-10 15:05:38 +01:00
Miss Islington (bot)
edb69578ed
[3.13] gh-80421: Correct definitions of time (GH-130984) (#131022)
gh-80421: Correct definitions of time (GH-130984)

Based on the Wikipedia article, UTC is better said to be a successor than a renaming of GTC and language agnostic rather than an English-French compromise.
(cherry picked from commit 98fa4a49fe)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-03-09 20:15:37 +00:00
Miss Islington (bot)
28406cd0a1
[3.13] gh-130160: use .. program:: directive for documenting pdb CLI (GH-130996) (#131014)
gh-130160: use `.. program::` directive for documenting `pdb` CLI (GH-130996)
(cherry picked from commit c240c2d88a)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-09 16:15:41 +00:00
Miss Islington (bot)
d50941c1c3
[3.13] gh-130160: use .. program:: directive for documenting webbrowser CLI (GH-130995) (#131003)
gh-130160: use `.. program::` directive for documenting `webbrowser` CLI (GH-130995)

use `.. program::` directive for documenting `webbrowser` CLI
(cherry picked from commit 92e5f826ac)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-09 07:03:56 +00:00
Miss Islington (bot)
aef7edaf23
[3.13] gh-123726: Document caveats of zipfile.Path around name sanitization (GH-130537) (#130986)
gh-123726: Document caveats of zipfile.Path around name sanitization (GH-130537)

Add a note to the `zipfile.Path` class documentation clarifying that it does not sanitize filenames. This emphasizes the caller's responsibility to validate or sanitize inputs, especially when handling untrusted ZIP archives, to prevent path traversal vulnerabilities. The note also references the `extract` and `extractall` methods for comparison and suggests using `os.path.abspath` and `os.path.commonpath` for safe filename resolution.
(cherry picked from commit a3990df612)

Co-authored-by: Affan Shaikhsurab <51104750+AffanShaikhsurab@users.noreply.github.com>
2025-03-08 21:43:12 +00:00
Miss Islington (bot)
fead51d808
[3.13] gh-130954: Fix multiprocessing test_notify_n (GH-130955) (#130981)
The test could deadlock trying join on the worker processes.
Apply the same technique as gh-130933.

Join the process before the test ends in `test_notify` as well.
(cherry picked from commit edd1eca336)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-08 18:28:07 +00:00
Sam Gross
14230cd96c
[3.13] gh-130851: Only intern constants of types generated by the compiler (GH-130901) (#130953)
The free-threading build interns and immortalizes most constants
generated by the bytecode compiler. However, users can construct their
own code objects with arbitrary constants. We should not intern or
immortalize these objects if they are not of a type that we know how to
handle.

This change fixes a reference leak failure in the recently added
`test_code.test_unusual_constants` test. It also addresses a potential
crash that could occur when attempting to destroy an immortalized
object during interpreter shutdown.
(cherry picked from commit 12db45211d)
2025-03-08 13:07:39 -05:00
Miss Islington (bot)
597a953484
[3.13] gh-130917: update timer and workload in test_signal (GH-130918) (#130969)
The workload to advance the virtual timeout is too lightweight for some
platforms. As result the test goes in timeout as it never reaches the
end of the timer. By having a heavier workload, the virtual timer
advances rapidly and the SIGVTALRM is sent before the timeout.
(cherry picked from commit 7879081198)

Co-authored-by: Diego Russo <diego.russo@arm.com>
2025-03-08 01:05:29 +00:00
Miss Islington (bot)
94b94d0b12
[3.13] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130950)
The test could deadlock trying join on the worker processes due to a
combination of behaviors:

* The use of `assertReachesEventually` did not ensure that workers
  actually woken.release() because the SyncManager's Semaphore does not
  implement get_value.

* This mean that the test could finish and the variable "sleeping" would
  got out of scope and be collected. This unregisters the proxy leading
  to failures in the worker or possibly the manager.

* The subsequent call to `p.join()` during cleanUp therefore never
  finished.

This takes two approaches to fix this:

1) Use woken.acquire() to ensure that the workers actually finish
   calling woken.release()

2) At the end of the test, wait until the workers are finished, while `cond`,
   `sleeping`, and `woken` are still valid.
(cherry picked from commit c476410dc5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-07 12:22:51 -05:00
Miss Islington (bot)
e0838a2022
[3.13] Correct function name in Doc/extending/embedding.rst (GH-127539) (#130945)
Correct function name in `Doc/extending/embedding.rst` (GH-127539)
(cherry picked from commit e5527f2cdd)

Co-authored-by: Boris Verkhovskiy <boris.verk@gmail.com>
2025-03-07 13:12:44 +00:00
Miss Islington (bot)
d5eb490846
[3.13] gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934) (#130939)
gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
(cherry picked from commit 0a9ae5ed48)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2025-03-07 09:28:47 +00:00