[3.11] GH-95060: Fix PyCode_Addr2Location when addrq < 0 (GH-95094)

(cherry picked from commit a6daaf2a13)


Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-07-21 08:23:06 -07:00 committed by GitHub
parent d19b5d8533
commit e693f84cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -0,0 +1,2 @@
Undocumented ``PyCode_Addr2Location`` function now properly returns when
``addrq`` argument is less than zero.

View 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;