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
e24f88f8
Commit
e24f88f8
authored
Feb 21, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f36dbda7
6f52a14a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
11 deletions
+23
-11
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+4
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+19
-11
No files found.
Cython/Compiler/Code.py
View file @
e24f88f8
...
...
@@ -772,6 +772,10 @@ class CCodeWriter(object):
if
entry
.
type
.
is_pyobject
:
self
.
putln
(
"__Pyx_GIVEREF(%s);"
%
self
.
entry_as_pyobject
(
entry
))
def
put_var_xgotref
(
self
,
entry
):
if
entry
.
type
.
is_pyobject
:
self
.
putln
(
"__Pyx_XGOTREF(%s);"
%
self
.
entry_as_pyobject
(
entry
))
def
put_var_xgiveref
(
self
,
entry
):
if
entry
.
type
.
is_pyobject
:
self
.
putln
(
"__Pyx_XGIVEREF(%s);"
%
self
.
entry_as_pyobject
(
entry
))
...
...
Cython/Compiler/ModuleNode.py
View file @
e24f88f8
...
...
@@ -1640,6 +1640,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
Options
.
generate_cleanup_code
:
# this should be replaced by the module's tp_clear in Py3
env
.
use_utility_code
(
import_module_utility_code
)
code
.
putln
(
"if (__Pyx_RegisterCleanup()) %s;"
%
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"%s = %s;"
%
(
Naming
.
retval_cname
,
env
.
module_cname
))
...
...
@@ -1670,7 +1671,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def
generate_module_cleanup_func
(
self
,
env
,
code
):
if
not
Options
.
generate_cleanup_code
:
return
env
.
use_utility_code
(
import_module_utility_code
)
env
.
use_utility_code
(
register_cleanup_utility_code
)
# Insert code stream of __Pyx_CleanupGlobals()
code
.
globalstate
.
insert_cleanupcode_into
(
code
)
...
...
@@ -1683,25 +1683,33 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for
entry
in
rev_entries
:
if
entry
.
visibility
!=
'extern'
:
if
entry
.
type
.
is_pyobject
and
entry
.
used
:
code
.
put_var_decref_clear
(
entry
)
code
.
putln
(
"Py_DECREF(%s); %s = 0;"
%
(
code
.
entry_as_pyobject
(
entry
),
entry
.
cname
))
code
.
putln
(
"__Pyx_CleanupGlobals();"
)
if
Options
.
generate_cleanup_code
>=
3
:
code
.
putln
(
"/*--- Type import cleanup code ---*/"
)
for
type
,
_
in
env
.
types_imported
.
items
():
code
.
put_decref
(
"((PyObject*)%s)"
%
type
.
typeptr_cname
,
PyrexTypes
.
py_object_type
)
code
.
putln
(
"Py_DECREF((PyObject *)%s); %s = 0;"
%
(
type
.
typeptr_cname
,
type
.
typeptr_cname
))
if
Options
.
cache_builtins
:
code
.
putln
(
"/*--- Builtin cleanup code ---*/"
)
for
entry
in
env
.
cached_builtins
:
code
.
put_var_decref_clear
(
entry
)
code
.
putln
(
"Py_DECREF(%s); %s = 0;"
%
(
Naming
.
empty_tuple
,
Naming
.
empty_tuple
));
code
.
put_decref_clear
(
entry
.
cname
,
PyrexTypes
.
py_object_type
,
nanny
=
False
)
code
.
putln
(
"/*--- Intern cleanup code ---*/"
)
code
.
put_decref_clear
(
Naming
.
empty_tuple
,
PyrexTypes
.
py_object_type
,
nanny
=
False
)
for
entry
in
env
.
pynum_entries
:
code
.
put_var_decref_clear
(
entry
)
if
env
.
all_pystring_entries
:
code
.
put_decref_clear
(
entry
.
cname
,
PyrexTypes
.
py_object_type
,
nanny
=
False
)
for
entry
in
env
.
all_pystring_entries
:
if
entry
.
is_interned
:
code
.
put_decref_clear
(
entry
.
pystring_cname
,
PyrexTypes
.
py_object_type
)
code
.
put_decref_clear
(
entry
.
pystring_cname
,
PyrexTypes
.
py_object_type
,
nanny
=
False
)
code
.
putln
(
"Py_INCREF(Py_None); return Py_None;"
)
code
.
putln
(
'}'
)
...
...
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