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
62567a26
Commit
62567a26
authored
Mar 30, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle generic declared args inside closure
parent
3060b7f1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+9
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+3
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
62567a26
...
@@ -942,9 +942,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -942,9 +942,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
type
.
vtabstruct_cname
,
type
.
vtabstruct_cname
,
type
.
vtabslot_cname
))
type
.
vtabslot_cname
))
for
attr
in
type
.
scope
.
var_entries
:
for
attr
in
type
.
scope
.
var_entries
:
if
attr
.
is_declared_generic
:
attr_type
=
py_object_type
else
:
attr_type
=
attr
.
type
code
.
putln
(
code
.
putln
(
"%s;"
%
"%s;"
%
attr
.
type
.
declaration_code
(
attr
.
cname
))
attr
_
type
.
declaration_code
(
attr
.
cname
))
code
.
putln
(
footer
)
code
.
putln
(
footer
)
if
type
.
objtypedef_cname
is
not
None
:
if
type
.
objtypedef_cname
is
not
None
:
# Only for exposing public typedef name.
# Only for exposing public typedef name.
...
@@ -1241,6 +1245,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1241,6 +1245,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for
entry
in
py_attrs
:
for
entry
in
py_attrs
:
name
=
"p->%s"
%
entry
.
cname
name
=
"p->%s"
%
entry
.
cname
code
.
putln
(
"tmp = ((PyObject*)%s);"
%
name
)
code
.
putln
(
"tmp = ((PyObject*)%s);"
%
name
)
if
entry
.
is_declared_generic
:
code
.
put_init_to_py_none
(
name
,
py_object_type
,
nanny
=
False
)
else
:
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);"
)
code
.
putln
(
code
.
putln
(
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
62567a26
...
@@ -1636,11 +1636,13 @@ class CreateClosureClasses(CythonTransform):
...
@@ -1636,11 +1636,13 @@ class CreateClosureClasses(CythonTransform):
is_cdef
=
True
)
is_cdef
=
True
)
node
.
needs_outer_scope
=
True
node
.
needs_outer_scope
=
True
for
name
,
entry
in
in_closure
:
for
name
,
entry
in
in_closure
:
class_scope
.
declare_var
(
pos
=
entry
.
pos
,
cl
osure_entry
=
cl
ass_scope
.
declare_var
(
pos
=
entry
.
pos
,
name
=
entry
.
name
,
name
=
entry
.
name
,
cname
=
entry
.
cname
,
cname
=
entry
.
cname
,
type
=
entry
.
type
,
type
=
entry
.
type
,
is_cdef
=
True
)
is_cdef
=
True
)
if
entry
.
is_declared_generic
:
closure_entry
.
is_declared_generic
=
1
node
.
needs_closure
=
True
node
.
needs_closure
=
True
# Do it here because other classes are already checked
# Do it here because other classes are already checked
target_module_scope
.
check_c_class
(
func_scope
.
scope_class
)
target_module_scope
.
check_c_class
(
func_scope
.
scope_class
)
...
...
Cython/Compiler/Symtab.py
View file @
62567a26
...
@@ -1331,6 +1331,7 @@ class LocalScope(Scope):
...
@@ -1331,6 +1331,7 @@ class LocalScope(Scope):
inner_entry
.
is_variable
=
True
inner_entry
.
is_variable
=
True
inner_entry
.
outer_entry
=
entry
inner_entry
.
outer_entry
=
entry
inner_entry
.
from_closure
=
True
inner_entry
.
from_closure
=
True
inner_entry
.
is_declared_generic
=
entry
.
is_declared_generic
self
.
entries
[
name
]
=
inner_entry
self
.
entries
[
name
]
=
inner_entry
return
inner_entry
return
inner_entry
return
entry
return
entry
...
...
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