sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

eval() does not handle keywords arguments properly #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
def f(**kwargs):
    print(kwargs)

f(x=1, y=2)
eval("f()")
eval("f(x=1, y=2)")

What do you see instead?
{"x":1,"y":2}
{}
TypeError: f() takes 0 positional arguments but more were given
module '__main__' line 6
eval("f(x=1, y=2)")
<done in 35 ms>

Original issue reported on code.google.com by pedro.ro...@gmail.com on 1 Jan 2013 at 1:22

GoogleCodeExporter commented 9 years ago
Fixed in revisions 295 and 296
eval() was not implemented, but since it's a Javascript builtin the code 
produced by Brython didn't report a ReferenceError
Revision 295 modifies py2js.js to transform "eval(...)" into "$eval(...)" ; 
rev. 296 adds the function $eval() to py_classes.js

Original comment by pierre.q...@gmail.com on 1 Jan 2013 at 9:24