Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Py_TRACE_REFS is not compatible with Py_LIMITED_API #108634

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@vstinner

Description

@vstinner

Bug report

Checklist

  • I am confident this is a bug in CPython, not a bug in a third-party project
  • I have searched theCPython issue tracker,
    and am confident this bug has not been reported before

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

No response

A clear and concise description of the bug:

Trying to build a C extension targetting the limited C API (defining Py_LIMITED_API) fails if Python is configured with./configure --with-trace-refs. Example with PR#108573:

In file included from ./Include/Python.h:44,                 from ./Modules/_stat.c:16:./Include/object.h:62:4: error: #error Py_LIMITED_API is incompatible with Py_TRACE_REFS   62 | #  error Py_LIMITED_API is incompatible with Py_TRACE_REFS      |    ^~~~~make: *** [Makefile:3194: Modules/_stat.o] Error 1

The#error comes fromInclude/object.h:

#if defined(Py_LIMITED_API)&& defined(Py_TRACE_REFS)#  error Py_LIMITED_API is incompatible with Py_TRACE_REFS#endif

The problem is that the PyObject ABI is different: Py_TRACE_REFS adds two members to PyObject structure:

PyObject*_ob_next;PyObject*_ob_prev;

One solution to make Py_TRACE_REFS compatible with Py_LIMITED_API would be tonot add these two members to PyObject, but store the double-linked list outsidePyObject. Store it in a different structure, soPyObject stays ABI compatible.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp