mirror of
https://github.com/python/cpython.git
synced 2025-10-31 21:51:50 +00:00
gh-138661: fix data race in PyCode_Addr2Line (#138664)
This commit is contained in:
parent
c3fca5d478
commit
ea26f6da39
3 changed files with 15 additions and 3 deletions
|
|
@ -1006,7 +1006,7 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
|
|||
******************/
|
||||
|
||||
int
|
||||
PyCode_Addr2Line(PyCodeObject *co, int addrq)
|
||||
_PyCode_Addr2LineNoTstate(PyCodeObject *co, int addrq)
|
||||
{
|
||||
if (addrq < 0) {
|
||||
return co->co_firstlineno;
|
||||
|
|
@ -1020,6 +1020,16 @@ PyCode_Addr2Line(PyCodeObject *co, int addrq)
|
|||
return _PyCode_CheckLineNumber(addrq, &bounds);
|
||||
}
|
||||
|
||||
int
|
||||
PyCode_Addr2Line(PyCodeObject *co, int addrq)
|
||||
{
|
||||
int lineno;
|
||||
Py_BEGIN_CRITICAL_SECTION(co);
|
||||
lineno = _PyCode_Addr2LineNoTstate(co, addrq);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
return lineno;
|
||||
}
|
||||
|
||||
void
|
||||
_PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue