In IronPython b2 I get:

>>> s = '''
... def body(context):
...     def ccall():
...             body = lambda: None
...             context.update(locals())
...     ccall()
...
... '''
>>> d = {}
>>> exec s in d
>>> c = {}
>>> d['body'](c)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line unknown, in Interpreted_body_1
NameError: name 'locals' is not defined

This works fine in CPython:

>>> s = '''
... def body(context):
...     def ccall():
...             body = lambda: None
...             context.update(locals())
...     ccall()
...
... '''
>>> exec s in d
>>> c = {}
>>> d['body'](c)
>>> c
{'body': <function <lambda> at 0x0359CCB0>, 'context': {...}}

Any idea why?

Thanks,
-Dan
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to