summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-09-28 17:51:49 (GMT)
committerGitHub <noreply@github.com>2024-09-28 17:51:49 (GMT)
commit69a4063ca516360b5eb96f5432ad9f9dfc32a72e (patch)
tree012b043ff525c2481d7cf891fcc82c7024d9f17e /Doc
parentdc12237ab092f0eee7ec5882196997804e635075 (diff)
downloadcpython-69a4063ca516360b5eb96f5432ad9f9dfc32a72e.zip
cpython-69a4063ca516360b5eb96f5432ad9f9dfc32a72e.tar.gz
cpython-69a4063ca516360b5eb96f5432ad9f9dfc32a72e.tar.bz2
gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613)
* Setting the __module__ attribute for a class now removes the __firstlineno__ item from the type's dict. * The _collections_abc and _pydecimal modules now completely replace the collections.abc and decimal modules after importing them. This allows to get the source of classes and functions defined in these modules. * inspect.findsource() now checks whether the first line number for a class is out of bound.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/reference/datamodel.rst5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 5ce6bf1..513199d 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1080,7 +1080,10 @@ Special attributes
.. versionadded:: 3.13
* - .. attribute:: type.__firstlineno__
- - The line number of the first line of the class definition, including decorators.
+ - The line number of the first line of the class definition,
+ including decorators.
+ Setting the :attr:`__module__` attribute removes the
+ :attr:`!__firstlineno__` item from the type's dictionary.
.. versionadded:: 3.13