summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-01 22:04:41 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-01 22:04:41 (GMT)
commit99be081fae10147e944619c21bf2f00eeabf86ce (patch)
treed0ad0596f0a4abde0df7c058f2177bfa22821323
parente29a8f22817fc13b66cb83f4fc7d37dcc012173c (diff)
downloadcpython-99be081fae10147e944619c21bf2f00eeabf86ce.zip
cpython-99be081fae10147e944619c21bf2f00eeabf86ce.tar.gz
cpython-99be081fae10147e944619c21bf2f00eeabf86ce.tar.bz2
Merged revisions 73114 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73114 | amaury.forgeotdarc | 2009-06-01 22:53:18 +0200 (lun., 01 juin 2009) | 3 lines #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........
-rw-r--r--Lib/test/test_trace.py17
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/frameobject.c5
3 files changed, 23 insertions, 2 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index b5db9a7..ea75a9e 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -740,6 +740,23 @@ class JumpTestCase(unittest.TestCase):
def test_19_no_jump_without_trace_function(self):
no_jump_without_trace_function()
+ def test_20_large_function(self):
+ d = {}
+ exec("""def f(output): # line 0
+ x = 0 # line 1
+ y = 1 # line 2
+ ''' # line 3
+ %s # lines 4-1004
+ ''' # line 1005
+ x += 1 # line 1006
+ output.append(x) # line 1007
+ return""" % ('\n' * 1000,), d)
+ f = d['f']
+
+ f.jump = (2, 1007)
+ f.output = [0]
+ self.run_test(f)
+
def test_main():
test_support.run_unittest(
TraceTestCase,
diff --git a/Misc/NEWS b/Misc/NEWS
index 6dcf1d8..15611a0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6.3
Core and Builtins
-----------------
+- Issue #4547: When debugging a very large function, it was not always
+ possible to update the lineno attribute of the current frame.
+
- Issue #5330: C functions called with keyword arguments were not reported by
the various profiling modules (profile, cProfile). Patch by Hagen F�rstenau.
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 5b2f308..0491334 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -70,7 +70,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
int new_iblock = 0; /* The new value of f_iblock */
unsigned char *code = NULL; /* The bytecode for the frame... */
Py_ssize_t code_len = 0; /* ...and its length */
- char *lnotab = NULL; /* Iterating over co_lnotab */
+ unsigned char *lnotab = NULL; /* Iterating over co_lnotab */
Py_ssize_t lnotab_len = 0; /* (ditto) */
int offset = 0; /* (ditto) */
int line = 0; /* (ditto) */
@@ -114,7 +114,8 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
/* Find the bytecode offset for the start of the given line, or the
* first code-owning line after it. */
- PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len);
+ PyString_AsStringAndSize((char*)f->f_code->co_lnotab,
+ &lnotab, &lnotab_len);
addr = 0;
line = f->f_code->co_firstlineno;
new_lasti = -1;