Bénédikt Tran
12e1d3011b
gh-111178: fix UBSan failures in Objects/floatobject.c (GH-129776)
...
fix UBSan failures for `PyFloatObject`
2025-02-08 14:47:19 +01:00
Sam Gross
34379d0a59
gh-117657: Fix data race in dict_dict_merge (gh-129755)
...
Found while running `test_load_attr_module` from `test_opcache` under TSan.
2025-02-07 09:44:24 -05:00
Bogdan Romanyuk
365cf5fc23
gh-117657: Fix data race in new_reference for free threaded build (gh-129665)
2025-02-06 15:35:37 -05:00
Sam Gross
51b4edb1a4
gh-129668: Fix thread-safety of MemoryError freelist in free threaded build (gh-129704)
...
The MemoryError freelist was not thread-safe in the free threaded build.
Use a mutex to protect accesses to the freelist. Unlike other freelists,
the MemoryError freelist is not performance sensitive.
2025-02-06 12:38:12 -05:00
Xuanteng Huang
55f17b77c3
gh-128714: Fix function object races in __annotate__, __annotations__ and __type_params__ in free-threading build ( #129016 )
2025-02-06 20:10:50 +05:30
sobolevn
63f0406d5a
gh-129643: Fix PyList_Insert in free-threading builds ( #129680 )
2025-02-06 15:54:40 +03:00
Cody Maloney
5fb019fc29
gh-129559: Add bytearray.resize() (GH-129560)
...
Add bytearray.resize() which wraps PyByteArray_Resize.
Make negative size passed to resize exception/error rather than crash in optimized builds.
2025-02-05 11:33:17 -08:00
Victor Stinner
a25042e6d2
gh-129354: Use PyErr_FormatUnraisable() function ( #129523 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
Update tests:
* test_coroutines
* test_exceptions
* test_generators
* test_struct
2025-02-05 10:31:59 +00:00
Kumar Aditya
fb5d1c9236
gh-129643: fix thread safety of PyList_SetItem ( #129644 )
2025-02-05 13:08:02 +05:30
Yan Yanchii
e6c76b947b
GH-128872: Remove unused argument from _PyCode_Quicken (GH-128873)
...
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-02-02 15:09:30 -08:00
Victor Stinner
0373926260
gh-129354: Use PyErr_FormatUnraisable() function ( #129511 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 13:16:08 +01:00
Victor Stinner
95504f429e
gh-129354: Fix grammar in PyErr_FormatUnraisable() ( #129475 )
...
Replace "on verb+ing" with "while verb+ing".
2025-01-31 09:45:35 +01:00
Victor Stinner
4e47e05045
gh-129354: Use PyErr_FormatUnraisable() function ( #129435 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-30 16:09:38 +01:00
Victor Stinner
a810cb89f1
gh-89188: Implement PyUnicode_KIND() as a function ( #129412 )
...
Implement PyUnicode_KIND() and PyUnicode_DATA() as function, in
addition to the macros with the same names. The macros rely on C bit
fields which have compiler-specific layout.
2025-01-30 11:27:27 +00:00
Victor Stinner
3bebe46d34
gh-128911: Add PyImport_ImportModuleAttr() function ( #128912 )
...
Add PyImport_ImportModuleAttr() and
PyImport_ImportModuleAttrString() functions.
* Add unit tests.
* Replace _PyImport_GetModuleAttr()
with PyImport_ImportModuleAttr().
* Replace _PyImport_GetModuleAttrString()
with PyImport_ImportModuleAttrString().
* Remove "pycore_import.h" includes, no longer needed.
2025-01-30 11:17:29 +00:00
Pieter Eendebak
a29221675e
gh-127119: Faster check for small ints in long_dealloc (GH-127620)
2025-01-29 15:22:18 +00:00
Pieter Eendebak
1a80214f11
gh-126703: Add freelists for list and tuple iterators (GH-128592)
2025-01-29 09:15:24 +00:00
Brandt Bucher
828b27680f
GH-126599: Remove the PyOptimizer API (GH-129194)
2025-01-28 16:10:51 -08:00
Pieter Eendebak
64c417dee5
gh-112075: Remove critical section in dict.get (gh-129336)
...
The `dict.get` implementation uses `_Py_dict_lookup_threadsafe`, which is
thread-safe, so we remove the critical section from the argument clinic.
Add a test for concurrent dict get and set operations.
2025-01-28 21:55:45 +00:00
Sam Gross
d23f5701ad
gh-128844: Make _Py_TryIncref public as an unstable API. ( #128926 )
...
This exposes `_Py_TryIncref` as `PyUnstable_TryIncref()` and the helper
function `_PyObject_SetMaybeWeakref` as `PyUnstable_EnableTryIncRef`.
These are helpers for dealing with unowned references in a safe way,
particularly in the free threading build.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-28 19:32:27 +00:00
Peter Bierma
3fb5f6eb9b
gh-128509: Add PyUnstable_IsImmortal for finding immortal objects (GH-129182)
...
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-27 14:36:33 +01:00
Victor Stinner
7ec17429d4
gh-102471: Change PyLongWriter_Discard(NULL) to do nothing ( #129339 )
...
It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.
2025-01-27 10:51:16 +00:00
Kumar Aditya
3f2cfd0462
gh-128421: make exception group methods thread safe ( #129298 )
2025-01-25 23:50:09 +05:30
Sergey B Kirpichev
233fd00f0a
gh-128863: Deprecate _PyLong_FromDigits() function ( #127939 )
2025-01-24 13:17:10 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
ab353b31bb
gh-129149: Add fast path in PYLONG_FROM_UINT macro for compact integers ( #129168 )
...
Add fast path in PyLong_From*() functions for compact integers.
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-23 14:36:52 +00:00
Sergey B Kirpichev
5c9a63f62c
gh-128863: Deprecate _PyLong_New() function ( #129212 )
2025-01-23 13:50:34 +01:00
Sam Gross
a10f99375e
Revert "GH-128914: Remove conditional stack effects from bytecodes.c and the code generators (GH-128918)" (GH-129202)
...
The commit introduced a ~2.5-3% regression in the free threading build.
This reverts commit ab61d3f430 .
2025-01-23 09:26:25 +00:00
Victor Stinner
1d485db953
gh-128863: Deprecate _PyLong_Sign() function ( #129176 )
...
Replace _PyLong_Sign() with PyLong_GetSign().
2025-01-23 03:11:53 +01:00
Yury Selivanov
188598851d
GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling ( #124640 )
...
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-01-22 17:25:29 +01:00
Mikhail Efimov
8e20e42cc6
gh-125723: Fix crash with f_locals when generator frame outlive their generator ( #126956 )
...
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-01-22 15:50:01 +03:00
Victor Stinner
9012fa741d
gh-128863: Deprecate private C API functions ( #128864 )
...
Deprecate private C API functions:
* _PyBytes_Join()
* _PyDict_GetItemStringWithError()
* _PyDict_Pop()
* _PyThreadState_UncheckedGet()
* _PyUnicode_AsString()
* _Py_HashPointer()
* _Py_fopen_obj()
Replace _Py_HashPointer() with Py_HashPointer().
Remove references to deprecated functions.
2025-01-22 11:04:19 +00:00
Mark Shannon
470a0a68eb
GH-128682: Change a couple of functions to only steal references on success. (GH-129132)
...
Change PyTuple_FromStackRefSteal and PyList_FromStackRefSteal to only steal on success to avoid escaping
2025-01-22 10:51:37 +00:00
Bénédikt Tran
36f341ca3e
gh-127787: allow retrieving the clipped slice length in _PyUnicodeError_GetParams (GH-128980)
2025-01-21 11:45:53 +01:00
Mark Shannon
f5b6356a11
GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)
...
Add new frame owner type for interpreter entry frames
2025-01-21 10:15:02 +00:00
Mark Shannon
7239da7559
GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)
2025-01-21 09:33:23 +00:00
Mark Shannon
ab61d3f430
GH-128914: Remove conditional stack effects from bytecodes.c and the code generators (GH-128918)
2025-01-20 17:09:23 +00:00
Erlend E. Aasland
da0f47ceab
gh-111178: Regen clinic and fix exceptions.c post gh-128447 ( #129060 )
2025-01-20 12:46:30 +00:00
Erlend E. Aasland
537296cdcd
gh-111178: Generate correct signature for most self converters ( #128447 )
2025-01-20 12:40:18 +01:00
Peter Bierma
4d0a6595a0
gh-128360: Add _Py_AssertHoldsTstate as assertion for holding a thread state ( #128361 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:04:35 +05:30
Sam Gross
d66c08aa75
gh-128923: Use zero to indicate unassigned unique id ( #128925 )
...
In the free threading build, the per thread reference counting uses a
unique id for some objects to index into the local reference count
table. Use 0 instead of -1 to indicate that the id is not assigned. This
avoids bugs where zero-initialized heap type objects look like they have
a unique id assigned.
2025-01-17 16:42:27 +01:00
Xuanteng Huang
b44ff6d0df
GH-126599: Remove the "counter" optimizer/executor (GH-126853)
2025-01-16 15:57:04 -08:00
Umar Butler
8d8b854824
gh-128016: Improved invalid escape sequence warning message ( #128020 )
2025-01-15 18:00:54 +01:00
mpage
b5ee0258bf
gh-115999: Specialize LOAD_ATTR for instance and class receivers in free-threaded builds ( #128164 )
...
Finish specialization for LOAD_ATTR in the free-threaded build by adding support for class and instance receivers.
2025-01-14 11:56:11 -08:00
Bénédikt Tran
402b91da87
gh-128078: Use PyErr_SetRaisedException in _PyGen_SetStopIterationValue ( #128287 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 21:24:13 +05:30
Kumar Aditya
75214f87f1
gh-128421: make getters and setters of BaseException thread safe ( #128728 )
2025-01-13 20:08:33 +05:30
Bénédikt Tran
4533036e50
gh-111178: fix UBSan failures in Objects/codeobject.c (GH-128240)
2025-01-13 14:25:04 +01:00
Petr Viktorin
aa6579cb60
gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924)
2025-01-13 14:10:41 +01:00
Bénédikt Tran
76ffaef729
gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue ( #128780 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 18:25:09 +05:30
sobolevn
6e1e780540
gh-128759: fix data race in type_modified_unlocked ( #128764 )
2025-01-13 07:40:52 +00:00
Pieter Eendebak
ff39e3ff7b
gh-126703: Add freelist for PyMethodObject ( #128594 )
2025-01-12 18:31:49 +05:30