[pypy-commit] pypy default: a slightly different fix that actually fixes the problem
fijal
noreply at buildbot.pypy.org
Tue May 5 11:01:37 CEST 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r77143:e88d351115ec
Date: 2015-05-05 11:00 +0200
http://bitbucket.org/pypy/pypy/changeset/e88d351115ec/
Log: a slightly different fix that actually fixes the problem
diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -288,6 +288,7 @@
# field of all frames, during the loop below.)
frame = self.gettopframe_nohidden()
while frame:
+ frame.getorcreatedebug().f_lineno = frame.get_last_lineno()
if is_being_profiled:
frame.getorcreatedebug().is_being_profiled = True
frame = self.getnextframe_nohidden(frame)
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -30,13 +30,10 @@
instr_lb = 0
instr_ub = 0
instr_prev_plus_one = 0
- f_lineno = -1 # current lineno
+ f_lineno = 0 # current lineno for tracing
is_being_profiled = False
w_locals = None
- def __init__(self, pycode):
- self.f_lineno = pycode.co_firstlineno
-
class PyFrame(W_Root):
"""Represents a frame for a regular Python function
that needs to be interpreted.
@@ -108,7 +105,7 @@
def getorcreatedebug(self):
if self.debugdata is None:
- self.debugdata = FrameDebugData(self.pycode)
+ self.debugdata = FrameDebugData()
return self.debugdata
def get_w_f_trace(self):
diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -639,8 +639,26 @@
sys._getframe().f_back.f_trace = tracefunc
def settrace_and_return(tracefunc):
_settrace_and_return(tracefunc)
+
+
+ def _settrace_and_raise(tracefunc):
+ sys.settrace(tracefunc)
+ sys._getframe().f_back.f_trace = tracefunc
+ raise RuntimeError
+ def settrace_and_raise(tracefunc):
+ try:
+ _settrace_and_raise(tracefunc)
+ except RuntimeError, exc:
+ pass
+
+ settrace_and_raise.events = [(2, 'exception'),
+ (3, 'line'),
+ (4, 'line'),
+ (4, 'return')]
+
settrace_and_return.events = [(1, 'return')]
run_test2(settrace_and_return)
+ run_test2(settrace_and_raise)
class AppTestCurrentFrames:
More information about the pypy-commit
mailing list