summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-05-06 09:02:37 (GMT)
committerGitHub <noreply@github.com>2024-05-06 09:02:37 (GMT)
commit153b3f75306b5d26e29ea157105d0fdc247ef853 (patch)
treef73ede56af175d27698ef56bec21073f98889bbc /Doc/reference
parent716ec4bfcf1a564db9936122c442baa99f9c4a8c (diff)
downloadcpython-153b3f75306b5d26e29ea157105d0fdc247ef853.zip
cpython-153b3f75306b5d26e29ea157105d0fdc247ef853.tar.gz
cpython-153b3f75306b5d26e29ea157105d0fdc247ef853.tar.bz2
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.
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index f9438a1..f5e8716 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -971,6 +971,7 @@ A class object can be called (see above) to yield a class instance (see below).
single: __annotations__ (class attribute)
single: __type_params__ (class attribute)
single: __static_attributes__ (class attribute)
+ single: __firstlineno__ (class attribute)
Special attributes:
@@ -1005,6 +1006,9 @@ Special attributes:
A tuple containing names of attributes of this class which are accessed
through ``self.X`` from any function in its body.
+ :attr:`__firstlineno__`
+ The line number of the first line of the class definition, including decorators.
+
Class instances
---------------