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
Bénédikt Tran
613240bf03
gh-111178: fix UBSan failures in Objects/bytearrayobject.c
(GH-128236)
...
* fix UBSan failures for `bytesiterobject`
* fix UBSan failures for `PyByteArrayObject`
2025-01-10 11:50:02 +01:00
Bénédikt Tran
295776c7f3
gh-111178: fix UBSan failures in Objects/bytesobject.c
(GH-128237)
...
* remove redundant casts for `bytesobject`
* fix UBSan failures for `striterobject`
2025-01-10 11:48:06 +01:00
Bénédikt Tran
6cf31750e0
gh-111178: fix UBSan failures in Objects/complexobject.c
(GH-128241)
...
fix UBSan failures for `PyComplexObject`
2025-01-10 10:46:36 +00:00
Bénédikt Tran
2fcdc8488c
gh-126862: Use Py_ssize_t
instead of int
when processing the number of super-classes ( #127523 )
2025-01-10 03:32:53 +00:00
Bénédikt Tran
845d924efb
gh-111178: fix UBSan failures in Objects/capsule.c
(GH-128239)
...
fix UBSan failures for `PyCapsule`
2025-01-08 14:55:04 +01:00
Bénédikt Tran
1ef6bf4e29
gh-111178: fix UBSan failures in Objects/descrobject.c
(GH-128245)
...
fix UBSan failures for `propertyobject`
2025-01-06 12:50:01 +01:00
Donghee Na
ae23a012e6
gh-128137: Update PyASCIIObject to handle interned field with the atomic operation (gh-128196)
2025-01-05 18:17:06 +09:00
Alexander Shadchin
46cb6340d7
gh-127903: Fix a crash on debug builds when calling Objects/unicodeobject::_copy_characters
` ( #127876 )
2025-01-03 18:47:58 +00:00
Bénédikt Tran
5643032053
gh-111178: fix UBSan failures in Objects/tupleobject.c
(GH-128251)
...
fix UBSan failures for `_PyTupleIterObject`
2025-01-03 15:35:05 +01:00
Bénédikt Tran
aad5ba4b6a
gh-111178: fix UBSan failures in Objects/enumobject.c
(GH-128246)
...
* fix UBSan failures for `enumobject`
* fix UBSan failures for `reversedobject`
2025-01-03 15:29:41 +01:00
Bénédikt Tran
fa985bee61
gh-127787: refactor helpers for PyUnicodeErrorObject
internal interface (GH-127789)
...
- Unify `get_unicode` and `get_string` in a single function.
- Allow to retrieve the underlying `object` attribute, its
size, and the adjusted 'start' and 'end', all at once.
Add a new `_PyUnicodeError_GetParams` internal function for this.
(In `exceptions.c`, it's somewhat common to not need all the attributes,
but the compiler has opportunity to inline the function and optimize
unneeded work away. Outside that file, we'll usually need all or
most of them at once.)
- Use a common implementation for the following functions:
- `PyUnicode{Decode,Encode}Error_GetEncoding`
- `PyUnicode{Decode,Encode,Translate}Error_GetObject`
- `PyUnicode{Decode,Encode,Translate}Error_{Get,Set}Reason`
- `PyUnicode{Decode,Encode,Translate}Error_{Get,Set}{Start,End}`
2025-01-03 13:37:02 +01:00
Abhijeet
0706bab1c0
gh-128133: use relaxed atomics for hash of bytes ( #128412 )
2025-01-03 13:50:56 +05:30
Sam Gross
8eebe4e6d0
gh-128212: Fix race in _PyUnicode_CheckConsistency
(GH-128367)
...
There was a data race on the utf8 field between `PyUnicode_SET_UTF8` and
`_PyUnicode_CheckConsistency`. Use the `_PyUnicode_UTF8()` accessor,
which uses an atomic load internally, to avoid the data race.
2025-01-02 14:02:54 -05:00
Bogdan Romanyuk
47d2cb8eb7
gh-128100: Use atomic dictionary load in _PyObject_GenericGetAttrWithDict
(GH-128297)
2024-12-30 20:38:49 +00:00
Pieter Eendebak
3bd7730bbd
gh-126868: Add freelist for compact ints to _PyLong_New
( #128181 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-26 15:17:22 +00:00