]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] GH-95060: Fix PyCode_Addr2Location when addrq < 0 (GH-95094)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 21 Jul 2022 15:23:06 +0000 (08:23 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Jul 2022 15:23:06 +0000 (08:23 -0700)
(cherry picked from commit a6daaf2a132efbb1965b4502ff8a8cf3b5afed0e)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Misc/NEWS.d/next/Core and Builtins/2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst [new file with mode: 0644]
Objects/codeobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst b/Misc/NEWS.d/next/Core and Builtins/2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst
new file mode 100644 (file)
index 0000000..160999e
--- /dev/null
@@ -0,0 +1,2 @@
+Undocumented ``PyCode_Addr2Location`` function now properly returns when
+``addrq`` argument is less than zero.
index 4859b1ecebe50f97fb7bf02050e65d4d77b70a08..35576a283b8248f3b4b75a5561878b01dbe84321 100644 (file)
@@ -969,6 +969,7 @@ PyCode_Addr2Location(PyCodeObject *co, int addrq,
     if (addrq < 0) {
         *start_line = *end_line = co->co_firstlineno;
         *start_column = *end_column = 0;
+        return 1;
     }
     assert(addrq >= 0 && addrq < _PyCode_NBYTES(co));
     PyCodeAddressRange bounds;