-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-128481: Add missing documentation for traceback.FrameSummary.end_{col,line}
#128484
base: main
Are you sure you want to change the base?
Conversation
Doc/library/traceback.rst
Outdated
@@ -503,7 +503,7 @@ the module-level functions described above. | |||
A :class:`!FrameSummary` object represents a single :ref:`frame <frame-objects>` | |||
in a :ref:`traceback <traceback-objects>`. | |||
|
|||
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None) | |||
.. class:: FrameSummary(filename, lineno, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also an undocumented colno
parameter that goes before end_colno
. You can go ahead and document it too with this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, I made the order of arguments of documentation consistent with the order of code, and it would like this
` .. attribute:: FrameSummary.end_lineno
The last line number of the source code for this frame.
.. attribute:: FrameSummary.colno
The column number of the source code for this frame.
.. attribute:: FrameSummary.end_colno
The last column number of the source code for this frame.`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. class:: FrameSummary(filename, lineno, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=None)
This is an illegal prototype. end_lineno
cannot have a default None while name
has no default. In addition, lookup_line
are keyword-only:
def __init__(self, filename, lineno, name, *, lookup_line=True,
locals=None, line=None,
end_lineno=None, colno=None, end_colno=None):
Let's just copy the __init__
signature for the docs.
Doc/library/traceback.rst
Outdated
@@ -503,7 +503,7 @@ the module-level functions described above. | |||
A :class:`!FrameSummary` object represents a single :ref:`frame <frame-objects>` | |||
in a :ref:`traceback <traceback-objects>`. | |||
|
|||
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None) | |||
.. class:: FrameSummary(filename, lineno, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. class:: FrameSummary(filename, lineno, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=None)
This is an illegal prototype. end_lineno
cannot have a default None while name
has no default. In addition, lookup_line
are keyword-only:
def __init__(self, filename, lineno, name, *, lookup_line=True,
locals=None, line=None,
end_lineno=None, colno=None, end_colno=None):
Let's just copy the __init__
signature for the docs.
There is no description for the `
.. attribute:: FrameSummary.colno
.. attribute:: FrameSummary.end_colno
` |
No, I meant it cannot have a default value without |
Understood, I have fixed it with latest commit. |
Doc/library/traceback.rst
Outdated
@@ -503,7 +503,7 @@ the module-level functions described above. | |||
A :class:`!FrameSummary` object represents a single :ref:`frame <frame-objects>` | |||
in a :ref:`traceback <traceback-objects>`. | |||
|
|||
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None) | |||
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None) | |
.. class:: FrameSummary(filename, lineno, name, *,\ | |
lookup_line=True, locals=None,\ | |
line=None, end_lineno=None, colno=None, end_colno=None) |
Actually, the current (docs) signature as the code expect lookup_line
and remaining parameters to be keyword only so let's also fix that here.
@@ -539,6 +539,18 @@ in a :ref:`traceback <traceback-objects>`. | |||
trailing whitespace stripped. | |||
If the source is not available, it is ``None``. | |||
|
|||
.. attribute:: FrameSummary.end_lineno |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those new attributes can be None
I think (just check the source code first). If so, this should be specified. Also, it'd be good to say whether it's a 0-indexed or 1-indexed base (I always forget)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the code description, those new attributes can be None
that is right.
And those number
attributes are 1-indexed base I think.
According to #128481, add missing documentation for
end_lineno
,colno
andend_colno
.traceback.FrameSummary.end_{col,line}no
attributes #128481📚 Documentation preview 📚: https://cpython-previews--128484.org.readthedocs.build/en/128484/library/traceback.html#traceback.FrameSummary