Skip to content

Commits on Nov 27, 2022

  1. bpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)

    The docs stated that PyImport_ImportFrozenModuleObject() returns a
    new reference, but it actually returns an int.
    
    Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
    ZackerySpytz and kumaraditya303 committed Nov 27, 2022

Commits on Nov 22, 2022

  1. gh-47146: Soft-deprecate structmember.h, expose its contents via Pyth…

    …on.h (GH-99014)
    
    The ``structmember.h`` header is deprecated, though it continues to be available
    and there are no plans to remove it. There are no deprecation warnings. Old code
    can stay unchanged (unless the extra include and non-namespaced macros bother
    you greatly). Specifically, no uses in CPython are updated -- that would just be
    unnecessary churn.
    The ``structmember.h`` header is deprecated, though it continues to be
    available and there are no plans to remove it.
    
    Its contents are now available just by including ``Python.h``,
    with a ``Py`` prefix added if it was missing:
    
    - `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
    - Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
      (previously ``T_INT``, ``T_DOUBLE``, etc.)
    - The flags `Py_READONLY` (previously ``READONLY``) and
      `Py_AUDIT_READ` (previously all uppercase)
    
    Several items are not exposed from ``Python.h``:
    
    - `T_OBJECT` (use `Py_T_OBJECT_EX`)
    - `T_NONE` (previously undocumented, and pretty quirky)
    - The macro ``WRITE_RESTRICTED`` which does nothing.
    - The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
      `Py_AUDIT_READ`.
    - In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
      It should be included manually when using ``offsetof()``.
    
    The deprecated header continues to provide its original
    contents under the original names.
    Your old code can stay unchanged, unless the extra include and non-namespaced
    macros bother you greatly.
    
    There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
    similar. I chose not to do that -- users will probably copy/paste that with any
    spelling, and not renaming it makes migration docs simpler.
    
    
    Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
    Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
    3 people committed Nov 22, 2022

Commits on Oct 31, 2022

  1. gh-98410: move getbufferproc and releasebufferproc to buffer.h (#31158)

    This adds them to the Limited API.
    davidhewitt committed Oct 31, 2022

Commits on Oct 27, 2022

  1. gh-98586: Add vector call APIs to the Limited API (GH-98587)

    Expose the facilities for making vector calls through Python's limited API.
    wjakob committed Oct 27, 2022

Commits on Aug 24, 2022

  1. GH-93503: Add thread-specific APIs to set profiling and tracing funct…

    …ions in the C-API (#93504)
    
    * gh-93503: Add APIs to set profiling and tracing functions in all threads in the C-API
    
    * Use a separate API
    
    * Fix NEWS entry
    
    * Add locks around the loop
    
    * Document ignoring exceptions
    
    * Use the new APIs in the sys module
    
    * Update docs
    pablogsal committed Aug 24, 2022

Commits on May 27, 2022

  1. gh-60074: add new stable API function PyType_FromMetaclass (GH-93012)

    Added a new stable API function ``PyType_FromMetaclass``, which mirrors
    the behavior of ``PyType_FromModuleAndSpec`` except that it takes an
    additional metaclass argument. This is, e.g., useful for language
    binding tools that need to store additional information in the type
    object.
    wjakob committed May 27, 2022

Commits on May 13, 2022

  1. gh-85858: Remove PyUnicode_InternImmortal() function (#92579)

    Remove the PyUnicode_InternImmortal() function and the
    SSTATE_INTERNED_IMMORTAL macro.
    
    The PyUnicode_InternImmortal() function is still exported in the
    stable ABI. The function is removed from the API.
    
    PyASCIIObject.state.interned size is now a single bit, rather than 2
    bits.
    
    Keep SSTATE_NOT_INTERNED and SSTATE_INTERNED_MORTAL macros for
    backward compatibility, but no longer use them internally since the
    interned member is now a single bit and so can only have two values
    (interned or not interned).
    
    Update stats of _PyUnicode_ClearInterned().
    vstinner committed May 13, 2022

Commits on Apr 6, 2022

  1. bpo-47115: Document which parts of structs are in limited API/stable …

    …ABI (GH-32196)
    
    
    Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
    encukou and Erlend Egeberg Aasland committed Apr 6, 2022

Commits on Feb 2, 2022

  1. bpo-45459: Add Py_buffer to limited API (GH-29991)

    - [x] ``Py_buffer`` struct
    - [x] ``PyBuffer_*()`` API functions
    - [x] ``PyBUF_*`` constants
    - [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
    - [x] ``PyMemoryView_FromBuffer()`` API
    - [x] tests for limited API
    - [x] ``make regen-limited-abi``
    - [x] documentation update
    - [ ] export ``PyPickleBuffer*()`` API ???
    tiran committed Feb 2, 2022

Commits on Dec 10, 2021

  1. bpo-43931: Export Python version as API data (GH-25577)

    When Python is embedded in other applications, it is not easy to determine which version of Python is being used. This change exposes the Python version as part of the API data. Tools like Austin (https://github.com/P403n1x87/austin) can benefit from this data when targeting applications like uWSGI, as the Python version can then be inferred systematically by looking at the exported symbols rather than relying on unreliable pattern matching or other hacks (like remote code execution etc...).
    
    Automerge-Triggered-By: GH:pablogsal
    P403n1x87 committed Dec 10, 2021

Commits on Sep 7, 2021

  1. bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194)

    Fix PyAiter_Check to only check for the `__anext__` presense (not for
    `__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`,
    `PyObject_GetAiter()` -> `PyObject_GetAIter()`.
    
    Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
    1st1 and pablogsal committed Sep 7, 2021

Commits on Jul 29, 2021

  1. bpo-41103: Resurrect the old buffer protocol. (GH-27437)

    Revert "bpo-41103: Remove old buffer protocol support (#21117)"
    
    This reverts commit 6f8a6ee.
    methane committed Jul 29, 2021

Commits on Jun 24, 2021

  1. bpo-40939: Remove documentation for PyParser_* & add porting notes (G…

    …H-26855)
    
    I tried to be relatively thorough and give lots of links.
    One reason is that this wasn't deprecated very long; also it seems people running into this tend to not be familiar with similar APIs.
    
    Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
    encukou and Fidget-Spinner committed Jun 24, 2021

Commits on Jun 16, 2021

  1. bpo-44392: Add Py_GenericAlias to C API docs (GH-26724)

    Also fix stable ABI type definitions
    Fidget-Spinner committed Jun 16, 2021
  2. bpo-43795: Don't list private names in the limited API (GH-26740)

    * Remove struct _node from the stable ABI list
    
    This struct was removed along with the old parser in Python 3.9 (PEP 617)
    
    * Stable ABI list: Use the public name "PyFrameObject" rather than "_frame"
    
    * Ensure limited API doesn't contain private names
    
    Names prefixed by an underscore are private by definition.
    
    * Add a blurb
    encukou committed Jun 16, 2021

Commits on May 25, 2021

  1. bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI (G…

    …H-26241)
    
    Py_FrozenMain was added to the Limited C API in [bpo-42591]() (3.10.0a4);
    but to fix that issue it would be enough to add it to the regular C API.
    
    The function is undocumented, tests were added very recently ([bpo-44131]()),
    and most importantly, it is not present in all builds of Python, as
    the linker sometimes omits it as unused.
    It should be added back when these issues are fixed.
    
    Note that this does not affect Python's regular C API.
    encukou committed May 25, 2021

Commits on May 11, 2021

  1. bpo-43795: PEP 652 user documentation (GH-25668)

    - Reformat the C API and ABI Versioning page (and extend/clarify a bit)
    - Rewrite the stable ABI docs into a general text on C API Compatibility
    - Add a list of Limited API contents, and notes for the individual items. 
    - Replace `Include/README.rst` with a link to a devguide page with the same info
    encukou committed May 11, 2021

Commits on May 7, 2021

  1. bpo-44029: Remove Py_UNICODE APIs (GH-25881)

    Remove deprecated `Py_UNICODE` APIs: `PyUnicode_Encode`,
    `PyUnicode_EncodeUTF7`, `PyUnicode_EncodeUTF8`,
    `PyUnicode_EncodeUTF16`, `PyUnicode_EncodeUTF32`,
    `PyUnicode_EncodeLatin1`, `PyUnicode_EncodeMBCS`,
    `PyUnicode_EncodeDecimal`, `PyUnicode_EncodeRawUnicodeEscape`,
    `PyUnicode_EncodeCharmap`, `PyUnicode_EncodeUnicodeEscape`,
    `PyUnicode_TransformDecimalToASCII`, `PyUnicode_TranslateCharmap`,
    `PyUnicodeEncodeError_Create`, `PyUnicodeTranslateError_Create`.
    
    See :pep:`393` and :pep:`624` for reference.
    methane committed May 7, 2021

Commits on May 1, 2021

Commits on Apr 28, 2021

  1. bpo-28254: Add a C-API for controlling the GC state (GH-25687)

    Add new C-API functions to control the state of the garbage collector:
    PyGC_Enable(), PyGC_Disable(), PyGC_IsEnabled(),
    corresponding to the functions in the gc module.
    
    Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
    Co-authored-by: Victor Stinner <vstinner@python.org>
    3 people committed Apr 28, 2021

Commits on Apr 23, 2021

  1. bpo-43795: PEP-652: Clean up the stable ABI/limited API (GH-25482)

    - `_Py_EncodeLocaleRaw`, which is private by name, undocumented,
      and wasn't exported in `python3.dll`, is moved to a private header.
    - `_Py_HashSecret_Initialized`, again private by name, undocumented,
      and not exported in `python3.dll`, is excluded with `Py_LIMITED_API`.
    - `PyMarshal_*` and `PyMember_*One` functions, declared in private headers and
      not exported in `python3.dll`, are removed from `Doc/data/stable_abi.dat`.
    - `PyMem_Calloc` which *was* exported in `python3dll.c`, is moved to public
      headers where it joins its other `PyMem_*` friends.
    
    Only the last change is documented in the blurb; others are not user-visible.
    (Nothing uses `Doc/data/stable_abi.dat` yet.)
    
    
    https://bugs.python.org/issue43795
    encukou committed Apr 23, 2021

Commits on Apr 10, 2021

  1. bpo-43753: Add Py_Is() and Py_IsNone() functions (GH-25227)

    Add the Py_Is(x, y) function to test if the 'x' object is the 'y'
    object, the same as "x is y" in Python. Add also the Py_IsNone(),
    Py_IsTrue(), Py_IsFalse() functions to test if an object is,
    respectively, the None singleton, the True singleton or the False
    singleton.
    vstinner committed Apr 10, 2021

Commits on Apr 1, 2021

  1. bpo-43690: stable_abi.py no longer parses macros (GH-25136)

    The stable_abi.py script no longer parse macros. Macro targets can be
    static inline functions which are not part of the stable ABI, only
    part of the limited C API.
    
    Run "make regen-limited-abi" to exclude PyType_HasFeature from
    Doc/data/stable_abi.dat.
    vstinner committed Apr 1, 2021
Older