diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2018-01-05 18:46:32 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2018-01-05 18:46:32 +0100 |
commit | 7f649135d4cab890e1759d38082717bf8b35e9cd (patch) | |
tree | de2875e0b0da1e311c1d69bec69f188125d49779 /Cython/Compiler/ModuleNode.py | |
parent | 1c85a7817a98bb8beff70f7ec901ec40a7019539 (diff) | |
download | cython-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.py | 11 |
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")) |