Commit Graph

15494 Commits

Author SHA1 Message Date
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
Pablo Galindo Salgado 9e51301234 gh-138122: Allow tachyon to write and read binary output (#142730) 2025-12-22 23:57:20 +00:00
Yongtao Huang 3960878143 Remove unreachable code in mmapmodule error path on Windows (GH-143063)
mmapmodule: remove unreachable code in Windows error path

Remove an unreachable `return NULL` after `PyErr_SetFromWindowsErr()` in
the Windows mmap resize error path.

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-22 11:16:50 +01:00
AZero13 5989095dfd gh-143012: use Py_ssize_t cast for PyBytes_FromStringAndSize (#143013) 2025-12-20 10:37:10 +03:00
Donghee Na 14f0b5191a gh-142419: Add mmap.set_name method for user custom annotation (gh-142480) 2025-12-18 23:33:49 +09:00
Pablo Galindo Salgado 77b56eafde gh-91048: Refactor common data into context object in Modules/_remote_debugging (#142879) 2025-12-17 17:43:52 +00:00
Petr Viktorin 7d81eab923 gh-142225: Add PyABIInfo_VAR to to _testcapimodule & _testinternalcapi (GH-142833) 2025-12-17 16:33:09 +01:00
Pablo Galindo Salgado 568a819f67 gh-138122: Validate base frame before caching in remote debugging frame cache (#142852) 2025-12-17 15:12:28 +00:00
Benjamin Johnson 2b466c47c3 gh-112127: Fix possible use-after-free in atexit.unregister() (GH-114092)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-17 17:09:57 +02:00
wangxiaolei 8307a14d0e gh-142783: Fix possible use after free in zoneinfo module (GH-142790) 2025-12-17 08:35:08 +00:00
Edward Xu a043407510 gh-142495: Make defaultdict keep existed value when racing with __missing__ (GH-142668) 2025-12-16 17:04:20 +02:00
Sergey B Kirpichev 15a9762500 gh-142595: Amend be5e0dcded (fix NULL pointer dereference) (GH-142775) 2025-12-16 10:52:20 +02:00
Alper 1a9cdaf63a gh-116738: Make _bz2 module thread-safe (gh-142756)
Make the attributes in _bz2 module thread-safe on the free-threading build.
Attributes (eof, needs_input, unused_data) are now stored atomically or
accessed via mutex-protected getters.
2025-12-15 12:47:04 -05:00
yihong 1d3854a19a gh-142594: fix by property calls io.TextIOWrapper.detach (GH-142706)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
2025-12-15 15:13:58 +01:00
Pablo Galindo Salgado 6658e2cb07 gh-138122: Add --subprocesses flag to profile child processes in tachyon (#142636) 2025-12-15 12:11:40 +00:00
Hugo van Kemenade 38ad651b67 gh-76007: Deprecate __version__ attribute in ctypes (#142679) 2025-12-15 13:30:23 +02:00
Kumar Aditya fb554ad68d gh-140414: streamline thread state access in asyncio (#142742) 2025-12-15 16:57:51 +05:30
Bénédikt Tran d3ef5ba34d gh-142451: correctly copy HMAC attributes in HMAC.copy() (#142510) 2025-12-14 09:45:36 +01:00
Alper 1eddef8193 gh-116738: Make zlib module thread-safe (gh-142432)
Makes the zlib module thread-safe free-threading build. Even though operations
are protected by locks, attributes exposed via PyMemberDef (eof, needs_input,
unused_data, unconsumed_tail) should still be stored atomically within locked
sections, since they can be read without acquiring the lock.
2025-12-12 13:14:42 -05:00
Sergey B Kirpichev be5e0dcded gh-142595: add type check for namedtuple call during decimal initialization (GH-142608) 2025-12-12 11:47:45 +01:00
Pablo Galindo Salgado 6a0135a392 gh-138122: Add exception profiling mode to the sampling profiler (#142561) 2025-12-11 20:46:34 +00:00
Neil Schemenauer e38967ed60 gh-142531: Fix free-threaded GC performance regression (gh-142562)
If there are many untracked tuples, the GC will run too often, resulting
in poor performance.  The fix is to include untracked tuples in the
"long lived" object count. The number of frozen objects is also now
included since the free-threaded GC must scan those too.
2025-12-11 12:30:56 -08:00
Sam Gross a26c831bc4 gh-142589: Fix PyUnstable_Object_IsUniqueReferencedTemporary (gh-142593)
PyUnstable_Object_IsUniqueReferencedTemporary wasn't handling tagged
ints on the evaluation stack properly.
2025-12-11 14:41:03 -05:00
Bartosz Sławecki 8cfa351560 Fix os.posix_spawn() error handling (#142532)
Consistently use `goto exit;` in `py_posix_spawn()`.
2025-12-11 18:02:26 +01:00
AZero13 44d3dc6491 gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is unset (gh-142439) 2025-12-11 23:30:39 +09:00
Kumar Aditya 42d2bedb87 gh-142556: fix crash when a task gets re-registered during finalization in asyncio (#142565) 2025-12-11 15:04:49 +05:30