Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
g = 5
def t(): print eval('g')
doesn't work with pysco (get a NameError), but works
fine without psyco.
Redhat Linux 7.2, Python 2.1.1
Logged In: YES
Similar problems are found with globals(), execfile(), and
possibly a couple of other functions which use information
about the last frame (here its 'globals' dictionary). I
cannot fix the functions without changing the interpreter
source, but I can plug my own Psyco-aware functions into the
__builtins__ when Psyco loads, as I did with
Should be fixed in CVS. If you can, please check it.
The problem appears on any function that implicitely grabs
the callers' globals and/or locals. I fixed the following
ones: eval(), execfile(), globals(), locals(), vars(),
Logged In: YES
The example in this bug report is fixed. I also tested
simple tests w/exec, globals, locals, and vars.
However, I pulled the example from the pychecker tests.
I'm still getting most of the NameErrors in pychecker. I
also got a
core dump for at least one test -- 49.
If you want to use pychecker, download from pychecker.sf.net.
Modify pychecker/warn.py (add to the end of the file):
Then run the tests: ./test_check.sh
Thanks for the core dump bug; just fixed one more subtle
case in dispatcher.c... The NameErrors all code from the
following line in CodeChecks.py:941:
eval("codeSource.module.module.%s.__name__" % operand)
because 'codeSource' is a local variable. This could anyway
be considered as bad Python style; it works fine if the above
expression is replaced by its getattr() version.
Agree about the abuse of eval. Works fine with getattr.