mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
[3.13] gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613) (#124735)
* 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.
(cherry picked from commit 69a4063ca5)
This commit is contained in:
parent
ce0eaa6703
commit
5bf32d1300
11 changed files with 110 additions and 12 deletions
|
|
@ -1032,7 +1032,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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue