Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
604a770a
Commit
604a770a
authored
May 23, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up calls to helper functions in module init code
parent
3b6c1dde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+11
-13
No files found.
Cython/Compiler/ModuleNode.py
View file @
604a770a
...
...
@@ -2064,7 +2064,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
put_setup_refcount_context
(
header3
)
env
.
use_utility_code
(
UtilityCode
.
load
(
"CheckBinaryVersion"
,
"ModuleSetupCode.c"
))
code
.
put
ln
(
"if ( __Pyx_check_binary_version() < 0) %s"
%
code
.
error_goto
(
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_check_binary_version()"
)
code
.
putln
(
"%s = PyTuple_New(0); %s"
%
(
Naming
.
empty_tuple
,
code
.
error_goto_if_null
(
Naming
.
empty_tuple
,
self
.
pos
)))
...
...
@@ -2072,15 +2072,15 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
Naming
.
empty_bytes
,
code
.
error_goto_if_null
(
Naming
.
empty_bytes
,
self
.
pos
)))
code
.
putln
(
"#ifdef __Pyx_CyFunction_USED"
)
code
.
put
ln
(
"if (__Pyx_CyFunction_init() < 0) %s"
%
code
.
error_goto
(
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_CyFunction_init()"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#ifdef __Pyx_FusedFunction_USED"
)
code
.
put
ln
(
"if (__pyx_FusedFunction_init() < 0) %s"
%
code
.
error_goto
(
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__pyx_FusedFunction_init()"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#ifdef __Pyx_Generator_USED"
)
code
.
put
ln
(
"if (__pyx_Generator_init() < 0) %s"
%
code
.
error_goto
(
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__pyx_Generator_init()"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"/*--- Library function declarations ---*/"
)
...
...
@@ -2097,20 +2097,18 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_module_creation_code
(
env
,
code
)
code
.
putln
(
"/*--- Initialize various global constants etc. ---*/"
)
code
.
put
ln
(
code
.
error_goto_if_neg
(
"__Pyx_InitGlobals()"
,
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_InitGlobals()"
)
code
.
putln
(
"#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)"
)
code
.
put
ln
(
"if (__Pyx_init_sys_getdefaultencoding_params() < 0) %s"
%
code
.
error_goto
(
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_init_sys_getdefaultencoding_params()"
)
code
.
putln
(
"#endif"
)
__main__name
=
code
.
globalstate
.
get_py_string_const
(
EncodedString
(
"__main__"
),
identifier
=
True
)
code
.
putln
(
"if (%s%s) {"
%
(
Naming
.
module_is_main
,
self
.
full_module_name
.
replace
(
'.'
,
'__'
)))
code
.
putln
(
'if (PyObject_SetAttrString(%s, "__name__", %s) < 0) %s;'
%
(
env
.
module_cname
,
__main__name
.
cname
,
code
.
error_goto
(
self
.
pos
)))
code
.
put_error_if_neg
(
self
.
pos
,
'PyObject_SetAttrString(%s, "__name__", %s)'
%
(
env
.
module_cname
,
__main__name
.
cname
))
code
.
putln
(
"}"
)
# set up __file__ and __path__, then add the module to sys.modules
...
...
@@ -2118,10 +2116,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
Options
.
cache_builtins
:
code
.
putln
(
"/*--- Builtin init code ---*/"
)
code
.
put
ln
(
code
.
error_goto_if_neg
(
"__Pyx_InitCachedBuiltins()"
,
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_InitCachedBuiltins()"
)
code
.
putln
(
"/*--- Constants init code ---*/"
)
code
.
put
ln
(
code
.
error_goto_if_neg
(
"__Pyx_InitCachedConstants()"
,
self
.
pos
)
)
code
.
put
_error_if_neg
(
self
.
pos
,
"__Pyx_InitCachedConstants()"
)
code
.
putln
(
"/*--- Global init code ---*/"
)
self
.
generate_global_init_code
(
env
,
code
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment