Title: Py_TRACE_REFS is not compatible with Py_LIMITED_API · Issue #108634 · python/cpython · GitHub
Open Graph Title: Py_TRACE_REFS is not compatible with Py_LIMITED_API · Issue #108634 · python/cpython
X Title: Py_TRACE_REFS is not compatible with Py_LIMITED_API · Issue #108634 · python/cpython
Description: 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 b...
Open Graph Description: 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 CP...
X Description: 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 CP...
Opengraph URL: https://github.com/python/cpython/issues/108634
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Py_TRACE_REFS is not compatible with Py_LIMITED_API","articleBody":"# Bug report\n\n### Checklist\n\n- [X] I am confident this is a bug in CPython, not a bug in a third-party project\n- [X] I have searched the [CPython issue tracker](https://github.com/python/cpython/issues?q=is%3Aissue+sort%3Acreated-desc),\nand am confident this bug has not been reported before\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\n_No response_\n\n### A clear and concise description of the bug:\n\nTrying 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:\n\n```\nIn file included from ./Include/Python.h:44,\n from ./Modules/_stat.c:16:\n./Include/object.h:62:4: error: #error Py_LIMITED_API is incompatible with Py_TRACE_REFS\n 62 | # error Py_LIMITED_API is incompatible with Py_TRACE_REFS\n | ^~~~~\nmake: *** [Makefile:3194: Modules/_stat.o] Error 1\n```\n\nThe ``#error`` comes from ``Include/object.h``:\n\n```c\n#if defined(Py_LIMITED_API) \u0026\u0026 defined(Py_TRACE_REFS)\n# error Py_LIMITED_API is incompatible with Py_TRACE_REFS\n#endif\n```\n\nThe problem is that the PyObject ABI is different: Py_TRACE_REFS adds two members to PyObject structure:\n\n```c\n PyObject *_ob_next;\n PyObject *_ob_prev;\n```\n\nOne 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.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-108663\n* gh-108748\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-08-29T13:33:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/108634/cpython/issues/108634"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe40d046-e950-4116-61dd-288121c2a3f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7DA:30AAB2:5D1F14:7E21CA:6969DBFE |
| html-safe-nonce | 0b2b72f887844d6a2b05febb74a8228df8d4570a105c6acfa238127221dc1cc5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0RBOjMwQUFCMjo1RDFGMTQ6N0UyMUNBOjY5NjlEQkZFIiwidmlzaXRvcl9pZCI6IjE2MzI5NDgzODQ0Nzg5MTE0ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3d4958afee139057c785dbb492e8d6ada844df306602546fbe74a8a4f7e53d08 |
| hovercard-subject-tag | issue:1871690101 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/108634/issue_layout |
| twitter:image | https://opengraph.githubassets.com/24cf1e9c0fe63fc3771039e55cce7617f625c009002f8d4c5e18bbe620d9b72e/python/cpython/issues/108634 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/24cf1e9c0fe63fc3771039e55cce7617f625c009002f8d4c5e18bbe620d9b72e/python/cpython/issues/108634 |
| og:image:alt | 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 CP... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width