summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2018-01-05 18:46:32 +0100
committerStefan Behnel <stefan_ml@behnel.de>2018-01-05 18:46:32 +0100
commit7f649135d4cab890e1759d38082717bf8b35e9cd (patch)
treede2875e0b0da1e311c1d69bec69f188125d49779 /Cython/Compiler/ModuleNode.py
parent1c85a7817a98bb8beff70f7ec901ec40a7019539 (diff)
downloadcython-7f649135d4cab890e1759d38082717bf8b35e9cd.tar.gz
Extract some generated plain code into a utility code file to make it more visible and editable.
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 0602f6b80..43a316a8a 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -2312,15 +2312,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
tempdecl_code.put_trace_declarations()
code.put_trace_frame_init()
- code.putln("#if CYTHON_REFNANNY")
- code.putln("__Pyx_RefNanny = __Pyx_RefNannyImportAPI(\"refnanny\");")
- code.putln("if (!__Pyx_RefNanny) {")
- code.putln(" PyErr_Clear();")
- code.putln(" __Pyx_RefNanny = __Pyx_RefNannyImportAPI(\"Cython.Runtime.refnanny\");")
- code.putln(" if (!__Pyx_RefNanny)")
- code.putln(" Py_FatalError(\"failed to import 'refnanny' module\");")
- code.putln("}")
- code.putln("#endif")
+ refnanny_import_code = UtilityCode.load_as_string("ImportRefnannyAPI", "ModuleSetupCode.c")[1]
+ code.putln(refnanny_import_code.rstrip())
code.put_setup_refcount_context(header3)
env.use_utility_code(UtilityCode.load("CheckBinaryVersion", "ModuleSetupCode.c"))