Michael Droettboom
8614f86b71
gh-131525: Cache the result of tuple_hash ( #131529 )
...
* gh-131525: Cache the result of tuple_hash
* Fix debug builds
* Add blurb
* Fix formatting
* Pre-compute empty tuple singleton
* Mostly set the cache within tuple_alloc
* Fixes for TSAN
* Pre-compute empty tuple singleton
* Fix for 32-bit platforms
* Assert that op != NULL in _PyTuple_RESET_HASH_CACHE
* Use FT_ATOMIC_STORE_SSIZE_RELAXED macro
* Update Include/internal/pycore_tuple.h
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Fix alignment
* atomic load
* Update Objects/tupleobject.c
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
---------
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-03-27 09:57:06 -04:00
Donghee Na
7bb41aef4b
gh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen (gh-131744)
2025-03-26 09:45:29 +09:00
Hugo van Kemenade
77b2c933ca
Python 3.14.0a6
2025-03-14 17:05:02 +02:00
Victor Stinner
10cbd1fe88
gh-130947: Add again PySequence_Fast() to the limited C API ( #130948 )
...
Add again PySequence_Fast() to the limited C API.
Add unit tests.
2025-03-13 13:00:57 +01:00
Victor Stinner
4dcbe06fd2
gh-111178: Fix type of PyCMethod's "nargs" argument (GH-131135)
...
Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.
2025-03-12 11:54:02 +01:00
Victor Stinner
519c2c6740
gh-128863: Deprecate the private _PyUnicodeWriter API ( #129245 )
...
Deprecate private C API functions:
* _PyUnicodeWriter_Init()
* _PyUnicodeWriter_Finish()
* _PyUnicodeWriter_Dealloc()
* _PyUnicodeWriter_WriteChar()
* _PyUnicodeWriter_WriteStr()
* _PyUnicodeWriter_WriteSubstring()
* _PyUnicodeWriter_WriteASCIIString()
* _PyUnicodeWriter_WriteLatin1String()
These functions are not deprecated in the internal C API (if the
Py_BUILD_CORE macro is defined).
2025-02-20 14:02:02 +01:00
Pablo Galindo Salgado
51d4bf1e0e
bpo-45325: Add a new 'p' parameter to Py_BuildValue to convert an integer into a Python bool ( #28634 )
2025-02-18 17:14:11 +00:00
Hugo van Kemenade
3ae9101482
Python 3.14.0a5
2025-02-11 19:16:29 +02:00
Donghee Na
b184abf074
gh-129533: Update PyGC_Enable/Disable/IsEnabled to use atomic operation (gh-129563)
2025-02-07 07:41:13 +09:00
Victor Stinner
2ad069d906
gh-91417: Remove PySequence_Fast() from the limited C API ( #129398 )
...
The function never worked with the limited C API. It was added by
mistake.
2025-02-02 23:17:30 +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
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
Sergey B Kirpichev
233fd00f0a
gh-128863: Deprecate _PyLong_FromDigits() function ( #127939 )
2025-01-24 13:17:10 +01:00
Sergey B Kirpichev
3d8fc8b9ae
gh-127937: Convert decimal to use PEP 757 import API ( #127925 )
...
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-24 11:05:52 +00:00
Sergey B Kirpichev
5c9a63f62c
gh-128863: Deprecate _PyLong_New() function ( #129212 )
2025-01-23 13:50:34 +01: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
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
Victor Stinner
8ceb6cb117
gh-129033: Remove _PyInterpreterState_SetConfig() function ( #129048 )
...
Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
2025-01-20 16:31:33 +01:00
Victor Stinner
07c3518ffb
gh-129033: Remove _Py_InitializeMain() function ( #129034 )
...
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-01-20 10:03:22 +00:00
Xuanteng Huang
b44ff6d0df
GH-126599: Remove the "counter" optimizer/executor (GH-126853)
2025-01-16 15:57:04 -08:00
Hugo van Kemenade
f26daa9470
Python 3.14.0a4
2025-01-14 13:52:58 +02:00
Peter Bierma
bf64a582f0
gh-128400: Only show the current thread in Py_FatalError on the free-threaded build ( #128758 )
2025-01-13 20:06:54 +05:30
Petr Viktorin
1439b81928
gh-128629: Add Py_PACK_VERSION and Py_PACK_FULL_VERSION (GH-128630)
2025-01-09 11:10:28 +01:00
Victor Stinner
f89e5e20cb
gh-127350: Add Py_fopen() and Py_fclose() functions ( #127821 )
2025-01-06 12:43:09 +00:00
Sam Gross
7b811d0562
gh-128008: Add PyWeakref_IsDead() (GH-128009)
...
The `PyWeakref_IsDead()` function tests if a weak reference is dead
without any side effects. Although you can also detect if a weak
reference is dead using `PyWeakref_GetRef()`, that function returns a
strong reference that must be `Py_DECREF()`'d, which can introduce side
effects if the last reference is concurrently dropped (at least in the
free threading build).
2024-12-19 16:17:15 +01:00
Hugo van Kemenade
401bfc69d1
Python 3.14.0a3
2024-12-17 11:50:39 +02:00
Yuki Kobayashi
52d552cda7
gh-127896: Add missing documentation of PySequence_In (GH-127979)
...
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-16 14:56:04 +01:00
Bénédikt Tran
8bc18182a7
gh-127691: add type checks when using PyUnicodeError objects (GH-127694)
2024-12-13 17:16:22 +01:00
Victor Stinner
6446408d42
gh-102471, PEP 757: Add PyLong import and export API ( #121339 )
...
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-13 14:24:48 +01:00
Peter Bierma
d5d84c3f13
gh-127791: Fix, document, and test PyUnstable_AtExit ( #127793 )
2024-12-11 12:14:04 +01:00
Bénédikt Tran
8fa5ecec01
gh-123378: fix post-merge typos in comments and NEWS ( #127739 )
2024-12-08 13:47:22 +00:00
Peter Bierma
12680ec5bd
gh-127314: Don't mention the GIL when calling without a thread state on the free-threaded build ( #127315 )
...
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-06 16:58:19 +01:00
Bénédikt Tran
bc0f2e9459
gh-123378: Ensure results of PyUnicode*Error_Get{Start,End} are clamped (GH-123380)
...
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-04 14:13:52 +01:00
Giovanni Siragusa
31f16e427b
gh-109523: Raise a BlockingIOError if reading text from a non-blocking stream cannot immediately return bytes. (GH-122933)
2024-12-02 14:18:30 +01:00
Zachary Ware
2c9911abe6
Move NEWS entries out of directories with spaces (GH-127067)
...
Cleanup after GH-126063, including moving the `README.rst` files to the new directories.
2024-11-20 18:52:46 +00:00
Hugo van Kemenade
add43c3420
Python 3.14.0a2
2024-11-19 16:52:44 +02:00
George Alexopoulos
8717f792f7
gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555)
...
For dlsym(), a return value of NULL does not necessarily indicate
an error [1].
Therefore, to avoid using stale (or NULL) dlerror() values, we must:
1. clear the previous error state by calling dlerror()
2. call dlsym()
3. call dlerror()
If the return value of dlerror() is not NULL, an error occured.
In ctypes we choose to treat a NULL return value from dlsym()
as a "not found" error. This is the same as the fallback
message we use on Windows, Cygwin or when getting/formatting
the error reason fails.
[1]: https://man7.org/linux/man-pages/man3/dlsym.3.html
Signed-off-by: Georgios Alexopoulos <grgalex42@gmail.com>
Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-15 11:05:51 +01:00
Peter Bierma
d00878b06a
gh-123619: Add an unstable C API function for enabling deferred reference counting (GH-123635)
...
Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-11-13 13:27:16 +00:00
RUANG (James Roy)
8ff7efb46d
gh-126061: Add PyLong_IsPositive/Zero/Negative() functions ( #126065 )
...
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-12 14:18:06 +01:00
Sergey B Kirpichev
8477951a1c
gh-120026: soft deprecate Py_HUGE_VAL macro ( #120027 )
...
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-11-01 22:04:31 +00:00
Victor Stinner
db96327203
gh-121654: Add PyType_Freeze() function ( #122457 )
...
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-25 11:12:48 +02:00
Sam Gross
5989eb7446
gh-125608: Trigger dictionary watchers when inline values change ( #125611 )
...
Dictionary watchers on an object's attributes dictionary
(`object.__dict__`) were not triggered when the managed dictionary used
the object's inline values.
2024-10-21 08:23:38 -04:00
Hugo van Kemenade
8cdaca8b25
Python 3.14.0a1
2024-10-15 22:34:54 +03:00
Victor Stinner
a7f0727ca5
gh-124502: Add PyUnicode_Equal() function ( #124504 )
2024-10-07 21:24:53 +00:00
Bénédikt Tran
f66d785861
gh-123961: Convert curses.window static type into a heap type ( #124934 )
2024-10-04 11:58:34 +02:00
Sam Gross
5aa91c56bf
gh-124296: Remove private dictionary version tag (PEP 699) ( #124472 )
2024-10-01 12:39:56 -04:00
Victor Stinner
9d344fafc4
gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 ( #124128 )
2024-09-24 08:42:58 +02:00
Petr Viktorin
aee219f455
gh-123880: Allow recursive import of single-phase-init modules (GH-123950)
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-09-20 10:27:34 +02:00