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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
1eb2f0ab
Commit
1eb2f0ab
authored
Jan 07, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refnanny: Fix for return from module init function
parent
7c52c8a9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+15
-8
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
1eb2f0ab
...
...
@@ -1588,6 +1588,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
header3
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"{"
)
code
.
putln
(
"PyObject* %s;"
%
Naming
.
retval_cname
)
tempdecl_code
=
code
.
insertion_point
()
code
.
putln
(
'__Pyx_SetupRefcountContext("%s");'
%
header3
)
...
...
@@ -1637,17 +1638,23 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# this should be replaced by the module's tp_clear in Py3
code
.
putln
(
"if (__Pyx_RegisterCleanup()) %s;"
%
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
code
.
putln
(
"return;"
)
code
.
putln
(
"#else"
)
code
.
putln
(
"return %s;"
%
env
.
module_cname
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"%s = %s;"
%
(
Naming
.
retval_cname
,
env
.
module_cname
))
code
.
put_goto
(
code
.
return_label
)
code
.
put_label
(
code
.
error_label
)
code
.
put_var_xdecrefs
(
env
.
temp_entries
)
code
.
putln
(
'__Pyx_AddTraceback("%s");'
%
env
.
qualified_name
)
env
.
use_utility_code
(
Nodes
.
traceback_utility_code
)
code
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
code
.
putln
(
"return NULL;"
)
code
.
putln
(
"%s = NULL;"
%
Naming
.
retval_cname
)
code
.
put_label
(
code
.
return_label
)
code
.
putln
(
'if (__Pyx_FinishRefcountContext() == -1) {'
)
code
.
putln
(
code
.
set_error_info
(
self
.
pos
))
code
.
putln
(
'__Pyx_AddTraceback("%s");'
%
env
.
qualified_name
)
code
.
putln
(
'%s = NULL;'
%
Naming
.
retval_cname
)
code
.
putln
(
'}'
)
code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
code
.
putln
(
"return;"
)
code
.
putln
(
"#else"
)
code
.
putln
(
"return %s;"
%
Naming
.
retval_cname
)
code
.
putln
(
"#endif"
)
code
.
putln
(
'}'
)
...
...
Cython/Compiler/Nodes.py
View file @
1eb2f0ab
...
...
@@ -1137,6 +1137,7 @@ class FuncDefNode(StatNode, BlockNode):
code
.
putln
(
"PyGILState_Release(_save);"
)
# code.putln("/* TODO: decref scope object */")
# ----- Return
# This code is duplicated in ModuleNode.generate_module_init_func
default_retval
=
self
.
return_type
.
default_value
err_val
=
self
.
error_value
()
if
err_val
is
None
and
default_retval
:
...
...
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