GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Py_TRACE_REFS is not compatible with Py_LIMITED_API · Issue #108634 · python/cpython

Py_TRACE_REFS is not compatible with Py_LIMITED_API #108634

New issue
Copy link
New issue
Copy link
Closed
Closed
Py_TRACE_REFS is not compatible with Py_LIMITED_API#108634
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@vstinner
vstinner
opened on Aug 29, 2023
Issue body actions

Bug report

Checklist

  • I am confident this is a bug in CPython, not a bug in a third-party project
  • I have searched the CPython 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 from Include/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 to not add these two members to PyObject, but store the double-linked list outside PyObject. Store it in a different structure, so PyObject stays ABI compatible.

Linked PRs

  • gh-108634: Py_TRACE_REFS uses a hash table #108663
  • gh-108634: PyInterpreterState_New() no longer calls Py_FatalError() #108748

Activity

  1. vstinner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 29, 2023
  2. erlend-aasland commented on Aug 29, 2023

    @erlend-aasland
    erlend-aasland
    on Aug 29, 2023
    Contributor
    More actions

    See also #63083 and #73104

  3. vstinner
    added 8 commits that reference this issue on Aug 30, 2023

    pythongh-108634: Use a hashtable for Py_TRACE_REFS

    f7e7106

    pythongh-108634: Use a hashtable for Py_TRACE_REFS

    9820187

    pythongh-108634: Py_TRACE_REFS uses a hash table

    b45005c

    pythongh-108634: Py_TRACE_REFS uses a hash table

    c3f537d

    pythongh-108634: Py_TRACE_REFS uses a hash table

    b382d58

    pythongh-108634: Py_TRACE_REFS uses a hash table

    a44bea2

    pythongh-108634: Py_TRACE_REFS uses a hash table

    28f41a5

    gh-108634: Py_TRACE_REFS uses a hash table (#108663)

    13a0007
  4. vstinner
    closed this as completedon Aug 31, 2023
  5. vstinner
    added 8 commits that reference this issue on Sep 1, 2023

    pythongh-108634: init_interpreter() returns Py_Status

    6e8ba06

    pythongh-108634: init_interpreter() returns Py_Status

    905c4c4

    pythongh-108634: init_interpreter() returns Py_Status

    c6a35fa

    pythongh-108634: PyInterpreterState_New() no longer calls Py_FatalErr…

    bc2bb7b

    pythongh-108634: PyInterpreterState_New() no longer calls Py_FatalErr…

    fc03c9b

    pythongh-108634: PyInterpreterState_New() no longer calls Py_FatalErr…

    d25c5da

    pythongh-108634: Add _PyInterpreterState_New() function

    04627a8

    gh-108634: PyInterpreterState_New() no longer calls Py_FatalError() (#…

    b936cf4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.