[Python-bugs-list] [ python-Bugs-443866 ] Evaluating func_code causing core dump
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 24 Jul 2001 15:35:20 -0700
Bugs item #443866, was opened at 2001-07-23 10:48
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=443866&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Hogg (jhogg)
>Assigned to: Jeremy Hylton (jhylton)
Summary: Evaluating func_code causing core dump
Initial Comment:
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 ;-)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-07-24 15:35
Message:
Logged In: YES
user_id=31435
Assigned to Jeremy in the hopes this will speed his return
to us <wink>.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=443866&group_id=5470