Skip to content

Issue with PyObject_DelAttr[String] in stable ABI builds targeting older CPython versions #134989

Closed
@wjakob

Description

@wjakob

Bug report

Bug description:

To my knowledge, one can use newer Python version (e.g. Python 3.13) to build C extensions for older Python versions (e.g. 3.12) when targeting the stable ABI. This is accomplished by setting Py_LIMITED_API to a suitable number like 0x030b0000, which simply disables all features beyond this cutoff.

If this understanding is correct, then I would like to report a bug:

Python 3.13 added an new C API function for PyObject_DelAttr(). In contrast, Python 3.12 realized this operation using a macro wrapping PyObject_SetAttr():

#define  PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)

This change is problematic: extensions built on 3.13 targeting 3.12 stable ABI will now call a function that does not exist on Python 3.12, and such extensions will fail to load with a linker error. The change to the new C API entry point should have been guarded with #ifdefs.

This issue also affects PyObject_DelAttrString().

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy