Skip to content

Commit 8a01fd7

Browse files
iritkatrielEclips4encukouJelleZijlstra
authored
gh-115775: Add whatsnew entry about __static_attributes__ (GH-117909)
Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent 5d54436 commit 8a01fd7

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5542,6 +5542,13 @@ types, where they are relevant. Some of these are not reported by the
55425542
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>]
55435543

55445544

5545+
.. attribute:: class.__static_attributes__
5546+
5547+
A tuple containing names of attributes of this class which are accessed
5548+
through ``self.X`` from any function in its body.
5549+
5550+
.. versionadded:: 3.13
5551+
55455552
.. _int_max_str_digits:
55465553

55475554
Integer string conversion length limitation

Doc/reference/datamodel.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,7 @@ A class object can be called (see above) to yield a class instance (see below).
970970
single: __doc__ (class attribute)
971971
single: __annotations__ (class attribute)
972972
single: __type_params__ (class attribute)
973+
single: __static_attributes__ (class attribute)
973974

974975
Special attributes:
975976

@@ -1000,6 +1001,10 @@ Special attributes:
10001001
A tuple containing the :ref:`type parameters <type-params>` of
10011002
a :ref:`generic class <generic-classes>`.
10021003

1004+
:attr:`~class.__static_attributes__`
1005+
A tuple containing names of attributes of this class which are accessed
1006+
through ``self.X`` from any function in its body.
1007+
10031008

10041009
Class instances
10051010
---------------

Doc/whatsnew/3.13.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ Improved Error Messages
115115
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
116116
TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'?
117117

118+
* Classes have a new :attr:`~class.__static_attributes__` attribute, populated by the compiler,
119+
with a tuple of names of attributes of this class which are accessed
120+
through ``self.X`` from any function in its body. (Contributed by Irit Katriel
121+
in :gh:`115775`.)
122+
118123
Incremental Garbage Collection
119124
------------------------------
120125

0 commit comments

Comments
 (0)