summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2021-04-18 19:30:46 +0200
committerStefan Behnel <stefan_ml@behnel.de>2021-04-18 19:30:46 +0200
commit3048be77631d91ddf9210c34f8de436ab70d7c04 (patch)
treed1152de54d19a44418527fd8955754d830ccf74d
parentf3f7b612dc005abdac2e0a0a48dcf9be7b4b0122 (diff)
downloadcython-3048be77631d91ddf9210c34f8de436ab70d7c04.tar.gz
Hard-disable the MergeVTables() step during the extension type setup when using the Limited API. There might be a way to make it work, but it currently won't.
Also see https://github.com/cython/cython/pull/4107
-rw-r--r--Cython/Compiler/Nodes.py3
-rw-r--r--Cython/Utility/ImportExport.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 5f935360f..7c9d3b18c 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -5371,12 +5371,13 @@ class CClassDefNode(ClassDefNode):
typeobj_cname,
type.vtabptr_cname,
code.error_goto(entry.pos)))
- code.putln("#endif")
+ # TODO: find a way to make this work with the Limited API!
code.globalstate.use_utility_code(
UtilityCode.load_cached('MergeVTables', 'ImportExport.c'))
code.putln("if (__Pyx_MergeVtables(&%s) < 0) %s" % (
typeobj_cname,
code.error_goto(entry.pos)))
+ code.putln("#endif")
if not type.scope.is_internal and not type.scope.directives.get('internal'):
# scope.is_internal is set for types defined by
# Cython (such as closures), the 'internal'
diff --git a/Cython/Utility/ImportExport.c b/Cython/Utility/ImportExport.c
index 655781ee1..a70722977 100644
--- a/Cython/Utility/ImportExport.c
+++ b/Cython/Utility/ImportExport.c
@@ -748,10 +748,14 @@ bad:
/////////////// MergeVTables.proto ///////////////
//@requires: GetVTable
+// TODO: find a way to make this work with the Limited API!
+#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type); /*proto*/
+#endif
/////////////// MergeVTables ///////////////
+#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type) {
int i;
void** base_vtables;
@@ -808,6 +812,7 @@ bad:
free(base_vtables);
return -1;
}
+#endif
/////////////// ImportNumPyArray.proto ///////////////