Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-41111: Move the Py_LIMITED_API macro of xxlimited module from setup.py to xxlimited.c. #25115

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions Modules/xxlimited.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
pass
*/

/* xxlimited with the limited API. */
#ifdef WITH_Py_LIMITED_API
# define Py_LIMITED_API 0x03100000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0x03100000 is wrong: it must be 0x030a0000 (the bug exists in the current code). I fixed the issue in my PR #25131.

#endif
#include "Python.h"

// Module state
Expand Down
4 changes: 4 additions & 0 deletions Modules/xxlimited_35.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

/* Xxo objects */

/* xxlimited_35 with the limited API. */
#ifdef WITH_Py_LIMITED_API
# define Py_LIMITED_API 0x03050000
#endif
#include "Python.h"

static PyObject *ErrorObject;
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,9 +1867,9 @@ def detect_modules(self):
if 'd' not in sysconfig.get_config_var('ABIFLAGS'):
# Non-debug mode: Build xxlimited with limited API
self.add(Extension('xxlimited', ['xxlimited.c'],
define_macros=[('Py_LIMITED_API', '0x03100000')]))
define_macros=[('WITH_Py_LIMITED_API', 1)]))
self.add(Extension('xxlimited_35', ['xxlimited_35.c'],
define_macros=[('Py_LIMITED_API', '0x03050000')]))
define_macros=[('WITH_Py_LIMITED_API', 1)]))
else:
# Debug mode: Build xxlimited with the full API
# (which is compatible with the limited one)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I'm disappointed that CPython doesn't even support its own stable ABI in debug mode. So I created https://bugs.python.org/issue43688 to also support the limited C API in debug mode.

Expand Down