gh-102304: Debug mode no longer supports Limited API 3.9 by vstinner · Pull Request #105391 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Doc/whatsnew/3.12.rst
6 changes: 6 additions & 0 deletions Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ whose size is determined when the object is allocated.
# error Py_LIMITED_API is incompatible with Py_TRACE_REFS
#endif

// gh-102304: In debug mode, the limited API implements Py_INCREF() by calling
// _Py_IncRef() which was added to Python 3.10.
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030a0000
# error "Python built in debug mode is incompatible with limited C API older than 3.10"
#endif

#ifdef Py_TRACE_REFS
/* Define pointers to support a doubly-linked list of all live heap objects. */
#define _PyObject_HEAD_EXTRA \
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_xxlimited.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import types

xxlimited = import_helper.import_module('xxlimited')
xxlimited_35 = import_helper.import_module('xxlimited_35')
try:
import xxlimited_35
except ImportError:
xxlimited_35 = None


class CommonTests:
Expand Down Expand Up @@ -70,6 +73,7 @@ def test_buffer(self):
self.assertEqual(b2[0], 1)


@unittest.skipIf(xxlimited_35 is None, 'need xxlimited_35 extension')
class TestXXLimited35(CommonTests, unittest.TestCase):
module = xxlimited_35

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Python built in debug mode can no longer build C extensions using the
:ref:`limited C API <limited-c-api>` version 3.9 and older. Build C
extensions with a release build of Python (recommended), or with Python 3.12
and older. Patch by Victor Stinner.
2 changes: 1 addition & 1 deletion configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion configure.ac