]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720). (GH-28721)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 4 Oct 2021 14:07:21 +0000 (17:07 +0300)
committerGitHub <noreply@github.com>
Mon, 4 Oct 2021 14:07:21 +0000 (17:07 +0300)
(cherry picked from commit 252b7bcb236dc261f3af1275bc90f9a303d9648f)

Objects/frameobject.c
Python/compile.c

index 8974d37412356c1ca8cedf50df8771f97d5e279a..d02cf9d3ba9f0689b329c5136d210d5296356fd4 100644 (file)
@@ -275,8 +275,8 @@ marklines(PyCodeObject *code, int len)
     }
 
     while (PyLineTable_NextAddressRange(&bounds)) {
-        assert(bounds.ar_start/2 < len);
-        linestarts[bounds.ar_start/2] = bounds.ar_line;
+        assert(bounds.ar_start/(int)sizeof(_Py_CODEUNIT) < len);
+        linestarts[bounds.ar_start/sizeof(_Py_CODEUNIT)] = bounds.ar_line;
     }
     return linestarts;
 }
index b007859bd2e732dd3a84df3b7537913c07729bde..97aa2247f60951fc75579c3be92ebe3f233cc20f 100644 (file)
@@ -6619,7 +6619,7 @@ static int
 assemble_line_range(struct assembler *a)
 {
     int ldelta, bdelta;
-    bdelta =  (a->a_offset - a->a_lineno_start) * 2;
+    bdelta =  (a->a_offset - a->a_lineno_start) * sizeof(_Py_CODEUNIT);
     if (bdelta == 0) {
         return 1;
     }