-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-118465: Add __firstlineno__ attribute to class #118475
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
Changes from 2 commits
2d78936
2ac81ad
bc318a0
c168577
e557f02
3edda57
3939135
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,6 +280,11 @@ Other Language Changes | |
class scopes are not inlined into their parent scope. (Contributed by | ||
Jelle Zijlstra in :gh:`109118` and :gh:`118160`.) | ||
|
||
* Classes have a new :attr:`!__firstlineno__` attribute, | ||
populated by the compiler, with the line number of the first line | ||
of the class definition. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the class has decorators then I think this is the first line of the first decorator. Need a test for this case, and probably to mention in the doc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are existing tests, and they are passed. I'll add explicit mentioning of this fact, but AFAIK it was not specified for |
||
(Contributed by Serhiy Storchaka in :gh:`118465`.) | ||
|
||
|
||
New Modules | ||
=========== | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Compiler populates the new ``__firstlineno__`` field on a class with the | ||
line number of the first line of the class definition. |
Uh oh!
There was an error while loading. Please reload this page.