mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
bpo-43933: Show frame.f_lineno as None, rather than -1, if there is no line number. (GH-25717)
This commit is contained in:
parent
2fd928c8c1
commit
088a15c49d
3 changed files with 20 additions and 2 deletions
|
@ -53,7 +53,13 @@ PyFrame_GetLineNumber(PyFrameObject *f)
|
|||
static PyObject *
|
||||
frame_getlineno(PyFrameObject *f, void *closure)
|
||||
{
|
||||
return PyLong_FromLong(PyFrame_GetLineNumber(f));
|
||||
int lineno = PyFrame_GetLineNumber(f);
|
||||
if (lineno < 0) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
else {
|
||||
return PyLong_FromLong(lineno);
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue