Commit graph

15519 commits

Author SHA1 Message Date
Ken Jin
949b5ec8e6
gh-142913: Remove JIT interpreter for interpreter generator tests (GH-143944) 2026-01-17 00:34:39 +00:00
Dino Viehland
5996636ab5
gh-142913: Update generated code that conflicted with other landed change (#143932)
Update test cases
2026-01-16 11:10:15 -08:00
Dino Viehland
4d5a676aa0
gh-142913: Add test case for interpreter generator w/ overridden opcodes (#142911)
Add test case for interpreter generator w/ overridden opcodes
2026-01-16 10:33:29 -08:00
Muneeb Ullah
3e93225798
gh-143674: Document F/D complex format characters in struct module (#143675)
Add documentation for the F (complex from two floats) and D (complex
from two doubles) format characters in the struct module docstring.
These format characters were implemented but not documented.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-16 18:09:56 +01:00
Peter Bierma
19e64afddf
gh-141070: Rename PyUnstable_Object_Dump to PyObject_Dump (GH-142848) 2026-01-16 09:19:43 -05:00
Serhiy Storchaka
780e9692fe
gh-143672: Finish conversion of the struct module to Argument Clinic (GH-143857)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-16 13:35:23 +02:00
Victor Stinner
3514ba2175
gh-142434: Use ppoll() if available in select.poll (#143529) 2026-01-15 13:49:46 +01:00
Peter Gessler
f5685a266b
gh-80620: Support negative timestamps on windows in time.gmtime, time.localtime, and datetime module (#143463)
Previously, negative timestamps (representing dates before 1970-01-01) were
not supported on Windows due to platform limitations. The changes introduce a
fallback implementation using the Windows FILETIME API, allowing negative
timestamps to be correctly handled in both UTC and local time conversions.
Additionally, related test code is updated to remove Windows-specific skips
and error handling, ensuring consistent behavior across platforms.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-15 10:51:11 +01:00
Serhiy Storchaka
85013d7a55
Fix refleaks in new unicodedata classes added in gh-74902 (GH-143843) 2026-01-14 19:55:11 +00:00
Serhiy Storchaka
bab1d7a561
gh-74902: Add Unicode Grapheme Cluster Break algorithm (GH-143076)
Add the unicodedata.iter_graphemes() function to iterate over grapheme
clusters according to rules defined in Unicode Standard Annex #29.

Add unicodedata.grapheme_cluster_break(), unicodedata.indic_conjunct_break()
and unicodedata.extended_pictographic() functions to get the properties
of the character which are related to the above algorithm.

Co-authored-by: Guillaume "Vermeille" Sanchez <guillaume.v.sanchez@gmail.com>
2026-01-14 14:37:57 +00:00
Serhiy Storchaka
a471a32f4b
gh-143214: Add the wrapcol parameter in binascii.b2a_base64() and base64.b64encode() (GH-143216) 2026-01-14 14:44:53 +02:00
Alper
fca7fec88c
gh-116738: Make lzma module thread-safe (#142947) 2026-01-13 14:02:27 +00:00
Yongtao Huang
f53a801e91
remove duplicate error constants in _winapi (#143684) 2026-01-13 19:11:38 +05:30
Yongtao Huang
103a384bfd
gh-143249: Fix buffer leak when overlapped operation fails to start on windows (#143250) 2026-01-13 19:01:24 +05:30
Serhiy Storchaka
c559135c93
gh-143196: Fix crash in non-standard use of internal JSON encoder object (GH-143618)
The internal encoder object returned by undocumented function
json.encoder.c_make_encoder() (aka _json.make_encoder()) crashed
when it was called with non-zero second argument.
2026-01-12 18:23:05 +00:00
Sam Gross
7d155d7915
gh-140795: Remove 'exc' field in SSLObject (gh-143491)
The 'exc' field was used by our debug SSL callbacks. Keep the exception
in the normal per-thread state to avoid shared mutable state between
threads.

This also avoids a reference count leak if the Python callback raised an
exception because it can be called multiple times per SSL operation.
2026-01-12 17:14:13 +00:00
VanshAgarwal24036
c315748060
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (#143561)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-12 16:39:32 +01:00
Serhiy Storchaka
f3759d21dd
gh-142306: Improve errors for Element.remove() (GH-142308)
* Raise TypeError for non-element argument in the Python implementation
  too.
* Include the repr of the elements in the ValueError error message.
2026-01-12 11:49:18 +02:00
Serhiy Storchaka
dbd10a6c29
gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) 2026-01-12 10:45:10 +02:00
Sergey B Kirpichev
515ae4078d
gh-78724: Raise RuntimeError's when calling methods on non-ready Struct()'s (GH-143643) 2026-01-11 15:52:01 +00:00
Serhiy Storchaka
d1282efb2b
gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664)
Previously, this could cause crash or data corruption, now concurrent calls
of methods of the same object raise RuntimeError.
2026-01-11 14:01:13 +02:00
Nadeshiko Manju
e2f0160026
gh-143604: Hold strong reference to executor during JIT tracing (GH-143646)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2026-01-10 11:15:48 +00:00
Victor Stinner
ba10100c39
gh-143191: Use _PyOS_MIN_STACK_SIZE in _thread.stack_size() (#143601)
The stack size must be at least _PyOS_MIN_STACK_SIZE+SYSTEM_PAGE_SIZE
bytes.
2026-01-09 16:08:40 +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
Aniket
f3e069a7ab
gh-140025: Fix queue.SimpleQueue.__sizeof__() to return correct size (#143137) 2026-01-08 12:40:25 +00:00
Gleb Smirnoff
05406b221d
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (#142993) 2026-01-06 17:25:29 +01:00
Clay Dugo
d745b60ef2
gh-143474: Add os.RWF_ATOMIC constant (GH-143475) 2026-01-06 09:35:51 -05:00
Semyon Moroz
dd750b3485
gh-143331: Schedule to remove format "N" for Decimal (#143372) 2026-01-06 15:12:05 +02:00
Bénédikt Tran
9609574e7f
gh-143309: fix UAF in os.execve when the environment is concurrently mutated (#143314) 2026-01-03 23:05:57 +01:00
Aaron Wieczorek
6c53af18f6
gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (#143312)
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-03 23:01:59 +01:00
Pablo Galindo Salgado
27434c68f8
gh-138122: Skip threads on EPERM in blocking mode profiler (GH-143368)
When using blocking mode in the remote debugging profiler, ptrace calls
to seize threads can fail with EPERM if the thread has exited between
listing and attaching, is in a special kernel state, or is already being
traced. Previously this raised a RuntimeError that was caught by the
Python sampling loop,and retried indefinitely since EPERM is
a persistent condition that will not resolve on its own.

Treat EPERM the same as ESRCH by returning 1 (skip this thread) instead
of -1 (fatal error). This allows profiling to continue with the threads
that can be traced rather than entering an endless retry loop printing
the same error message repeatedly.
2026-01-03 15:37:16 +01:00
Kumar Aditya
abdbe0b807
gh-142615: disallow multiple initializations of asyncio.Task and asyncio.Future (#142616) 2026-01-03 13:27:02 +05:30
Bénédikt Tran
9712dc1d9e
gh-143310: fix crash in Tcl object conversion with concurrent mutations (#143321) 2026-01-02 10:51:05 +01:00
Gregory P. Smith
61fc72a4a4
gh-124951: Optimize base64 encode & decode for an easy 2-3x speedup [no SIMD] (GH-143262)
Optimize base64 encoding/decoding by eliminating loop-carried dependencies. Key changes:
- Add `base64_encode_trio()` and `base64_decode_quad()` helper functions that process complete groups independently
- Add `base64_encode_fast()` and `base64_decode_fast()` wrappers
- Update `b2a_base64` and `a2b_base64` to use fast path for complete groups

Performance gains (encode/decode speedup vs main, PGO builds):
```
             64 bytes    64K        1M
  Zen2:      1.2x/1.8x   1.7x/2.8x  1.5x/2.8x
  Zen4:      1.2x/1.7x   1.6x/3.0x  1.5x/3.0x  [old data, likely faster]
  M4:        1.3x/1.9x   2.3x/2.8x  2.4x/2.9x  [old data, likely faster]
  RPi5-32:   1.2x/1.2x   2.4x/2.4x  2.0x/2.1x
```

Based on my exploratory work done in https://github.com/python/cpython/compare/main...gpshead:cpython:claude/vectorize-base64-c-S7Hku

See PR and issue for further thoughts on sometimes MUCH faster SIMD vectorized versions of this.
2026-01-01 22:03:05 -08:00
Bénédikt Tran
7f6c16a956
gh-142830: prevent some crashes when mutating sqlite3 callbacks (#143245) 2026-01-01 11:55:05 +01:00
AN Long
3c4429f65a
gh-135852: Remove out of tree pywin32 dependency for NTEventLogHandler (GH-137860)
Add RegisterEventSource(), DeregisterEventSource(), ReportEvent()
and a number of EVENTLOG_* constants to _winapi.
2025-12-31 12:50:50 +02:00
Sam Gross
96ab379dca
gh-140795: Keep 'err' in local variable in _ssl.c (gh-143275)
The error return code doesn't need to be mutable state on the SSLSocket.
This simplifes thread-safety and avoids potential reentrancy issues.
2025-12-30 19:45:44 -05:00
Bénédikt Tran
b6b0e14b3d
gh-143200: fix UAFs in Element.__{set,get}item__ when the element is concurrently mutated (#143226) 2025-12-29 18:30:51 +01:00
Ken Jin
6cb245d260
gh-143183: Link trace to side exits, rather than stop (GH-143268) 2025-12-29 15:10:42 +00:00
Bénédikt Tran
7726119651
gh-138122: fix AC warnings in Modules/_remote_debugging/module.c (#143218) 2025-12-27 12:57:03 +00:00
AN Long
1af21ea320
gh-63016: Add flags parameter on mmap.flush (#139553)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-12-27 10:33:56 +00:00
Pablo Galindo Salgado
54362898f3
gh-140739: Fix missing exception on allocation failure in BinaryWriter (#143204) 2025-12-27 01:39:21 +00:00
Pablo Galindo Salgado
d3d4cf9432
gh-140739: Fix crashes from corrupted remote memory (#143190) 2025-12-26 16:06:48 +00:00
Yongtao Huang
b9a4806430
gh-143164: Fix incorrect error message for ctypes bitfield overflow (GH-143165)
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-25 19:08:43 +02:00
Yongtao Huang
579c5b496b
gh-143145: Fix possible reference leak in ctypes _build_result() (GH-143131)
The result tuple was leaked if __ctypes_from_outparam__() failed for any item.

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-25 14:24:25 +00:00
kaushal trivedi
86d904588e
gh-143004: Fix possible use-after-free in collections.Counter.update() (GH-143044)
This happened when the Counter was mutated when incrementing
the value for an existing key.
2025-12-25 09:13:39 +00:00
Pablo Galindo Salgado
7c44f37170
gh-138122: Extend binary profiling format with full source location and opcode (#143088)
Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
2025-12-24 16:15:11 +00:00
Pablo Galindo Salgado
81c8eb85e1
gh-138122: Add blocking mode for accurate stack traces in Tachyon (#142998) 2025-12-23 10:49:47 +00:00
Zheng Yu
a273bc99d2
gh-122431: Correct the non-negative error message in readline.append_history_file (GH-143075)
"positive" -> "non-negative", since zero is included.
2025-12-22 23:35:23 -05:00