129835 Commits

Author SHA1 Message Date
A.Ibrahim
a4086d7f89
gh-142829: Fix use-after-free in Context.__eq__ via re-entrant ContextVar.set (#142905) 2026-01-09 17:57:34 +05:30
AN Long
a9ca49d9c6
gh-72239: Add note distinguishing concurrent.futures.Future from asyncio.Future (#143288) 2026-01-09 17:48:32 +05:30
Victor Stinner
39a2bcf949
gh-143547: Fix PyErr_FormatUnraisable() fallback (#143557)
Hold a strong reference to 'hook' while calling the default
unraisable took to log hook failure.

Fix test_sys.UnraisableHookTest: use the right decorator function to
disable colors. Previously, tests were always skipped.
2026-01-09 13:16:22 +01:00
zhong
6d54b6ac7d
gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408)
PyObject_GetBuffer() can execute user code (e.g. via __buffer__), which may
close or otherwise mutate a BytesIO object while write() or writelines()
is in progress. This could invalidate the internal buffer and lead to a
use-after-free.

Ensure that PyObject_GetBuffer() is called before validation checks.
2026-01-09 13:50:56 +02:00
Henry Chen
dcdb23f9db
gh-143429: Use compile-time NaN encoding detection for test_struct (#143432) 2026-01-09 10:46:48 +00:00
Petr Viktorin
234a15dc4e
gh-141004: Improve make check-c-api-docs (GH-143564)
- Gather all documented names into a set in a single pass.
  This makes the check much faster.

- Do not match substrings (e.g. documenting `PyErr_WarnEx`
  doesn't mean that `PyErr_Warn` is documented)

- Consider `PY`-prefixed names (a lot of old macros use this)
2026-01-09 11:16:50 +01:00
Yongtao Huang
fd6d41b292
Test: remove unintended unittest.main() in live collector tests (#143590) 2026-01-09 08:49:54 +00:00
Adorilson Bezerra
af9f783a7e
gh-106318: Add examples for str.replace() method (GH-143581) 2026-01-09 09:01:00 +01:00
Savannah Ostrowski
68a01f901f
GH-43374: Fix urlretrieve reporthook to report actual bytes read (#142653) 2026-01-09 00:32:05 +00:00
Brett Cannon
dfeefbe8ea
GH-139686: Revert "gh-139686: Make reloading a lazy module no-op (GH-139857)" (#143584)
This reverts commits 57db12514ac686f0a752ec8fe1c08b6daa0c6219 and 0a97941245f1dda6d838f9aaf0512104e5253929.
2026-01-08 22:08:03 +00:00
Russell Keith-Magee
b54a1d272e
Add Emscripten test skips for recently added tests. (#143551)
Some recent changes introduced tests that can't run on Emscripten.
This change adds test skips for those tests.
2026-01-09 05:47:38 +08:00
Sam Gross
e2f15aec16
gh-120321: Make gen.gi_frame.clear() thread-safe (gh-143112) 2026-01-08 14:45:54 -05:00
Hai Zhu
aeb3403563
gh-143421: Move JitOptContext from stack allocation to per-thread heap allocation (GH-143536)
* move JitOptContext to _PyThreadStateImpl
* make _PyUOpInstruction buffer a part of _PyThreadStateImpl

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-01-08 19:38:21 +00:00
Heikki Toivonen
cea2d2475d
gh-143445: Optimize deepcopy for 1.04x speedup (#143449)
Gains according to pyperformance:

```
deepcopy:
Mean +- std dev: 411 us +- 2 us -> 396 us +- 3 us: 1.04x faster
Significant (t=28.94)

deepcopy_reduce:
Mean +- std dev: 4.38 us +- 0.05 us -> 4.23 us +- 0.04 us: 1.04x faster
Significant (t=20.05)
```

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-08 16:28:02 +01:00
Sam Gross
8cf5c4d89a
gh-142908: Don't use DK_IS_UNICODE in interpreter (gh-142909)
`DK_IS_UNICODE()` includes split keys and we don't want to specialize on
those accesses..
2026-01-08 09:32:20 -05:00
Sam Gross
49c3b0a67a
gh-142095: Use thread local frame info in py-bt and py-bt-full when available (gh-143371)
In optimized and `-Og` builds, arguments and local variables are frequently
unavailable in gdb. This makes `py-bt` fail to print anything useful. Use the
`PyThreadState*` pointers `_Py_tss_gilstate` and `Py_tss_tstate` to find the
interpreter frame if we can't get the frame from the
`_PyEval_EvalFrameDefault` call.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-08 09:18:24 -05:00
Alex Willmer
5462002bbe
gh-143513: Clarify changed argument name of ResourceReader.is_resource (GH-143523) 2026-01-08 08:40:17 -05:00
Victor Stinner
efaa56f73c
gh-143528: Fix test_time.test_thread_time() (#143558)
Tolerate 100 ms instead of 20 ms to support slow CIs.
2026-01-08 14:05:57 +01:00
Aniket
f3e069a7ab
gh-140025: Fix queue.SimpleQueue.__sizeof__() to return correct size (#143137) 2026-01-08 12:40:25 +00:00
Serhiy Storchaka
c07e5ec0a9
gh-143553: Add support for parametrized resources in regrtests (GH-143554)
For example, "-u xpickle=2.7" will run test_xpickle only against Python 2.7.
2026-01-08 13:51:38 +02:00
Bartosz Sławecki
6c9f7b4406
gh-143517: Fix an edge case in rewriting stringified starred annotations (#143518) 2026-01-07 19:41:27 -08:00
VanshAgarwal24036
67d3d0344f
gh-143089: Fix ParamSpec default examples to use list instead of tuple (#143179) 2026-01-07 19:32:44 -08:00
Sam Gross
f11f5ebfe6
gh-129824: Fix data race on runtime->gilstate.check_enabled (gh-143530) 2026-01-07 17:56:14 -05:00
Tomas R.
228d95582e
Fix a typo in STORE_SLICE docs (#143500) 2026-01-07 23:36:22 +01:00
Dino Viehland
bfc3d8d77f
gh-143531: Use macro to check if PEP 523 is hooked (#143532)
Use macro to check if PEP 523 is hooked
2026-01-07 13:26:19 -08:00
Savannah Ostrowski
9a3263ff8f
GH-142950: Process format specifiers before colourization in argparse help (#142960) 2026-01-07 17:39:47 +00:00
Sam Gross
d04394929b
gh-117657: Remove remaining TSan suppressions (gh-143499) 2026-01-07 17:34:05 +00:00
Adorilson Bezerra
51a56a3a7b
gh-106318: Add examples for str.casefold() and str.lower() methods (#142154)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-01-07 16:16:25 +00:00
T. Wouters
b2827de18f
gh-141536: Fix a crash when running test_capi *after* test_code in the same process (#141537) 2026-01-07 16:40:33 +01:00
Łukasz Langa
b3e4a3462f
gh-138568: Make help mode in PyREPL not exit on empty line input (#143512)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong0618 <zouzou0208@gmail.com>
2026-01-07 16:30:58 +01:00
Giampaolo Rodola
a1eedaee98
gh-94172: delete mention of ssl_version from ftplib doc (#143515)
`FTP_TLS.ssl_version` class attribute was removed in https://github.com/python/cpython/commit/ef0e72b31d2.
2026-01-07 15:11:50 +01:00
Petr Viktorin
8565ddd288
gh-141671: PyMODINIT_FUNC: apply __declspec(dllexport) on Windows (GH-141672) 2026-01-07 13:09:48 +01:00
Serhiy Storchaka
b866a1c73f
gh-75572: Fix test_xpickle and disable it by default (GH-143503) 2026-01-06 23:51:12 +00:00
Adorilson Bezerra
4fb6a31bce
gh-106318: Add example for str.index() (#137023) 2026-01-06 23:42:11 +02:00
Nadeshiko Manju
0a5c04a5ce
gh-134584: Eliminate redundant refcounting from TO_BOOL_STR (GH-143417)
Signed-off-by: Manjusaka <me@manjusaka.me>
2026-01-06 21:11:53 +00:00
Sam Gross
98e55d70bc
gh-132070: Fix PyObject_Realloc thread-safety in free threaded Python (gh-143441)
The PyObject header reference count fields must be initialized using
atomic operations because they may be concurrently read by another
thread (e.g., from `_Py_TryIncref`).
2026-01-06 15:55:37 -05:00
Ken Jin
df355348f0
gh-142982: Specialize CALL_FUNCTION_EX (GH-143391) 2026-01-06 20:34:08 +00:00
Andrii Hrimov
ff7d1cec41
gh-133315: Document that compat32 should not be used with MIMEPart/EmailMessage (#143307) 2026-01-06 15:18:37 -05:00
Xiao Yuan
51227b6b1a
Doc: Fix missing closing parenthesis in argparse example (#143488) 2026-01-06 09:53:43 -08:00
Kumar Aditya
74bb3ca1f8
gh-142863: optimize list and set calls with generator expressions (#142864) 2026-01-06 23:23:28 +05:30
ADITYA RAI
e79c9b7031
gh-142302: Fix mkstemp() documentation: clarify file descriptor inheritance behavior (#142338)
The documentation incorrectly stated that the file descriptor is not
inherited by child processes. In reality, the close-on-exec flag (when
available) only prevents inheritance across exec() calls, not fork().

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-06 17:08:25 +00:00
Ken Jin
8735daf3e8
gh-75572: Forward-port test_xpickle from Python 2 to 3 (GH-22452)
Move data classes used in tests to separate file test_picklecommon.py,
so it can be imported in old Python versions.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-06 19:03:03 +02:00
Adorilson Bezerra
7b0a372b20
gh-106318: Add examples for str.isprintable() (#140043)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-01-06 17:43:44 +01:00
Ken Jin
90c44bc803
gh-131798: Support generator frames in the JIT optimizer (GH-143340) 2026-01-06 16:39:57 +00:00
Kumar Aditya
faa3dc7c64
gh-143469: enable LOAD_ATTR_MODULE specialization even if __getattr__ is defined (#143470) 2026-01-06 22:09:18 +05:30
Gleb Smirnoff
05406b221d
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (#142993) 2026-01-06 17:25:29 +01:00
reiden
54f1ed0299
gh-134584: Eliminate redundant refcounting in TO_BOOL_ALWAYS_TRUE (GH-143427)
Co-authored-by: Ken Jin <kenjin@python.org>
2026-01-06 16:11:56 +00:00
Ken Jin
d9c1235db4
gh-139038: Add macOS performance numbers for the JIT (GH-143479) 2026-01-06 15:19:35 +00:00
Sam Gross
841b7482dd
gh-143424: Fix assertion in _PyMutex_LockTimed (gh-143439)
The assertion doesn't necessarily hold for `threading.Lock`, so allow
the lock to be unlocked if `_PY_LOCK_PYTHONLOCK` is set on the flags.
2026-01-06 09:40:14 -05:00
Clay Dugo
d745b60ef2
gh-143474: Add os.RWF_ATOMIC constant (GH-143475) 2026-01-06 09:35:51 -05:00