Commit 058a5e89 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge remote-tracking branch 'vitek/master'

parents cb016b28 00996574
......@@ -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
......
......@@ -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;
}
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment