From 57bd16eef5b23dc9748bd03f59fd894d235b3775 Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Thu, 21 Jul 2022 19:17:32 +0800 Subject: [PATCH 1/2] Return in PyCode_Addr2Location --- Objects/codeobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Objects/codeobject.c b/Objects/codeobject.c index d4fa0e38aed629..76e430ae1c501a 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -971,6 +971,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; From 0979130ecad13c781180ae2972f9bd1cdc894e8f Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Thu, 21 Jul 2022 19:19:23 +0800 Subject: [PATCH 2/2] Create 2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst --- .../2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst 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 index 00000000000000..160999e82bf081 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-07-21-19-19-20.gh-issue-95060.4xdT1f.rst @@ -0,0 +1,2 @@ +Undocumented ``PyCode_Addr2Location`` function now properly returns when +``addrq`` argument is less than zero.