We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a3bca5 commit 19b6f6dCopy full SHA for 19b6f6d
1 file changed
Objects/codeobject.c
@@ -1011,9 +1011,16 @@ PyCode_Addr2Line(PyCodeObject *co, int addrq)
1011
if (addrq < 0) {
1012
return co->co_firstlineno;
1013
}
1014
+ int lineno = -2; // -1 is a valid line number
1015
+ Py_BEGIN_CRITICAL_SECTION(co);
1016
if (co->_co_monitoring && co->_co_monitoring->lines) {
- return _Py_Instrumentation_GetLine(co, addrq/sizeof(_Py_CODEUNIT));
1017
+ lineno = _Py_Instrumentation_GetLine(co, addrq/sizeof(_Py_CODEUNIT));
1018
+ }
1019
+ Py_END_CRITICAL_SECTION();
1020
+ if (lineno != -2) {
1021
+ return lineno;
1022
1023
+
1024
assert(addrq >= 0 && addrq < _PyCode_NBYTES(co));
1025
PyCodeAddressRange bounds;
1026
_PyCode_InitAddressRange(co, &bounds);
0 commit comments