This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jhogg
Recipients
Date 2001-07-23.17:48:19
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Python 2.2a1 (#1, Jul 19 2001, 18:18:51)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on 
linux2

The intepreter dies hard if you directly evaluate the 
func_code of a function that has a closure. E.g.:

-----
def func1():
    return lambda: 4 + y

f = func1()
print "Ugly test 1:", eval( f.func_code, {'y': 38} )


def func2(x):
    return lambda: x + y

f = func2(4)
print "Ugly test 2:", eval( f.func_code, {'y': 38} )
-----

The second eval will cause a core dump on UNIX. The 
offending code is in PyEval_EvalCodeEx() of ceval.c 
line 2466. This loop attempts to match free vars 
against the closure, but the closure is NULL if the 
function is called with eval.

I know this is very broken usage of the interpreter, 
but it should die more cleanly than a core dump ;-)
History
Date User Action Args
2007-08-23 13:55:22adminlinkissue443866 messages
2007-08-23 13:55:22admincreate