Commit 2dc08fb1 authored by Lisandro Dalcin's avatar Lisandro Dalcin

build and install "Cython.Runtime.refnanny", use it as a fallback if a bare...

build and install "Cython.Runtime.refnanny", use it as a fallback if a bare "refnanny" module is not available for import
parent 461323b6
......@@ -1587,8 +1587,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("#ifdef CYTHON_REFNANNY")
code.putln("void* __pyx_refchk = NULL;")
code.putln("__Pyx_Refnanny = (__Pyx_RefnannyAPIStruct*) PyCObject_Import((char *)\"refnanny\", (char *)\"RefnannyAPI\");")
code.putln("if (!__Pyx_Refnanny) Py_FatalError(\"failed to import refnanny module\");")
code.putln("__Pyx_Refnanny = __Pyx_ImportRefcountAPI(\"refnanny\");")
code.putln("if (!__Pyx_Refnanny) {")
code.putln(" PyErr_Clear();")
code.putln(" __Pyx_Refnanny = __Pyx_ImportRefcountAPI(\"Cython.Runtime.refnanny\");")
code.putln(" if (!__Pyx_Refnanny)")
code.putln(" Py_FatalError(\"failed to import refnanny module\");")
code.putln("}")
code.putln("__pyx_refchk = __Pyx_Refnanny->NewContext(\"%s\", __LINE__);"% header3)
code.putln("#endif")
......@@ -2337,6 +2342,8 @@ typedef struct {
int (*FinishContext)(void*);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct* __Pyx_Refnanny = NULL;
#define __Pyx_ImportRefcountAPI(name) \
(__Pyx_RefnannyAPIStruct*) PyCObject_Import((char *)name, (char *)\"RefnannyAPI\")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
......
......@@ -14,6 +14,7 @@ clean:
@rm -f Cython/Compiler/Parsing.{c,so,pyd}
@rm -f Cython/Compiler/Scanning.{c,so,pyd}
@rm -f Cython/Compiler/Visitor.{c,so,pyd}
@rm -f Cython/Runtime/refnanny.{c,so,pyd}
@rm -f Cython/Plex/Scanners.{c,so,pyd}
@(cd Demos; $(MAKE) clean)
......
......@@ -41,12 +41,17 @@ except ValueError:
compiled_modules = ["Cython.Plex.Scanners",
"Cython.Compiler.Scanning",
"Cython.Compiler.Parsing",
"Cython.Compiler.Visitor"]
"Cython.Compiler.Visitor",
"Cython.Runtime.refnanny"]
extensions = []
for module in compiled_modules:
source_file = os.path.join(source_root, *module.split('.'))
if os.path.exists(source_file + ".py"):
source_file = source_file + ".py"
else:
source_file = source_file + ".pyx"
print("Compiling module %s ..." % module)
result = compile(source_file + ".py")
result = compile(source_file)
if result.c_file:
extensions.append(
Extension(module, sources = [result.c_file])
......@@ -101,6 +106,7 @@ setup(
packages=[
'Cython',
'Cython.Compiler',
'Cython.Runtime',
'Cython.Distutils',
'Cython.Mac',
'Cython.Unix',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment