gh-118465: Add __firstlineno__ attribute to class (GH-118475)

It is set by compiler with the line number of the first line of
the class definition.
This commit is contained in:
Serhiy Storchaka 2024-05-06 12:02:37 +03:00 committed by GitHub
parent 716ec4bfcf
commit 153b3f7530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 61 additions and 89 deletions

View file

@ -326,7 +326,7 @@ def visiblename(name, all=None, obj=None):
'__date__', '__doc__', '__file__', '__spec__',
'__loader__', '__module__', '__name__', '__package__',
'__path__', '__qualname__', '__slots__', '__version__',
'__static_attributes__'}:
'__static_attributes__', '__firstlineno__'}:
return 0
# Private names are hidden, but special names are displayed.
if name.startswith('__') and name.endswith('__'): return 1