summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* gh-119344: Make critical section API public (#119353)Sam Gross2024-06-211-0/+104
| | | | | | | | | | This makes the following macros public as part of the non-limited C-API for locking a single object or two objects at once. * `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()` * `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()` The supporting functions and structs used by the macros are also exposed for cases where C macros are not available.
* gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() ↵Eric Snow2024-06-211-3/+10
| | | | (gh-120839)
* gh-119182: Add PyUnicodeWriter_DecodeUTF8Stateful() (#120639)Victor Stinner2024-06-211-3/+32
| | | | | | Add PyUnicodeWriter_WriteWideChar() and PyUnicodeWriter_DecodeUTF8Stateful() functions. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-117511: Make PyMutex public in the non-limited API (#117731)Sam Gross2024-06-201-0/+43
|
* GH-119462: Enforce invariants of type versioning (GH-120731)Mark Shannon2024-06-191-2/+2
| | | | * Remove uses of Py_TPFLAGS_VALID_VERSION_TAG
* gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807)Sam Gross2024-06-181-0/+16
| | | | | | | | | | | | This exposes `PyUnstable_Object_ClearWeakRefsNoCallbacks` as an unstable C-API function to provide a thread-safe mechanism for clearing weakrefs without executing callbacks. Some C-API extensions need to clear weakrefs without calling callbacks, such as after running finalizers like we do in subtype_dealloc. Previously they could use `_PyWeakref_ClearRef` on each weakref, but that's not thread-safe in the free-threaded build. Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-119182: Add PyUnicodeWriter C API (#119184)Victor Stinner2024-06-171-0/+84
|
* gh-116560: Add PyLong_GetSign() public function (#116561)Sergey B Kirpichev2024-06-031-0/+13
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-119968: Improved monitoring c-api docs (#119969)Awbert2024-06-031-1/+1
|
* gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)Alyssa Coghlan2024-06-021-11/+16
| | | | | | | | | | | | | PEP 667's description of the planned changes to PyEval_GetLocals was internally inconsistent when accepted, so the docs added for gh-74929 didn't match either the current behaviour or the intended behaviour once gh-118934 is fixed. This PR updates the documentation and 3.13 What's New to match the intended behaviour (once gh-118934 is fixed). It also tidies up lingering references to `f_locals` always being a dictionary (this hasn't been true since at least when custom namespace support for class statement execution was added)
* gh-118888: Further PEP 667 docs updates (gh-119893)Alyssa Coghlan2024-06-011-2/+19
| | | | | | * Clarify impact on default behaviour of exec, eval, etc * Update documentation for changes to PyEval_GetLocals (gh-74929) Closes gh-11888
* gh-74929: PEP 667 C API documentation (gh-119379)Alyssa Coghlan2024-06-011-0/+38
| | | | | | | | * Add docs for new APIs * Add soft-deprecation notices * Add What's New porting entries * Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead * Other related cleanups found when looking for refs to the deprecated APIs
* GH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916)Savannah Ostrowski2024-05-271-0/+6
|
* gh-119467: Fix Py_buffer.format type and correct documentation typo (#119475)Aditya Borikar2024-05-271-2/+2
|
* docs: fix a few typos identified by codespell (#119516)Ned Batchelder2024-05-261-2/+2
|
* Docs: Add central references to free-threading-related options (#119017)Brett Simmers2024-05-211-2/+2
|
* gh-118692: Avoid creating unnecessary StopIteration instances for monitoring ↵Irit Katriel2024-05-211-3/+3
| | | | (#119216)
* gh-111389: Add PyHASH_MULTIPLIER constant (#119214)Victor Stinner2024-05-211-0/+6
|
* gh-74929: PEP 667 general docs update (gh-119201)Alyssa Coghlan2024-05-211-5/+6
| | | | | | | | * expand on What's New entry for PEP 667 (including porting notes) * define 'optimized scope' as a glossary term * cover comprehensions and generator expressions in locals() docs * review all mentions of "locals" in documentation (updating if needed) * review all mentions of "f_locals" in documentation (updating if needed)
* gh-112066: Fix versionadded in PyDict_SetDefaultRef docs (#118696)Lysandros Nikolaou2024-05-171-0/+1
|
* Format None, True, False and NotImplemented as literals (GH-118758)Serhiy Storchaka2024-05-081-1/+1
|
* gh-118518: Rename `PYTHONPERFJITSUPPORT` and `-X perfjit` with underscores ↵Hugo van Kemenade2024-05-071-4/+4
| | | | (#118693)
* gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL ↵Petr Viktorin2024-05-061-1/+1
| | | | (GH-118645)
* gh-111140: minor docs typos cleanup in the C example API calls. (#118612)Gregory P. Smith2024-05-051-3/+3
|
* gh-74929: Rudimentary docs for PEP 667 (#118581)Guido van Rossum2024-05-051-1/+8
| | | | | | | | | This is *not* sufficient for the final 3.13 release, but it will do for beta 1: - What's new entry - Updated changelog entry (news blurb) - Mention the proxy for f_globals in the datamodel and Python frame object docs This doesn't have any C API details (what's new refers to the PEP).
* gh-118518: Allow perf to work without frame pointers (#112254)Pablo Galindo Salgado2024-05-051-1/+4
|
* gh-111997: C-API for signalling monitoring events (#116413)Irit Katriel2024-05-042-0/+165
|
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+38
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-93502: Add new C-API functions to trace object creation and destruction ↵Pablo Galindo Salgado2024-05-021-0/+52
| | | | (#115945)
* gh-110850: Add PyTime_TimeRaw() function (#118394)Victor Stinner2024-05-011-0/+29
| | | | | | | | | | | | | | | | | Add "Raw" variant of PyTime functions: * PyTime_MonotonicRaw() * PyTime_PerfCounterRaw() * PyTime_TimeRaw() Changes: * Add documentation and tests. Tests release the GIL while calling raw clock functions. * py_get_system_clock() and py_get_monotonic_clock() now check that the GIL is hold by the caller if raise_exc is non-zero. * Reimplement "Unchecked" functions with raw clock functions. Co-authored-by: Petr Viktorin <encukou@gmail.com>
* Fix typo in Doc/c-api/exceptions.rst (GH-118371)Xie Yanbo2024-04-291-1/+1
|
* Fix typo in Doc/c-api/typeobj.rst (GH-118377)Xie Yanbo2024-04-291-1/+1
|
* gh-116935: Document that heap types need to support garbage collection ↵Savannah Ostrowski2024-04-191-1/+2
| | | | (GH-118021)
* gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc (GH-117920)Victor Stinner2024-04-191-0/+6
|
* Docs: Fix CVE link (#118077)Jelle Zijlstra2024-04-191-1/+1
|
* gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993)Victor Stinner2024-04-181-0/+130
| | | | | | | | | Restore these functions removed in Python 3.13 alpha 1: * Py_SetPythonHome() * Py_SetProgramName() * PySys_SetArgvEx() * PySys_SetArgv()
* gh-117929: Restore removed PyEval_InitThreads() function (#117931)Victor Stinner2024-04-171-1/+29
|
* gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226)Serhiy Storchaka2024-04-171-4/+5
|
* gh-117642: Fix PEP 737 implementation (GH-117643)Serhiy Storchaka2024-04-081-3/+3
| | | | | * Fix implementation of %#T and %#N (they were implemented as %T# and %N#). * Restore tests removed in gh-116417.
* gh-111140: PyLong_From/AsNativeBytes: Take *flags* rather than just ↵Steve Dower2024-04-051-45/+97
| | | | *endianness* (GH-116053)
* gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() ↵Serhiy Storchaka2024-03-251-4/+4
| | | | | (GH-117160) Create a new bytes object and destroy the old one if it has refcount > 1.
* gh-113024: C API: Add PyObject_GenericHash() function (GH-113025)Serhiy Storchaka2024-03-222-0/+15
|
* gh-115754: Add Py_GetConstant() function (#116883)Victor Stinner2024-03-211-0/+49
| | | | | | | | | | | | Add Py_GetConstant() and Py_GetConstantBorrowed() functions. In the limited C API version 3.13, getting Py_None, Py_False, Py_True, Py_Ellipsis and Py_NotImplemented singletons is now implemented as function calls at the stable ABI level to hide implementation details. Getting these constants still return borrowed references. Add _testlimitedcapi/object.c and test_capi/test_object.py to test Py_GetConstant() and Py_GetConstantBorrowed() functions.
* gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)Bogdan Romanyuk2024-03-191-1/+7
|
* gh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839)Victor Stinner2024-03-141-0/+23
|
* gh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)Victor Stinner2024-03-141-0/+7
| | | Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-111696, PEP 737: Add PyType_GetFullyQualifiedName() function (#116815)Victor Stinner2024-03-141-0/+8
| | | Rewrite tests on type names in Python, they were written in C.
* Docs: PyUnstable_Long_IsCompact() docs now mention PyLong_AsNativeBytes() ↵Sergey B Kirpichev2024-03-131-1/+1
| | | | (#116634)
* gh-111389: expose PyHASH_INF/BITS/MODULUS/IMAG macros as public (#111418)Sergey B Kirpichev2024-03-091-1/+24
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-115664: Fix ordering of more versionadded and versionchanged directives ↵Serhiy Storchaka2024-03-074-8/+8
| | | | (GH-116298)