125930 Commits

Author SHA1 Message Date
Xuanteng Huang
1821f8f10c
gh-131281: fix compile error due to BINARY_SUBSCR (GH-131283)
* fix compile error due to `BINARY_SUBSCR`

* replace stat_inc with `BINARY_OP`
2025-03-15 23:38:46 +08:00
Yan Yanchii
55815a6474
gh-130480: Move duplicate LOAD_SMALL_INT optimization from codegen to CFG (#130481) 2025-03-14 21:23:27 +00:00
Tian Gao
26511993e6
gh-121468: Fix the doctest failure for asyncio test on pdb (#131258) 2025-03-14 16:23:21 -04:00
Barney Gale
633942e348
GH-130614: pathlib ABCs: delete vestigial test_pathlib_abc module (#131215)
Remove the `test.test_pathlib.test_pathlib_abc` test module, which was
hollowed out in previous commits. Its few remaining tests are most relevant
to `PurePath` and `Path`, so we move them into `test_pathlib`.
2025-03-14 20:04:07 +00:00
Tian Gao
27fc62cf4f
gh-121468: Add current asyncio task as a convenience variable in pdb (#124367) 2025-03-14 14:46:26 -04:00
Hugo van Kemenade
c107b15ab8 Post 3.14.0a6 2025-03-14 19:09:56 +02:00
Hugo van Kemenade
77b2c933ca Python 3.14.0a6 v3.14.0a6 2025-03-14 17:05:02 +02:00
Hugo van Kemenade
ca1bedc9a4
gh-121970: Revert "GH-121970: Extract `pydoc_topics` into a new extension (#129116)" (#131245)
Revert "GH-121970: Extract ``pydoc_topics`` into a new extension (#129116)"

This reverts commit 01bcf13a1c5bfca5124cf2e0679c9d1b25b04708.
2025-03-14 16:25:56 +02:00
Victor Stinner
db62557e3d
gh-111178: Fix function signatures for test_os (#131227) 2025-03-14 13:53:06 +00:00
Victor Stinner
ca7fd814e4
gh-111178: Fix function signatures in _asynciomodule.c (#131228) 2025-03-14 13:37:39 +00:00
donBarbos
f9d0531a8d
gh-93096: Update and document pickle CLI (#131097)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-14 14:15:35 +01:00
Mark Shannon
67af96c61c
GH-127705: Handle trace refs in specialized decref (GH-131198)
This is missing `_PyReftracerTrack` calls, see gh-131238.
Merging as-is for the 3.14.0a6 release.
2025-03-14 13:02:09 +01:00
sobolevn
fc07f863ee
gh-131234: Improve test_popen with more asserts (#131235) 2025-03-14 11:38:31 +00:00
Mark Shannon
2250ab6a13
GH-125174 Revert: Make immortality "sticky" (GH-131184)" (#131230)
Revert "GH-125174: Make immortality "sticky" (GH-131184)"

This reverts commit 3a91ee97245639c7c4f8852418157d3fc0ec1a82.
2025-03-14 13:13:47 +02:00
Wulian233
7fd61607cd
gh-131204: Fix difflib.HtmlDiff may not use monospaced font (#131221)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-14 10:45:33 +00:00
Hugo van Kemenade
3d797e49c8
gh-92897: Doc: the check_home removal has been scheduled for 3.15 (#130586) 2025-03-14 12:29:23 +02:00
sobolevn
f6c24a5c89
gh-131219: Improve tests in test_lzma.py by adding more asserts (#131220) 2025-03-14 10:16:50 +00:00
sharktide
6b932edc52
gh-130814: Enhance documentation for Python C API type objects (#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.
2025-03-14 10:53:13 +01:00
Victor Stinner
a5776639c8
gh-111178: Fix function signatures to fix undefined behavior (#131191) 2025-03-14 09:52:15 +00:00
Stan Ulbrych
e4ac196aaa
gh-124269: Simplify typing.Annotated docs (#130770)
---------

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 10:46:57 +01:00
Victor Stinner
c497f83ad8
gh-111178: Fix function signatures for PyStdPrinter (#131192) 2025-03-14 10:24:38 +01:00
Victor Stinner
0ddfb5717f
gh-111178: Fix _PyLegacyEventHandler_Type deallocator (#131193)
Don't use PyObject_Free() as tp_dealloc to avoid an undefined
behavior. Instead, use the default deallocator which just calls
tp_free which is PyObject_Free().
2025-03-14 10:23:54 +01:00
Min RK
96492785b2
gh-128540: lookup default webbrowser on macOS (#130535)
Ensure web browser is launched by `webbrowser.open` on macOS, even for `file://` URLs.
2025-03-14 02:51:15 -04:00
Hood Chatham
f3e275f1a9
GH-130396: Work around for broken pthread_get_stackaddr_np on Emscripten (#131088)
Implements a workaround implementation of `pthread_get_stackaddr_np` for Emscripten.
This will be replaced by an implementation that will be included in Emscripten 4.0.6.
2025-03-14 07:04:40 +08:00
Grigory Bukovsky
1121c80fda
gh-131196: Improve perfomance of UUID.hex and UUID.__str__ by ~10% (#131197)
Results before and after the fix:

```
hex
before: 0.021755493999989994
after:  0.01465080400066654 

str
before: 0.06381790500017814
after:  0.05134949700004654
```

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-14 01:57:38 +03:00
Enzo Bonnal
d7d22899e2
gh-74028: update whatsnew/3.14.rst post gh-125663 (#131214) 2025-03-13 23:22:04 +01:00
Barney Gale
45c2ef48ca
GH-130614: pathlib ABCs: parametrize test suite for path copying (#131168)
Test copying from `Path` and `ReadableZipPath` (types of `_ReadablePath`)
to `Path` and `WritableZipPath` (types of `_WritablePath`).
2025-03-13 21:56:59 +00:00
sobolevn
1a8e5742cd
Remove print from test_monitoring.py (#131200) 2025-03-13 22:54:17 +03:00
Pieter Eendebak
ec46a55d63
gh-121464: Make concurrent iteration over enumerate safe under free-threading (#125734) 2025-03-14 00:14:05 +05:30
Tomas R.
7ea6e88eb4
gh-85012: Properly reset msgctxt when compiling messages with msgfmt (GH-130525)
Add also human-readable snapshots for tests.
2025-03-13 20:40:40 +02:00
Tomasz Pytel
c5abded099
gh-130382: add missing _PyReftracerTrack to ceval Py_DECREF (#130689) 2025-03-13 12:31:49 -04:00
Mark Shannon
3a91ee9724
GH-125174: Make immortality "sticky" (GH-131184) 2025-03-13 16:10:13 +00:00
Irit Katriel
4242c2b8d0
gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be used outside of the compiler (#130930) 2025-03-13 16:02:58 +00:00
Victor Stinner
9a63138e09
gh-111178: Fix function signatures in misc files (#131180) 2025-03-13 16:55:08 +01:00
Nybblista
e9d210bfc2
gh-131170: fix duplicated sections in frames.md file (#131177)
fix duplicated sections in frames.md file

In the frames.md file at InternalDocs, change the first
duplicated title to Specials, and remove unnecessary content
under the Specials section.
2025-03-13 16:59:19 +03:00
Victor Stinner
10cbd1fe88
gh-130947: Add again PySequence_Fast() to the limited C API (#130948)
Add again PySequence_Fast() to the limited C API.

Add unit tests.
2025-03-13 13:00:57 +01:00
donBarbos
3a189af4b2
gh-93096: Remove CLI interface for difflib (#131099) 2025-03-13 13:22:16 +02:00
Oleg Iarygin
328f8b8856
gh-93096: Make mimetypes CLI tool public (#93097)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-13 13:19:22 +02:00
Chris Eibl
119bcfad9c
gh-129149: Add fast path for medium-sized integers in PyLong_FromSsize_t() (#129301)
The implementation of `PyLong_FromLong()`, `PyLong_FromLongLong()` and `PyLong_FromSsize_t()`
are now handled by a common macro `PYLONG_FROM_INT` which contains fast paths depending on the
size of the integer to convert. Consequently, `PyLong_FromSsize_t()` for medium-sized integers is faster
by roughly 25%.

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-13 12:06:56 +01:00
Enzo Bonnal
a005835f69
gh-74028: add buffersize parameter to concurrent.futures.Executor.map for lazier behavior (#125663)
`concurrent.futures.Executor.map` now supports limiting the number of submitted
tasks whose results have not yet been yielded via the new `buffersize` parameter.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-13 11:57:53 +01:00
Furkan Onder
e98d321bef
gh-130099: Fix CAN socket fallthrough annotation for NetBSD compatibility (#131026) 2025-03-13 11:25:43 +01:00
Cody Maloney
93089c0736
gh-130806: Emit ResourceWarning if GzipFile unclosed (#130905)
This may indicate accidental data loss.

Ways to make sure all data is written:
1. Use the [file-like object](https://docs.python.org/3/glossary.html#term-file-object) as a [“With Statement Context Manager”](https://docs.python.org/3/reference/datamodel.html#context-managers).
   - All objects which [inherit](https://docs.python.org/3/tutorial/classes.html#inheritance) from [IOBase](https://docs.python.org/3/library/io.html#io.IOBase) support this.
   - [`BufferedIOBase`](https://docs.python.org/3/library/io.html#io.BufferedIOBase), [`BufferedWriter`](https://docs.python.org/3/library/io.html#io.BufferedWriter), and [`GzipFile`](https://docs.python.org/3/library/gzip.html#gzip.GzipFile) all support this.
   - Ensures `.close()` is called in both exception and regular cases.

2. Ensure [`.close()`](https://docs.python.org/3/library/io.html#io.IOBase.close) is always called which flushes data before closing.

3. If the underlying stream need to be kept open, use [`.detach()`](https://docs.python.org/3/library/io.html#io.BufferedIOBase.detach)

Since 3.12 flushing has been necessary in GzipFile (see gh-105808 which was a release blocker), this makes that more visible. Users have been encountering as they upgrade to 3.12 (ex. gh-129726).

There are a number of cases of unclosed file-like objects being deleted in CPython libraries and the test suite. This issue includes resolving those cases where the new ResourceWarning is emitted.

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-13 11:20:05 +01:00
Victor Stinner
d12d8c50cd
gh-111178: Fix function signatures in odictobject.c (#131160)
Add _PyODictObject_CAST() macro.
2025-03-13 10:14:59 +00:00
Victor Stinner
fcb750af86
gh-131152: Remove unused imports from Tools/cases_generator (#131156) 2025-03-13 10:59:51 +01:00
Victor Stinner
85cabed260
gh-131152: Remove unused imports from Tools/{build,wasm} (#131155) 2025-03-13 10:58:28 +01:00
Victor Stinner
b2ca26875a
gh-131152: Remove unused imports from tests (part 2) (#131154) 2025-03-13 10:57:40 +01:00
Victor Stinner
50e9eba32c
gh-111178: Fix function signatures in rangeobject.c (#131161) 2025-03-13 09:56:06 +00:00
Victor Stinner
73ab9e2ede
gh-131152: Remove unused imports from tests (#131153) 2025-03-13 10:55:23 +01:00
Victor Stinner
0c6c52f496
gh-111178: Fix PyRangeIter_Type deallocator (#131162)
Don't use PyObject_Free() as tp_dealloc to avoid an undefined
behavior. Instead, use the default deallocator which just calls
tp_free which is PyObject_Free().
2025-03-13 10:46:20 +01:00
Victor Stinner
36978f7ef3
gh-111178: Fix function signatures in iterobject.c (#131163) 2025-03-13 10:42:59 +01:00