Skip to content

Commit 24e581f

Browse files
committed
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 python#4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........
1 parent 1172999 commit 24e581f

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

Lib/test/test_trace.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,23 @@ def test_18_no_jump_to_non_integers(self):
741741
def test_19_no_jump_without_trace_function(self):
742742
no_jump_without_trace_function()
743743

744+
def test_20_large_function(self):
745+
d = {}
746+
exec("""def f(output): # line 0
747+
x = 0 # line 1
748+
y = 1 # line 2
749+
''' # line 3
750+
%s # lines 4-1004
751+
''' # line 1005
752+
x += 1 # line 1006
753+
output.append(x) # line 1007
754+
return""" % ('\n' * 1000,), d)
755+
f = d['f']
756+
757+
f.jump = (2, 1007)
758+
f.output = [0]
759+
self.run_test(f)
760+
744761
def test_jump_to_firstlineno(self):
745762
# This tests that PDB can jump back to the first line in a
746763
# file. See issue #1689458. It can only be triggered in a

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.1 Release Candidate 2?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #4547: When debugging a very large function, it was not always
16+
possible to update the lineno attribute of the current frame.
17+
1518
- Issue #5330: C functions called with keyword arguments were not reported by
1619
the various profiling modules (profile, cProfile). Patch by Hagen F�rstenau.
1720

Objects/frameobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
6969
int new_iblock = 0; /* The new value of f_iblock */
7070
unsigned char *code = NULL; /* The bytecode for the frame... */
7171
Py_ssize_t code_len = 0; /* ...and its length */
72-
char *lnotab = NULL; /* Iterating over co_lnotab */
72+
unsigned char *lnotab = NULL; /* Iterating over co_lnotab */
7373
Py_ssize_t lnotab_len = 0; /* (ditto) */
7474
int offset = 0; /* (ditto) */
7575
int line = 0; /* (ditto) */
@@ -131,7 +131,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
131131
/* Find the bytecode offset for the start of the given
132132
* line, or the first code-owning line after it. */
133133
PyBytes_AsStringAndSize(f->f_code->co_lnotab,
134-
&lnotab, &lnotab_len);
134+
&(char*)lnotab, &lnotab_len);
135135
addr = 0;
136136
line = f->f_code->co_firstlineno;
137137
new_lasti = -1;

0 commit comments

Comments
 (0)