Commit graph

15683 commits

Author SHA1 Message Date
Petr Viktorin
91cd2e5806
gh-146175: Soft-deprecate outdated macros; convert internal usage (GH-146178)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-23 12:42:09 +01:00
Victor Stinner
90f9991abb
gh-146056: Rework ref counting in treebuilder_handle_end() (#146167)
Use more regular code to handle reference counting in
treebuilder_handle_end().

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-23 12:17:54 +01:00
Serhiy Storchaka
4561f6418a
gh-145264: Do not ignore excess Base64 data after the first padded quad (GH-145267)
Base64 decoder (see binascii.a2b_base64(), base64.b64decode(), etc)
no longer ignores excess data after the first padded quad in non-strict
(default) mode.  Instead, in conformance with RFC 4648, it ignores the
pad character, "=", if it is present before the end of the encoded data.
2026-03-22 23:12:58 +02:00
Pablo Galindo Salgado
ae6adc9079
gh-146308: Fix error handling issues in _remote_debugging module (#146309) 2026-03-22 21:12:02 +00:00
kangtastic
b4e5bc2164
gh-146192: Add base32 support to binascii (GH-146193)
Add base32 encoder and decoder functions implemented in
C to the binascii module and use them to greatly improve the
performance and reduce the memory usage of the existing
base32 codec functions in the base64 module.
2026-03-22 23:10:28 +02:00
flow
a17301ab3d
gh-135953: Properly obtain main thread identifier in Gecko Collector (#146045) 2026-03-22 18:53:00 +00:00
AN Long
c30fae4bea
gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) 2026-03-22 13:29:34 +02:00
Mark Shannon
879c85f6e4
GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER (GH-146120)
* Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit more like FOR_ITER
2026-03-21 10:48:13 +00:00
Victor Stinner
b36b87bcbb
gh-145980: Fix copy/paste mistake in binascii.c (#146230) 2026-03-20 18:12:10 +00:00
Victor Stinner
6450b1d142
gh-146092: Raise MemoryError on allocation failure in _zoneinfo (#146165) 2026-03-20 17:17:22 +01:00
AN Long
9f9faa2d1a
gh-146205: Check the errno with != 0 in close impls in select module (#146206)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-20 14:44:01 +01:00
Serhiy Storchaka
4507d496b4
gh-145980: Add support for alternative alphabets in the binascii module (GH-145981)
* Add the alphabet parameter in functions b2a_base64(), a2b_base64(),
  b2a_base85(), and a2b_base85().
* And a number of "*_ALPHABET" constants.
* Remove b2a_z85() and a2b_z85().
2026-03-20 13:07:00 +02:00
Serhiy Storchaka
ab47892c32
Improve tests for the PyUnicodeWriter C API (GH-146157)
Add tests for corner cases: NULL pointers and out of range values.
2026-03-19 19:15:30 +02:00
Sacul
0d37e423d5
gh-145866: Convert SET_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-145979) 2026-03-19 19:17:58 +08:00
Okiemute Enato
89a154a0c0
gh-146091: Fix NULL check in termios.tcsetwinsize (#146147) 2026-03-19 16:20:18 +05:30
Serhiy Storchaka
0f2246b155
gh-146056: Fix list.__repr__() for lists containing NULLs (GH-146129)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-19 09:59:48 +02:00
Victor Stinner
b9d43188e9
gh-145410: Add _sysconfig.get_platform() function (#146145)
On Windows, sysconfig.get_platform() now gets the platform from the
_sysconfig module instead of parsing sys.version string.
2026-03-19 00:28:21 +01:00
Victor Stinner
724c7c8146
gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (#146113)
The function can fail on a memory allocation failure.

Bug reported by devdanzin.
2026-03-18 18:20:35 +01:00
Victor Stinner
1e4ed93210
gh-146092: Fix error handling in _BINARY_OP_ADD_UNICODE opcode (#146117)
Fix also error handling in _BINARY_OP_ADD_FLOAT,
_BINARY_OP_SUBTRACT_FLOAT and _BINARY_OP_MULTIPLY_FLOAT opcodes.
PyStackRef_FromPyObjectSteal() must not be called with a NULL
pointer.
2026-03-18 17:23:05 +01:00
Stan Ulbrych
3b06d68d8a
gh-146076: Fix crash when a ZoneInfo subclass is missing a _weak_cache (#146082) 2026-03-18 18:28:08 +05:30
bkap123
64862112b7
gh-146075: Prevent crash in functools.partial() from malformed str subclass (GH-146078)
In `partial_vectorcall`, an error returned by `PyDict_Contains` was
considered to be a truthy value. Now, the error is handled
appropriately.
2026-03-18 13:46:01 +01:00
Stan Ulbrych
dfde59f0e1
Fix entry in fuzz_pycompile.dict (GH-146069) 2026-03-18 13:43:55 +01:00
Ramin Farajpour Cami
dc24b8a6d4
gh-145966: Fix _csv DIALECT_GETATTR macro silently masking non-AttributeError exceptions (GH-145974)
The DIALECT_GETATTR macro in dialect_new() unconditionally called
PyErr_Clear() when PyObject_GetAttrString() failed, which suppressed
all exceptions including MemoryError, KeyboardInterrupt, and
RuntimeError. Now only AttributeError is cleared; other exceptions
propagate via the existing error handling path.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-17 16:08:53 +01:00
Serhiy Storchaka
99e2c5eccd
gh-144545: Improve handling of default values in Argument Clinic (GH-146016)
* Add the c_init_default attribute which is used to initialize the C variable
  if the default is not explicitly provided.
* Add the c_default_init() method which is used to derive c_default from
  default if c_default is not explicitly provided.
* Explicit c_default and py_default are now almost always have precedence
  over the generated value.
* Add support for bytes literals as default values.
* Improve support for str literals as default values (support non-ASCII
  and non-printable characters and special characters like backslash or quotes).
* Fix support for str and bytes literals containing trigraphs, "/*" and "*/".
* Improve support for default values in converters "char" and "int(accept={str})".
* Converter "int(accept={str})" now requires 1-character string instead of
  integer as default value.
* Add support for non-None default values in converter "Py_buffer": NULL,
  str and bytes literals.
* Improve error handling for invalid default values.
* Rename Null to NullType for consistency.
2026-03-17 12:16:35 +02:00
Ken Jin
3d0824aef2
gh-127958: Trace from RESUME in the JIT (GH-145905) 2026-03-17 00:18:59 +08:00
Hai Zhu
81ef1b7317
gh-144888: Replace bloom filter linked lists with continuous arrays to optimize executor invalidating performance (GH-145873) 2026-03-16 15:58:18 +00:00
Ramin Farajpour Cami
e6b9a14069
gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (#144992)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-16 12:30:13 +00:00
Sacul
37121ef77e
gh-145866: Convert CALL_INTRINSIC_1 to leave its inputs on the stack to be cleaned up by _POP_TOP. (GH-145964) 2026-03-16 11:58:12 +00:00
Pieter Eendebak
3a24856447
gh-123471: make concurrent iteration over itertools.accumulate thread-safe (#144486) 2026-03-16 08:53:37 +00:00
AN Long
6f8867a676
gh-129849: Add tests for Py_tp_bases (#143208) 2026-03-16 13:59:55 +05:30
Stan Ulbrych
40095d526b
Expand fuzz_pycompile.dict for new syntax 2026-03-15 18:54:20 -05:00
Stan Ulbrych
eb0e8be3a7
gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) (#145987)
Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-15 22:46:06 +01:00
Stan Ulbrych
31c41a61f1
Fix fuzz_builtin_int fuzzer reproducibility (#145890) 2026-03-14 11:11:29 -07:00
Sacul
798070d8ca
gh-134584: Eliminate redundant refcounting in JIT for MATCH_CLASS (GH-144821) 2026-03-14 12:00:18 +00:00
Victor Stinner
3c38feb2a2
gh-129813: Document that PyBytesWriter_GetData() cannot fail (#145900)
Document that PyBytesWriter_GetData() and PyBytesWriter_GetSize()
getter functions cannot fail
2026-03-13 19:44:51 +01:00
Serhiy Storchaka
962fb872eb
gh-145850: Change some implementation details in struct.Struct (GH-145851)
* calling it with non-ASCII string format will now raise a ValueError
  instead of UnicodeEncodeError
* calling it with non-ASCII bytes format will now raise a ValueError
  instead of struct.error
* getting the format attribute of uninitialized object will now raise
  an AttributeError instead of RuntimeError.
2026-03-13 13:05:41 +02:00
Stan Ulbrych
e1c224624a
gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (#145784) 2026-03-13 11:05:20 +00:00
bkap123
17eb0354ff
gh-145446: Add critical section in functools module for PyDict_Next (GH-145487) 2026-03-12 14:46:37 +01:00
Mark Shannon
453562a467
GH-145692: Convert DEOPT_IFs to EXIT_IFs (GH-145751)
* Convert DEOPT_IFs to EXIT_IFs for guards. Keep DEOPT_IF for intentional drops to the interpreter.

* Modify BINARY_OP_SUBSCR_LIST_INT and STORE_SUBSCR_LIST_INT to handle negative indices, to keep EXIT_IFs and DEOPT_IFs in different uops
2026-03-12 10:57:59 +00:00
Serhiy Storchaka
72456309e9
gh-143715: Deprecate incomplete initialization of struct.Struct() (GH-145580)
* Struct.__new__() will require a mandatory argument (format)
* Calls of __init__() method with a different format argument on initialized
  Struct are deprecated

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-12 09:44:11 +02:00
Hai Zhu
f062014d38
gh-144540: Add _MAKE_HEAP_SAFE uop to eliminate unnecessary refcount operations in RETURN_VALUE and YIELD_VALUE (GH-144414) 2026-03-11 20:24:19 +00:00
Stan Ulbrych
4d0dce0c8d
Fix integer overflow for formats "s" and "p" in the struct module (GH-145750) 2026-03-10 18:57:34 +02:00
Serhiy Storchaka
3f33bf83e8
gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744)
Only set the format attribute after successful (re-)initialization.
2026-03-10 18:29:23 +02:00
Alexander Shadchin
2756d56eef
gh-85277: Fix building without stropts.h or empty stropts.h (#143521) 2026-03-10 17:02:57 +01:00
Steve Dower
ae0d2875bc
gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL (GH-145159) 2026-03-10 14:58:32 +01:00
Matt Van Horn
2d35f9bc1c
gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659)
Co-Authored-By: Thomas Kowalski <thom.kowa@gmail.com>
2026-03-10 14:20:42 +01:00
Sergey Miryanov
478a315b7a
GH-145247: Implement _PyTuple_FromPair() (#145325)
Implement _PyTuple_FromPair() and _PyTuple_FromPairSteal().

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-10 11:44:20 +01:00
Stan Ulbrych
099943b122
Vary compiler flags in fuzz_pycompile (#145236)
* Vary compiler flags in fuzz_pycompile

* Drop `PyCF_SOURCE_IS_UTF8`
2026-03-09 22:51:00 +00:00
Filipe Laíns
64d6c75dd0
GH-145273: don't skip missing platstdlib warning if stdlib_zip is found (#145544) 2026-03-09 19:37:33 +00:00
Victor Stinner
39aa415296
gh-145376: Fix _cursesmodule.c build on FreeBSD/macOS (#145669) 2026-03-09 14:53:52 +01:00