summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* Doc: C API: Demote sections to subsections for consistency (#126535)Richard Hansen2024-11-071-7/+7
| | | | The entire file should be a single section; the headings below the first heading should be subsections.
* Doc: C API: Delete claim that `PyObject_Init` is GC-aware (#126418)Richard Hansen2024-11-051-4/+2
|
* gh-120026: soft deprecate Py_HUGE_VAL macro (#120027)Sergey B Kirpichev2024-11-011-1/+1
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-125674: Doc: Fix type of `newfunc` first parameter (GH-125675)Richard Hansen2024-10-301-2/+2
| | | | | | | | | * gh-125674: Doc: Fix type of `newfunc` first parameter * fixup! gh-125674: Doc: Fix type of `newfunc` first parameter --------- Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-121654: Add PyType_Freeze() function (#122457)Victor Stinner2024-10-251-0/+14
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (#125737)Richard Hansen2024-10-211-11/+13
| | | | | | | | | | | | It looks like commit 43cf44ddcce6b225f959ea2a53e4817244ca6054 (gh-31501) accidentally moved the paragraph to the `tp_finalize` section when the intent was to move it to the `tp_dealloc` section (according to the commit message). Also: * Convert the paragraph to a warning. * Apply the appropriate font style to `tp_dealloc`. * Unlinkify the first mention of `tp_dealloc` since the paragraph is already in the `tp_dealloc` section.
* gh-125313: Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation ↵Y52024-10-211-4/+7
| | | | | | | notes (#125317) Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes. Signed-off-by: y5c4l3 <y5c4l3@proton.me>
* Doc: Fix typos (#125728)ember912024-10-213-3/+3
|
* gh-124872: Replace enter/exit events with "switched" (#125532)Kirill Podoprigora2024-10-161-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Users want to know when the current context switches to a different context object. Right now this happens when and only when a context is entered or exited, so the enter and exit events are synonymous with "switched". However, if the changes proposed for gh-99633 are implemented, the current context will also switch for reasons other than context enter or exit. Since users actually care about context switches and not enter or exit, replace the enter and exit events with a single switched event. The former exit event was emitted just before exiting the context. The new switched event is emitted after the context is exited to match the semantics users expect of an event with a past-tense name. If users need the ability to clean up before the switch takes effect, another event type can be added in the future. It is not added here because YAGNI. I skipped 0 in the enum as a matter of practice. Skipping 0 makes it easier to troubleshoot when code forgets to set zeroed memory, and it aligns with best practices for other tools (e.g., https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum). Co-authored-by: Richard Hansen <rhansen@rhansen.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* Python 3.14.0a1v3.14.0a1Hugo van Kemenade2024-10-153-5/+5
|
* gh-125512: Revert "gh-124872: Replace enter/exit events with "switched" ↵Kirill Podoprigora2024-10-151-4/+10
| | | | (#124776)" (#125513)
* gh-125517: Fix unreachable code warnings in `_testembed.c` (#125518)sobolevn2024-10-151-6/+10
|
* gh-125234: Make PyInitConfig_Free(NULL) a no-op (#125266)RUANG (Roy James)2024-10-151-0/+2
|
* gh-124872: Replace enter/exit events with "switched" (#124776)Richard Hansen2024-10-141-10/+4
| | | | | | | | | | | | | | | | | | | | | | Users want to know when the current context switches to a different context object. Right now this happens when and only when a context is entered or exited, so the enter and exit events are synonymous with "switched". However, if the changes proposed for gh-99633 are implemented, the current context will also switch for reasons other than context enter or exit. Since users actually care about context switches and not enter or exit, replace the enter and exit events with a single switched event. The former exit event was emitted just before exiting the context. The new switched event is emitted after the context is exited to match the semantics users expect of an event with a past-tense name. If users need the ability to clean up before the switch takes effect, another event type can be added in the future. It is not added here because YAGNI. I skipped 0 in the enum as a matter of practice. Skipping 0 makes it easier to troubleshoot when code forgets to set zeroed memory, and it aligns with best practices for other tools (e.g., https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).
* gh-101291: Add versionadded directives for PyUnstable_Long_* (#125384)Sergey B Kirpichev2024-10-131-0/+5
|
* gh-124872: Change PyContext_WatchCallback to take PyObject (#124737)Richard Hansen2024-10-121-1/+1
| | | | | The PyContext struct is not intended to be public, and users of the API don't need anything more specific than PyObject. Also see gh-78943.
* gh-124872: Refine contextvars documentation (#124773)Richard Hansen2024-10-091-7/+13
| | | | | | | | | | | | | * Add definitions for "context", "current context", and "context management protocol". * Update related definitions to be consistent with the new definitions. * Restructure the documentation for the `contextvars.Context` class to prepare for adding context manager support, and for consistency with the definitions. * Use `testcode` and `testoutput` to test the `Context.run` example. * Expand the documentation for the `Py_CONTEXT_EVENT_ENTER` and `Py_CONTEXT_EVENT_EXIT` events to clarify and to prepare for planned changes.
* gh-125196: PyUnicodeWriter_Discard(NULL) does nothing (#125222)Victor Stinner2024-10-091-0/+2
|
* gh-101100: Consolidate documentation on `ModuleType` attributes (#124709)Alex Waygood2024-10-092-23/+25
| | | | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Barry Warsaw <barry@python.org> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-34206: Improve docs and test coverage for pre-init functions (#8023)Alyssa Coghlan2024-10-083-69/+146
| | | | | | | | | | | | | | | | | | | | - move the Py_Main documentation from the very high level API section to the initialization and finalization section - make it clear that it encapsulates a full Py_Initialize/Finalize cycle of its own - point out that exactly which settings will be read and applied correctly when Py_Main is called after a separate runtime initialization call is version dependent - be explicit that Py_IsInitialized can be called prior to initialization - actually test that Py_IsInitialized can be called prior to initialization - flush stdout in the embedding tests that run code so it appears in the expected order when running with "-vv" - make "-vv" on the subinterpreter embedding tests less spammy --------- Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-70870: Clarify dual usage of 'free variable' (#122545)Alyssa Coghlan2024-10-081-3/+6
| | | | | | | | | | | | | | The term "free variable" has unfortunately become genuinely ambiguous over the years (presumably due to the names of some relevant code object instance attributes). While we can't eliminate that ambiguity at this late date, we can at least alert people to the potential ambiguity by describing both the formal meaning of the term and the common alternative use as a direct synonym for "closure variable". --------- Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-124502: Add PyUnicode_Equal() function (#124504)Victor Stinner2024-10-071-0/+25
|
* gh-124182: Explain naming rules for struct sequence types (#124335)ffelixg2024-10-071-1/+2
|
* gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` ↵Donghee Na2024-10-031-1/+1
| | | | (gh-124920)
* gh-87135: Hang non-main threads that attempt to acquire the GIL during ↵Jeremy Maitin-Shepard2024-10-021-16/+60
| | | | | | | finalization (GH-105805) Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option. Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-107954: Fix configuration type for the perf profiler (#124636)Pablo Galindo Salgado2024-09-271-8/+13
|
* gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386)Petr Viktorin2024-09-271-1/+10
|
* doc: PyUnicode_AsUTF8String() fails if string contains surrogates (#124605)Victor Stinner2024-09-271-3/+10
|
* GH-95079: document error behaviour for some unicode C APIs (#95080)Max Bachmann2024-09-271-0/+9
|
* gh-121277: Allow `.. versionadded:: next` in docs (GH-121278)Petr Viktorin2024-09-252-2/+2
| | | | | | | | | | Make `versionchanged:: next`` expand to current (unreleased) version. When a new CPython release is cut, the release manager will replace all such occurences of "next" with the just-released version. (See the issue for release-tools and devguide PRs.) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-101100: Add a table of class attributes to the "Custom classes" section ↵Alex Waygood2024-09-254-22/+24
| | | | of the data model docs (#124480)
* gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)Jason Fried2024-09-241-0/+46
| | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* GH-109975: Copyedit 3.13 What's New: C API (#124313)Adam Turner2024-09-232-5/+7
|
* gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134)Petr Viktorin2024-09-184-3/+38
|
* gh-119771: Set errno on overflows in _Py_c_pow() (#120256)Sergey B Kirpichev2024-09-181-0/+2
| | | | Before we did this in complex_pow() and behavior of the public C API function _Py_c_pow() was different from the pure-python pow().
* gh-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot ↵neonene2024-09-181-1/+67
| | | | (GH-124163)
* Use pep role instead of url (#121611)Rafael Fontenelle2024-09-172-4/+4
|
* gh-100554: Fix formatting of type.rst modifications (#124066)Oleg Iarygin2024-09-131-6/+5
|
* gh-100554: Add ``Py_tp_vectorcall`` slot to set ↵Wenzel Jakob2024-09-132-10/+42
| | | | ``PyTypeObject.tp_vectorcall`` using the ``PyType_FromSpec`` function family. (#123332)
* gh-119802: Update memory management docs for free-threaded build (gh-124006)Donghee Na2024-09-131-12/+22
| | | | | | | | | | | | | | | | | | | * gh-119802: Update memory management docs for free-threaded build * nit * nit * Address code review * nit * Update Doc/c-api/memory.rst Co-authored-by: Sam Gross <colesbury@gmail.com> --------- Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-123909: PyType_From*: Disallow metaclasses with custom tp_new (GH-123947)Petr Viktorin2024-09-131-6/+18
|
* gh-123609: Clarify usage of standalone `PyBUF_FORMAT` (GH-123778)Peter Bierma2024-09-101-4/+5
|
* gh-121645: Fix typo in PyBytes_Join() doc (#123783)Victor Stinner2024-09-061-1/+1
|
* Swap the and from in sentence in init_config.rst (#120086)Rafael Fontenelle2024-09-051-1/+1
|
* gh-123465: Allow Py_RELATIVE_OFFSET for __*offset__ members (GH-123474)Petr Viktorin2024-09-051-1/+8
|
* gh-107954, PEP 741: Add PyInitConfig_AddModule() function (#123668)Victor Stinner2024-09-041-0/+20
|
* gh-107954, PEP 741: Add PyInitConfig C API (#123502)Victor Stinner2024-09-032-11/+236
| | | Add Doc/c-api/config.rst documentation.
* gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472)Victor Stinner2024-09-021-0/+69
| | | | | | | | | | | Add PyConfig_Get(), PyConfig_GetInt(), PyConfig_Set() and PyConfig_Names() functions to get and set the current runtime Python configuration. Add visibility and "sys spec" to config and preconfig specifications. _PyConfig_AsDict() now converts PyConfig.xoptions as a dictionary. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-123517: Remove unnecessary ``:meth:`` parentheses (#123518)Wei-Hsiang (Matt) Wang2024-09-011-2/+2
|
* gh-122854: Add Py_HashBuffer() function (#122855)Victor Stinner2024-08-301-0/+19
|