Commit graph

15432 commits

Author SHA1 Message Date
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
Benjamin Peterson
e163fbdeda
fixes gh-139090: add os.RWF_DONTCACHE (#139091) 2025-09-18 08:13:23 -07:00
Victor Stinner
9b35f7cdfe
gh-129813, PEP 782: Use PyBytesWriter in bufferedio.c (#139121)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-18 17:00:10 +02:00
Victor Stinner
446587c58e
gh-129813, PEP 782: Use PyBytesWriter in _ssl (#138929)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-18 16:54:18 +02:00
Sergey B Kirpichev
b0a8073f1b
gh-73487: Convert _decimal to use Argument Clinic (part 7) (#138221)
Use "defining class" converter, where possible.
2025-09-18 16:08:27 +02:00
Adam Turner
1ebd726c9b
gh-64490: Argument Clinic: Add support for `**kwds` (#138344)
This adds a scaffold of support, initially only working with
strictly positional-only arguments. The FASTCALL calling
convention is not yet supported.
2025-09-18 13:31:42 +00:00
Victor Stinner
243d599a05
gh-129813, PEP 782: Use PyBytesWriter in _sqlite (#138956)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-18 14:58:35 +02:00
Peter Bierma
2191497933
gh-136003: Execute pre-finalization callbacks in a loop (GH-136004) 2025-09-18 08:29:12 -04:00
Victor Stinner
d6a6fe2a5b
gh-129813, PEP 782: Use PyBytesWriter in ssl.MemoryBIO (#139113)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-18 14:25:31 +02:00
Peter Bierma
49f1c302df
gh-139098: Use multiphase initialization in _testcapi (GH-139102)
Use multiphase initialization in the _testcapi module to allow loading in subinterpreters. The isolation here isn't perfect as there's still some use of globals, but _testcapi should generally work in other interpreters.
2025-09-18 11:00:50 +00:00
Stan Ulbrych
70ad1b30df
gh-138998: expat/refresh.sh: Fail if Step 3 is not completed (GH-139049) 2025-09-18 12:47:42 +02:00
Cody Maloney
db68bfc771
gh-138720: Make Buffered closed check match flush (GH-138724)
In `_io__Buffered_flush_impl` the macro `CHECK_CLOSED` is used to check
the `buffered*` is in a good state to be flushed. That differs slightly
from `buffered_closed`.

In some cases, that difference would result in `close()` thinking the
file needed to be flushed and closed while `flush()` thought the file
was already closed.

This could happen during GC and would result in an unraisable exception.
2025-09-18 12:02:29 +02:00
Erlend E. Aasland
d1904b91cb
gh-116943: Ensure makesetup does not choke on missing EOL in Setup.* files (#139100) 2025-09-18 09:25:01 +00:00
Victor Stinner
4263bc3b3b
gh-129813, PEP 782: Use PyBytesWriter in _socket (#139097)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-18 11:20:56 +02:00