Commit graph

15345 commits

Author SHA1 Message Date
Jeffrey Bosboom
fe9ac7fc8c
gh-83714: Implement os.statx() function (#139178)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-15 13:44:08 +00:00
Bénédikt Tran
27acaf1cb7
gh-139327: consolidate sqlite3_finalize and sqlite3_reset usages (GH-139329) 2025-10-15 15:18:07 +02:00
Stan Ulbrych
46f11b36ad
gh-76007: Deprecate zlib.__version__ attribute (#140130) 2025-10-15 13:18:48 +02:00
Emma Smith
f262297d52
gh-139877: Use PyBytesWriter in pycore_blocks_output_buffer.h (#139976)
Previously, the _BlocksOutputBuffer code creates a list of bytes objects to handle the output data from compression libraries. This ends up being slow due to the output buffer code needing to copy each bytes element of the list into the final bytes object buffer at the end of compression.

The new PyBytesWriter API introduced in PEP 782 is an ergonomic and fast method of writing data into a buffer that will later turn into a bytes object. Benchmarks show that using the PyBytesWriter API is 10-30% faster for decompression across a variety of settings. The performance gains are greatest when the decompressor is very performant, such as for Zstandard (and likely zlib-ng). Otherwise the decompressor can bottleneck decompression and the gains are more modest, but still sizable (e.g. 10% faster for zlib)!

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-14 10:03:55 -07:00
Stan Ulbrych
87eadce3e0
gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) 2025-10-14 22:55:00 +09:00
Sergey B Kirpichev
6ecf77dbde
gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836)
Sync C/Python implementation of the decimal: logical_ops for contexts.
2025-10-14 11:02:02 +00:00
mdehoon
a00655b877
gh-140001: Remove obsolete TCL_WIN_SOCKET macro (from Tcl 7.x) from _tkinter.c (GH-139998)
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-10-13 13:29:42 +03:00
Victor Stinner
35e9d41a9c
gh-139482: Add posix._clearenv() function (#139965) 2025-10-11 22:58:43 +02:00
Victor Stinner
166cdaa6fb
gh-111489: Remove _PyTuple_FromArray() alias (#139973)
Replace _PyTuple_FromArray() with PyTuple_FromArray().
Remove pycore_tuple.h includes.
2025-10-11 22:58:14 +02:00
Bénédikt Tran
cdd3eee7fc
gh-139929: fix incorrect OpenSSL version-based guard in _ssl.c (GH-139945)
fix OpenSSL version-based guards
2025-10-11 10:34:08 -07:00
Kumar Aditya
b881df47ff
gh-139894: fix incorrect sharing of current task while forking in asyncio (#139897)
Fix incorrect sharing of current task with the forked child process by clearing thread state's current task and current loop in `PyOS_AfterFork_Child`.
2025-10-10 21:58:23 +05:30
Victor Stinner
d0b18b19fa
gh-129813: Fix PyBytesWriter tests (#139892) 2025-10-10 13:01:06 +02:00
Nadeshiko Manju
7cafd76a7f
gh-139184: Set O_CLOEXEC for master_fd when calling os.forkpty() (#139408)
Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-10 10:56:10 +02:00
Victor Stinner
e31c22dbf9
gh-111489: Add PyTuple_FromArray() function (#139691) 2025-10-10 08:54:12 +02:00
Alper
7f155f9c46
gh-116738: make mmap module thread-safe (#139237) 2025-10-09 12:00:47 +05:30
Bénédikt Tran
b04a57deef
gh-139748: fix leaks in AC error paths when using unicode FS-based converters (#139765) 2025-10-08 20:52:44 +05:30
Kumar Aditya
49fb46f555
gh-139774: use relaxed atomics for datetime hashes (#139775) 2025-10-08 19:49:54 +05:30
Victor Stinner
c4e7d245d6
gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
Victor Stinner
5a77f02d72
gh-79315: Remove Include/pylock.h and Include/monitoring.h (#139731)
Keep Include/cpython/pylock.h and Include/cpython/monitoring.h.
2025-10-08 00:49:24 +02:00
Skip Montanaro
d1ca001d35
gh-127330: Comment correction in _ssl.c (#139603) 2025-10-05 19:15:46 +01:00
Sebastian Pipping
6edb2ddb5f
gh-139400: Make sure that parent parsers outlive their subparsers in pyexpat (#139403)
* Modules/pyexpat.c: Disallow collection of in-use parent parsers.

Within libexpat, a parser created via `XML_ExternalEntityParserCreate`
is relying on its parent parser throughout its entire lifetime.
Prior to this fix, is was possible for the parent parser to be
garbage-collected too early.
2025-10-05 17:37:42 +02:00
Zachary Ware
98e748b3a0
gh-139573: Update OpenSSL in CI (GH-139577) 2025-10-04 19:43:17 -05:00
Sebastian Pipping
fc48a3c9ca
gh-90949: Fix an "unused function" compiler warning introduced in GH-139234 (#139558)
Fix a compiler warning `-Wunused-function` after f04bea44c3.

The `set_invalid_arg` function in `Modules/pyexpat.c` may be unused if the underlying Expat
version is less than 2.4.0.
2025-10-04 14:19:06 +00:00
Dino Viehland
ff0cf0af10
gh-139525: Don't specialize functions which have a modified vectorcall (#139524)
Don't specialize functions which have a modified vectorcall
2025-10-03 09:58:32 -07:00
Victor Stinner
4e7e2dd043
gh-139322: Reenable test_os.test_getlogin() (#139498)
Fix also getlogin() errno.
2025-10-02 20:51:57 +00:00
Kumar Aditya
76b07c035c
gh-116946: partial revert gh-139073 for thread handle type (#139474) 2025-10-01 17:49:31 +00:00
Nadeshiko Manju
f39dea3bae
gh-123828: Fix data race in _interpchannels._waiting_release (GH-124107) 2025-10-01 11:34:47 +00:00
Bénédikt Tran
d0a3eff9d6
gh-139327: fix some reference leaks in sqlite3 error branches (#139328) 2025-10-01 11:10:12 +02:00
Sergey Miryanov
1588413ca7
gh-116946: remove unnecessary gc from immutable types (#139073) 2025-10-01 13:15:58 +05:30
Ken Jin
c86eb4d3ac
gh-139210: Fix use-after-free in xml.etree.ElementTree.iterparse() (GH-139211) 2025-09-30 20:50:50 +03:00
Bénédikt Tran
bc172ee830
gh-139283: correctly handle size limit in cursor.fetchmany() (#139296)
Passing a negative or zero size to `cursor.fetchmany()` made it fetch all rows
instead of none.

While this could be considered a security vulnerability, it was decided to treat
this issue as a regular bug as passing a non-sanitized *size* value in the first
place is not recommended.
2025-09-30 11:18:55 +02:00
AN Long
bd1ada6df3
gh-138092: Allow calling mmap.flush with offset only (#138093) 2025-09-30 11:08:50 +02:00
Bénédikt Tran
3779f2b95e
gh-139393: fix _CALL_LEN JIT tests for tuples (#139394)
Fix a regression introduced in 7ce25edb8f
where `_PY_NSMALLPOSINTS` was changed from 257 to 1025.
2025-09-28 19:30:44 +02:00
Bénédikt Tran
666112376d
gh-90949: expose Expat API to tune exponential expansion protections (#139368)
Expose the XML Expat 2.7.2 APIs to tune protections against
"billion laughs" [1] attacks.

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetBillionLaughsAttackProtectionActivationThreshold(threshold)`, and
- `parser.SetBillionLaughsAttackProtectionMaximumAmplification(max_factor)`.

This completes the work in f04bea44c3,
and improves the existing related documentation.

[1]: https://en.wikipedia.org/wiki/Billion_laughs_attack
2025-09-28 08:27:04 +00:00
Stan Ulbrych
48d0d0dd97
gh-139312: Update bundled libexpat to 2.7.3 (GH-139319)
+ Blurb
+ Update sbom.spdx.json
2025-09-26 19:44:36 -07:00
Jacob Bower
93ac3525b9
gh-139276: Remove generator type check in _testcapimodule.c:raise_SIGINT_then_send_None (#139252)
* Remove generator type check in raise_SIGINT_then_send_None

In the Cinder JIT we use a different type for generators, which breaks
the test which uses this function.

In general I believe the intent with generators is they have the right
structure rather than type, so a failure to find the 'send()' method is arguably
more correct if the wrong object is used.

* Also stop using PyGenObject type
2025-09-26 11:52:10 -07:00
Bénédikt Tran
68a1778b77
gh-90949: amend GH-139234 in prevision of future mitigation API (#139366)
Fix some typos left in f04bea44c3,
and simplify some internal functions to ease maintenance of future
mitigation APIs.
2025-09-26 17:59:40 +00:00
Bénédikt Tran
f04bea44c3
gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (#139234)
Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.
2025-09-26 14:13:56 +00:00
Pablo Galindo Salgado
1963e70100
gh-139275: Fix compilation of Modules/_remote_debugging_module.c when the system doesn't have process_vm_readv (#139307) 2025-09-25 00:16:44 +01:00
dgpb
7ce25edb8f
gh-133059: Increase the small positive integer cache to 1024 (GH-133160) 2025-09-24 17:05:30 -04:00
Victor Stinner
8d83b7df3f
gh-139156: Optimize the UTF-7 encoder (#139253)
Remove base64SetO and base64WhiteSpace parameters.
2025-09-24 17:57:29 +02:00
Bénédikt Tran
a5e0562350
gh-133644: remove PyWeakref_GetObject and PyWeakref_GET_OBJECT (GH-133657) 2025-09-24 11:25:56 +02:00
Serhiy Storchaka
1a2e00c97a
gh-67795: Accept any real numbers as timestamp and timeout (GH-139224)
Functions that take timestamp or timeout arguments now accept any
real numbers (such as Decimal and Fraction), not only integers or floats,
although this does not improve precision.
2025-09-23 21:31:42 +03:00
Serhiy Storchaka
5854cf38a2
gh-130567: Fix possible crash in locale.strxfrm() (GH-138940)
On some macOS versions there was an off-by-one error in wcsxfrm() which
caused writing past the end of the array if its size was not calculated
by running wcsxfrm() first.

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2025-09-23 15:11:50 +00:00
Mark Shannon
16eae6d90d
GH-137573: Add test to check that the margin used for overflow protection is larger than the stack space used by the interpreter (GH-137724) 2025-09-23 15:47:27 +02:00
Serhiy Storchaka
20d5494c88
Revert "gh-66234: Add flag to disable the use of mmap in dbm.gnu (GH-135005)" (GH-136989)
This reverts commit 0cec424af5.
2025-09-20 11:01:44 +03:00
Pablo Galindo Salgado
67636f72d2
gh-138709: Implement CPU time profiling in profiling.sample (#138710) 2025-09-19 19:17:28 +01:00
Victor Stinner
47485c0384
gh-129813, PEP 782: Fix refleak in sock_recvfrom() (GH-139151) 2025-09-19 09:30:11 +00:00
Peter Bierma
3eec897752
gh-136003: Skip non-daemon threads when exceptions occur during finalization (GH-139129)
During finalization, we need to mark all non-daemon threads as daemon to quickly shut down threads when sending CTRL^C to the process. This was a minor regression from GH-136004.
2025-09-18 16:04:01 -04:00
Victor Stinner
d641c41c88
gh-129813, PEP 782: Use PyBytesWriter in socket recvmsg() (#139131)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-18 17:57:04 +02:00