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
058a5e89
Commit
058a5e89
authored
Mar 28, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'vitek/master'
parents
cb016b28
00996574
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
5 deletions
+43
-5
Cython/Compiler/UtilNodes.py
Cython/Compiler/UtilNodes.py
+5
-0
Cython/Utility/Generator.c
Cython/Utility/Generator.c
+10
-5
tests/run/letnode_T766.pyx
tests/run/letnode_T766.pyx
+28
-0
No files found.
Cython/Compiler/UtilNodes.py
View file @
058a5e89
...
...
@@ -310,6 +310,11 @@ class LetNode(Nodes.StatNode, LetNodeMixin):
self
.
body
.
generate_execution_code
(
code
)
self
.
teardown_temp_expr
(
code
)
def
generate_function_definitions
(
self
,
env
,
code
):
self
.
temp_expression
.
generate_function_definitions
(
env
,
code
)
self
.
body
.
generate_function_definitions
(
env
,
code
)
class
TempResultFromStatNode
(
ExprNodes
.
ExprNode
):
# An ExprNode wrapper around a StatNode that executes the StatNode
# body. Requires a ResultRefNode that it sets up to refer to its
...
...
Cython/Utility/Generator.c
View file @
058a5e89
...
...
@@ -61,8 +61,9 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static
PyObject
*
__Pyx_Generator_Close
(
PyObject
*
self
);
static
PyObject
*
__Pyx_Generator_Throw
(
PyObject
*
gen
,
PyObject
*
args
);
static
PyTypeObject
__pyx_GeneratorType
;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == &__pyx_GeneratorType)
static
PyTypeObject
*
__pyx_GeneratorType
=
0
;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
// If StopIteration exception is set, fetches its 'value'
...
...
@@ -518,7 +519,7 @@ static PyMethodDef __pyx_Generator_methods[] = {
{
0
,
0
,
0
,
0
}
};
static
PyTypeObject
__pyx_GeneratorType
=
{
static
PyTypeObject
__pyx_GeneratorType
_type
=
{
PyVarObject_HEAD_INIT
(
0
,
0
)
__Pyx_NAMESTR
(
"generator"
),
/*tp_name*/
sizeof
(
__pyx_GeneratorObject
),
/*tp_basicsize*/
...
...
@@ -577,7 +578,7 @@ static PyTypeObject __pyx_GeneratorType = {
static
__pyx_GeneratorObject
*
__Pyx_Generator_New
(
__pyx_generator_body_t
body
,
PyObject
*
closure
)
{
__pyx_GeneratorObject
*
gen
=
PyObject_GC_New
(
__pyx_GeneratorObject
,
&
__pyx_GeneratorType
);
PyObject_GC_New
(
__pyx_GeneratorObject
,
&
__pyx_GeneratorType
_type
);
if
(
gen
==
NULL
)
return
NULL
;
...
...
@@ -599,5 +600,9 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
}
static
int
__pyx_Generator_init
(
void
)
{
return
PyType_Ready
(
&
__pyx_GeneratorType
);
if
(
PyType_Ready
(
&
__pyx_GeneratorType_type
))
{
return
-
1
;
}
__pyx_GeneratorType
=
&
__pyx_GeneratorType_type
;
return
0
;
}
tests/run/letnode_T766.pyx
0 → 100644
View file @
058a5e89
# mode: run
# ticket: 766
# tags: letnode
def
test_letnode_range
(
int
n
):
"""
>>> [i() for i in test_letnode_range(5)]
[0, 1, 2, 3, 4]
"""
ret
=
[]
for
i
in
range
(
n
):
def
bar
(
x
=
i
):
return
x
ret
.
append
(
bar
)
return
ret
def
test_letnode_enumerate
(
a
):
"""
>>> [i() for i in test_letnode_enumerate("abc")]
[0, 1, 2]
"""
cdef
int
n
ret
=
[]
for
n
,
i
in
enumerate
(
a
):
def
bar
(
x
=
n
):
return
x
ret
.
append
(
bar
)
return
ret
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