mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)
Add frame_nslots() to factorize duplicate code.
This commit is contained in:
parent
521c8d6806
commit
6d86a2331e
7 changed files with 45 additions and 48 deletions
|
@ -5580,9 +5580,10 @@ dtrace_function_entry(PyFrameObject *f)
|
|||
const char *funcname;
|
||||
int lineno;
|
||||
|
||||
filename = PyUnicode_AsUTF8(f->f_code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
|
||||
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
|
||||
PyCodeObject *code = f->f_code;
|
||||
filename = PyUnicode_AsUTF8(code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(code->co_name);
|
||||
lineno = PyCode_Addr2Line(code, f->f_lasti);
|
||||
|
||||
PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno);
|
||||
}
|
||||
|
@ -5594,9 +5595,10 @@ dtrace_function_return(PyFrameObject *f)
|
|||
const char *funcname;
|
||||
int lineno;
|
||||
|
||||
filename = PyUnicode_AsUTF8(f->f_code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
|
||||
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
|
||||
PyCodeObject *code = f->f_code;
|
||||
filename = PyUnicode_AsUTF8(code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(code->co_name);
|
||||
lineno = PyCode_Addr2Line(code, f->f_lasti);
|
||||
|
||||
PyDTrace_FUNCTION_RETURN(filename, funcname, lineno);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue