[Python-bugs-list] [ python-Bugs-457360 ] Nested scopes crash when tracing (v2.1)
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 10 Sep 2001 08:29:38 -0700
Bugs item #457360, was opened at 2001-08-31 12:13
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=457360&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
>Priority: 5
Submitted By: Stephan R.A. Deibel (sdeibel)
Assigned to: Jeremy Hylton (jhylton)
Summary: Nested scopes crash when tracing (v2.1)
Initial Comment:
Python will crash on post-trace processing if
the tracer is installed during a class def nested
inside of a nest function def, under certain conditions
at least.
I tried to make a small test case but that didn't bring
out the bug.
As a result, this is best illustrated by installing
Zope 2.4.0 (I did this on Linux) and altering z2.py by
inserting the following near the top of the file:
def tracer(*args):
print "trace"
return tracer
import sys
sys.settrace(tracer)
Then run with the './start' command. Python will
segfault during the following around line 570
of z2.py:
exec "import "+MODULE in {}
The real problem is the LocalsToFast() call after
the tracer has been called while the interpreter is
doing the 'line' tracing for line 118 of
libs/python/RestrictedPython/Gaurds.py in Zope, where
"class Wrapper" is defined nested inside of a nested
function.
The innermost part of the C backtrace is:
#0 PyCell_Set (op=0x0, obj=0x8322e04) at
Objects/cellobject.c:32
(gdb) up
#1 0x808068a in dict_to_map (map=0x81d5cc4, nmap=1,
dict=0x81d269c,
values=0x8195db0, deref=1, clear=1) at
Objects/frameobject.c:287
(gdb) up
#2 0x8080903 in PyFrame_LocalsToFast (f=0x8195c68,
clear=1)
at Objects/frameobject.c:371
(gdb) up
#3 0x80587e3 in call_trace (p_trace=0x8195c88,
p_newtrace=0x8195c88,
f=0x8195c68, msg=0x809c3a2 "line", arg=0x80b5c0c)
at Python/ceval.c:2595
I tested this under RedHat 6.1 with Python 2.1 (both
the copy that comes with Zope and one I built from
source with debug symbols).
For more info, contact via email: info at wingide.com.
----------------------------------------------------------------------
>Comment By: Jeremy Hylton (jhylton)
Date: 2001-09-10 08:29
Message:
Logged In: YES
user_id=31392
I made a half-hearted effort to reproduce. I tried to just
import and execute the code in Guards with a trace function
installed. I got that to work correctly with Python 2.1.1.
There was a nested scopes core dump that was fixed in 2.1.1.
The bug that triggered it was reported by Evan and
triggered by RestrictedPython. Can you try to reproduce
against 2.1.1? I suspect that the fix in 2.1.1 fixes this, too.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=457360&group_id=5470