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
067c4694
Commit
067c4694
authored
Apr 23, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverted last commit - only a problem for closure scope
parent
18412f38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
16 deletions
+12
-16
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+12
-16
No files found.
Cython/Compiler/ModuleNode.py
View file @
067c4694
...
@@ -964,8 +964,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -964,8 +964,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
py_attrs
=
[]
py_attrs
=
[]
for
entry
in
scope
.
var_entries
:
for
entry
in
scope
.
var_entries
:
if
entry
.
type
.
is_pyobject
:
if
entry
.
type
.
is_pyobject
:
py_attrs
.
append
((
entry
.
cname
,
entry
))
py_attrs
.
append
(
entry
)
py_attrs
.
sort
()
need_self_cast
=
type
.
vtabslot_cname
or
py_attrs
need_self_cast
=
type
.
vtabslot_cname
or
py_attrs
code
.
putln
(
""
)
code
.
putln
(
""
)
code
.
putln
(
code
.
putln
(
...
@@ -1003,9 +1002,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1003,9 +1002,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"p->%s = %s%s;"
%
(
code
.
putln
(
"p->%s = %s%s;"
%
(
type
.
vtabslot_cname
,
type
.
vtabslot_cname
,
struct_type_cast
,
type
.
vtabptr_cname
))
struct_type_cast
,
type
.
vtabptr_cname
))
for
cname
,
entry
in
py_attrs
:
for
entry
in
py_attrs
:
if
entry
.
name
==
"__weakref__"
:
if
entry
.
name
==
"__weakref__"
:
code
.
putln
(
"p->%s = 0;"
%
cname
)
code
.
putln
(
"p->%s = 0;"
%
entry
.
cname
)
else
:
else
:
code
.
put_init_var_to_py_none
(
entry
,
"p->%s"
,
nanny
=
False
)
code
.
put_init_var_to_py_none
(
entry
,
"p->%s"
,
nanny
=
False
)
entry
=
scope
.
lookup_here
(
"__new__"
)
entry
=
scope
.
lookup_here
(
"__new__"
)
...
@@ -1039,15 +1038,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1039,15 +1038,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
weakref_slot
=
scope
.
lookup_here
(
"__weakref__"
)
weakref_slot
=
scope
.
lookup_here
(
"__weakref__"
)
for
entry
in
scope
.
var_entries
:
for
entry
in
scope
.
var_entries
:
if
entry
.
type
.
is_pyobject
and
entry
is
not
weakref_slot
:
if
entry
.
type
.
is_pyobject
and
entry
is
not
weakref_slot
:
py_attrs
.
append
((
entry
.
cname
,
entry
))
py_attrs
.
append
(
entry
)
py_attrs
.
sort
()
if
py_attrs
or
weakref_slot
in
scope
.
var_entries
:
if
py_attrs
or
weakref_slot
in
scope
.
var_entries
:
self
.
generate_self_cast
(
scope
,
code
)
self
.
generate_self_cast
(
scope
,
code
)
self
.
generate_usr_dealloc_call
(
scope
,
code
)
self
.
generate_usr_dealloc_call
(
scope
,
code
)
if
weakref_slot
in
scope
.
var_entries
:
if
weakref_slot
in
scope
.
var_entries
:
code
.
putln
(
"if (p->__weakref__) PyObject_ClearWeakRefs(o);"
)
code
.
putln
(
"if (p->__weakref__) PyObject_ClearWeakRefs(o);"
)
for
cname
,
entry
in
py_attrs
:
for
entry
in
py_attrs
:
code
.
put_xdecref
(
"p->%s"
%
cname
,
entry
.
type
,
nanny
=
False
)
code
.
put_xdecref
(
"p->%s"
%
entry
.
cname
,
entry
.
type
,
nanny
=
False
)
if
base_type
:
if
base_type
:
tp_dealloc
=
TypeSlots
.
get_base_slot_function
(
scope
,
tp_slot
)
tp_dealloc
=
TypeSlots
.
get_base_slot_function
(
scope
,
tp_slot
)
if
tp_dealloc
is
None
:
if
tp_dealloc
is
None
:
...
@@ -1096,8 +1094,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1096,8 +1094,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
py_attrs
=
[]
py_attrs
=
[]
for
entry
in
scope
.
var_entries
:
for
entry
in
scope
.
var_entries
:
if
entry
.
type
.
is_pyobject
and
entry
.
name
!=
"__weakref__"
:
if
entry
.
type
.
is_pyobject
and
entry
.
name
!=
"__weakref__"
:
py_attrs
.
append
((
entry
.
cname
,
entry
))
py_attrs
.
append
(
entry
)
py_attrs
.
sort
()
if
base_type
or
py_attrs
:
if
base_type
or
py_attrs
:
code
.
putln
(
"int e;"
)
code
.
putln
(
"int e;"
)
if
py_attrs
:
if
py_attrs
:
...
@@ -1113,8 +1110,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1113,8 +1110,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"e = %s->tp_traverse(o, v, a); if (e) return e;"
%
"e = %s->tp_traverse(o, v, a); if (e) return e;"
%
base_type
.
typeptr_cname
)
base_type
.
typeptr_cname
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
for
cname
,
entry
in
py_attrs
:
for
entry
in
py_attrs
:
var_code
=
"p->%s"
%
cname
var_code
=
"p->%s"
%
entry
.
cname
code
.
putln
(
code
.
putln
(
"if (%s) {"
"if (%s) {"
%
var_code
)
%
var_code
)
...
@@ -1141,8 +1138,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1141,8 +1138,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
py_attrs
=
[]
py_attrs
=
[]
for
entry
in
scope
.
var_entries
:
for
entry
in
scope
.
var_entries
:
if
entry
.
type
.
is_pyobject
and
entry
.
name
!=
"__weakref__"
:
if
entry
.
type
.
is_pyobject
and
entry
.
name
!=
"__weakref__"
:
py_attrs
.
append
((
entry
.
cname
,
entry
))
py_attrs
.
append
(
entry
)
py_attrs
.
sort
()
if
py_attrs
:
if
py_attrs
:
self
.
generate_self_cast
(
scope
,
code
)
self
.
generate_self_cast
(
scope
,
code
)
code
.
putln
(
"PyObject* tmp;"
)
code
.
putln
(
"PyObject* tmp;"
)
...
@@ -1155,8 +1151,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1155,8 +1151,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"if (%s->tp_clear) {"
%
base_type
.
typeptr_cname
)
code
.
putln
(
"if (%s->tp_clear) {"
%
base_type
.
typeptr_cname
)
code
.
putln
(
"%s->tp_clear(o);"
%
base_type
.
typeptr_cname
)
code
.
putln
(
"%s->tp_clear(o);"
%
base_type
.
typeptr_cname
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
for
cname
,
entry
in
py_attrs
:
for
entry
in
py_attrs
:
name
=
"p->%s"
%
cname
name
=
"p->%s"
%
entry
.
cname
code
.
putln
(
"tmp = ((PyObject*)%s);"
%
name
)
code
.
putln
(
"tmp = ((PyObject*)%s);"
%
name
)
code
.
put_init_to_py_none
(
name
,
entry
.
type
,
nanny
=
False
)
code
.
put_init_to_py_none
(
name
,
entry
.
type
,
nanny
=
False
)
code
.
putln
(
"Py_XDECREF(tmp);"
)
code
.
putln
(
"Py_XDECREF(tmp);"
)
...
...
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