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

Change CyFunction to compile with Py_LIMITED_API #5556

Merged
merged 6 commits into from Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion Cython/Compiler/ModuleNode.py
Expand Up @@ -792,7 +792,15 @@ def generate_module_preamble(self, env, options, cimported_modules, metadata, co
code.globalstate["end"].putln("#endif /* Py_PYTHON_H */")

from .. import __version__
code.putln('#define CYTHON_ABI "%s"' % __version__.replace('.', '_'))
code.putln('#if CYTHON_LIMITED_API') # CYTHON_COMPILING_IN_LIMITED_API not yet defined
# The limited API makes some significant changes to data structures, so we don't
# want to shared implementation compiled with and without the limited API.
code.putln('#define __PYX_EXTRA_ABI_MODULE_NAME "limited"')
code.putln('#else')
code.putln('#define __PYX_EXTRA_ABI_MODULE_NAME ""')
code.putln('#endif')
code.putln('#define CYTHON_ABI "%s" __PYX_EXTRA_ABI_MODULE_NAME' %
__version__.replace('.', '_'))
code.putln('#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI')
code.putln('#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."')
code.putln('#define CYTHON_HEX_VERSION %s' % build_hex_version(__version__))
Expand Down