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
Victor Stinner
68922ace4d
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.
2025-03-13 10:33:46 +01:00
Victor Stinner
2ed671b5e3
gh-111178: Change Argument Clinic signature for @staticmethod
( #131157 ) ( #131159 )
...
Use "PyObject*", instead of "void*", for `@staticmethod` functions to
fix an undefined behavior.
2025-03-13 10:22:58 +01:00
Russell Keith-Magee
dd6d24e9d2
gh-130940: Modify default behavior of PyConfig.use_system_logger
to enable on iOS ( #131172 )
...
Modify default behavior of use_system_log to enable on iOS.
2025-03-13 14:28:49 +08:00
Max Bachmann
f7ac656c8e
Remove vestigial code in socketmodule.c for Mac OS X 10.1 ( #131090 )
2025-03-13 00:13:07 -04:00
Hood Chatham
db1e5827c4
gh-127503: Improve tracebacks on Emscripten when there is a trap ( #131158 )
...
Modifies the behavior of the interpreter on crash under Emscripten:
1. No Python traceback shown on segfault/trap
2. The JavaScript source line is shown
The JavaScript source line is super long and completely unenlightening,
whereas the Python traceback is very helpful.
2025-03-13 08:28:15 +08:00
Yan Yanchii
3618240624
gh-126835: Avoid creating unnecessary tuple when looking for constant sequence during constant folding ( #131054 )
2025-03-12 21:45:54 +00:00
Tian Gao
b52866953a
gh-131123: Support completion in pdb
for convenience variable attributes ( #131124 )
2025-03-12 17:23:53 -04:00
Ethan Furman
17d06aeb54
gh-131045: [Enum] fix flag containment checks when using values (GH-131053)
...
Check would fail if value would create a pseudo-member, but that member
had not yet been created. We now attempt to create a pseudo-member for
a passed-in value first.
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-03-12 12:10:47 -07:00
Barney Gale
db6a998b18
GH-130614: pathlib ABCs: revise test suite for writable paths ( #131112 )
...
Test `pathlib.types._WritablePath` in a dedicated test module. These tests
cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former
two classes are implementations of `_WritablePath` for use in tests.
2025-03-12 19:06:43 +00:00
Kumar Aditya
ea57ffa02e
gh-131141: fix data race in instrumentation while registering callback ( #131142 )
2025-03-13 00:11:52 +05:30
Raymond Hettinger
25f24b01e3
Improve docstring for random.binomialvariate (gh-131164)
...
Add probability distribution to the docstring
2025-03-12 13:25:31 -05:00
Sam Gross
776ec1e167
gh-110097: Fix flaky test_timeout
in test_concurrent_futures.test_process_pool
(gh-131108)
...
On heavily loaded systems, the launch of the workers to run
`time.sleep(0)` can take longer than the five second timeout.
2025-03-12 13:16:23 -04:00
Mark Shannon
f30376c650
GH-127705: Fix _Py_RefcntAdd to handle objects becoming immortal (GH-131140)
2025-03-12 16:54:10 +00:00
Victor Stinner
061da44bac
gh-111178: Change Argument Clinic signature for @classmethod
( #131157 )
...
Use "PyObject*", instead of "PyTypeObject*", for `@classmethod`
functions to fix an undefined behavior.
2025-03-12 17:42:07 +01:00
T. Wouters
de2f7da77d
gh-115999: Add free-threaded specialization for FOR_ITER ( #128798 )
...
Add free-threaded versions of existing specialization for FOR_ITER (list, tuples, fast range iterators and generators), without significantly affecting their thread-safety. (Iterating over shared lists/tuples/ranges should be fine like before. Reusing iterators between threads is not fine, like before. Sharing generators between threads is a recipe for significant crashes, like before.)
2025-03-12 16:21:46 +01:00
Victor Stinner
db27aee2fe
gh-131152: Remove unused imports in _pyrepl
and ctypes
( #131150 )
2025-03-12 14:04:12 +00:00
Victor Stinner
14aed5e8ab
gh-131152, pkgutil: Remove unused imports ( #131149 )
2025-03-12 15:03:36 +01:00
Sam Gross
7ffe93faf1
gh-131121: Fix _Py_atomic_store_char_relaxed
memory order (gh-131122)
2025-03-12 09:03:04 -04:00
Pieter Eendebak
1fb7e2aeb7
gh-120608: Make reversed iterator work with free-threading ( #120971 )
...
Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-03-12 12:39:52 +01:00
Victor Stinner
4dcbe06fd2
gh-111178: Fix type of PyCMethod's "nargs" argument (GH-131135)
...
Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.
2025-03-12 11:54:02 +01:00
Daniel Pope
e0637cebe5
gh-129349: Accept bytes in bytes.fromhex()/bytearray.fromhex() ( #129844 )
...
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-12 11:40:11 +01:00
Pieter Eendebak
405a2d74cb
gh-123471: make itertools.batched
thread-safe ( #129416 )
2025-03-12 15:30:33 +05:30
Stan Ulbrych
155c44b901
gh-81267: Correct time.sleep() error message ( #131055 )
2025-03-12 08:12:57 +00:00
donBarbos
15a8412b5e
gh-93096: Load doctests in test_itertools
( #131133 )
2025-03-12 08:40:59 +01:00
Victor Stinner
48cca72a7f
gh-111178: Fix function signatures in rangeobject.c ( #131101 )
2025-03-12 07:29:20 +01:00
Sergey B Kirpichev
52756c30db
Use subTest() in math.fma() tests ( #131125 )
2025-03-12 07:22:28 +01:00
Pablo Galindo Salgado
ebc24d54bc
gh-117174: Fix reference leak and gdb tests ( #131095 )
2025-03-11 23:17:58 +00:00
Sam Gross
c00ac57824
gh-131113: Fix data race in dict.popitem() (gh-131115)
...
The clearing of the key, hash, and value need to use atomic operations
to avoid a data race with concurrent read operations.
2025-03-11 19:15:22 -04:00
Barney Gale
ad90c5fabc
GH-130614: pathlib ABCs: revise test suite for readable paths ( #131018 )
...
Test `pathlib.types._ReadablePath` in a dedicated test module. These tests
cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former
two classes are implementations of `_ReadablePath` for use in tests.
2025-03-11 20:54:22 +00:00