summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2018-10-02 14:43:21 +0200
committerRobert Bradshaw <robertwb@gmail.com>2018-10-02 14:43:21 +0200
commitd1cf2648e6a4e3b681a031c9d4b42bd20e544c76 (patch)
tree0552165223af2410016590f93f5b852f8a86e2c8
parent34bc649fa15776c412e3a3e28454c439e51b972a (diff)
downloadcython-d1cf2648e6a4e3b681a031c9d4b42bd20e544c76.tar.gz
Fix type import enum.
-rw-r--r--Cython/Compiler/ModuleNode.py1
-rw-r--r--Cython/Utility/ImportExport.c11
2 files changed, 5 insertions, 7 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index f8392e1f3..d4eaf20ab 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -276,6 +276,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if api_funcs:
h_code.put(UtilityCode.load_as_string("FunctionImport", "ImportExport.c")[1])
if api_extension_types:
+ h_code.put(UtilityCode.load_as_string("TypeImport", "ImportExport.c")[0])
h_code.put(UtilityCode.load_as_string("TypeImport", "ImportExport.c")[1])
h_code.putln("")
h_code.putln("static int import_%s(void) {" % self.api_name(env))
diff --git a/Cython/Utility/ImportExport.c b/Cython/Utility/ImportExport.c
index 148d1d4ce..670346723 100644
--- a/Cython/Utility/ImportExport.c
+++ b/Cython/Utility/ImportExport.c
@@ -308,6 +308,8 @@ set_path:
/////////////// TypeImport.proto ///////////////
+#ifndef __PYX_HAVE_RT_ImportType_proto
+#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
__Pyx_ImportType_CheckSize_Error = 0,
@@ -315,9 +317,10 @@ enum __Pyx_ImportType_CheckSize {
__Pyx_ImportType_CheckSize_Ignore = 2
};
-
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); /*proto*/
+#endif
+
/////////////// TypeImport ///////////////
#ifndef __PYX_HAVE_RT_ImportType
@@ -325,12 +328,6 @@ static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name,
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
- /*
- * 'check_size' tells what to do if tp_basicsize is different from size:
- * 0 - Error (originates in check_size=error)
- * 1 - Error if tp_basicsize is smaller, warn if larger (originates in check_size=warn)
- * 2 - Error if tp_basicsize is smaller, but allow compatible extensions (originates in check_size=extend)
- */
PyObject *result = 0;
char warning[200];
Py_ssize_t basicsize;