]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 73117 via svnmerge from
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 1 Jun 2009 22:19:47 +0000 (22:19 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 1 Jun 2009 22:19:47 +0000 (22:19 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r73117 | amaury.forgeotdarc | 2009-06-01 23:28:37 +0200 (lun., 01 juin 2009) | 10 lines

  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.
  ........
................

Lib/test/test_trace.py
Misc/NEWS
Objects/frameobject.c

index 48a717ba8f5d64d6bd07ce227d26ca86c27b07f8..2234d0072975efcfbd85b64e9a17d6c3103c45b0 100644 (file)
@@ -741,6 +741,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():
     support.run_unittest(
         TraceTestCase,
index a35379429b601e7de8513212592b02dbb3f6787b..143a8497210d97a065e8852ee51ece989fe69bd0 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.0.2?
 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 #6089: Fixed str.format with certain invalid field specifiers
   that would raise SystemError.
 
index e29c64742c0bc3f924964a36d6c6a9b9e5118b63..75a9dfd73822a788301f35dbd0c3970ad026d1bb 100644 (file)
@@ -69,7 +69,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) */
@@ -125,7 +125,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. */
-       PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len);
+       PyBytes_AsStringAndSize(f->f_code->co_lnotab,
+                               &(char*)lnotab, &lnotab_len);
        addr = 0;
        line = f->f_code->co_firstlineno;
        new_lasti = -1;