]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes...
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 28 Sep 2024 17:51:49 +0000 (20:51 +0300)
committerGitHub <noreply@github.com>
Sat, 28 Sep 2024 17:51:49 +0000 (20:51 +0300)
commit69a4063ca516360b5eb96f5432ad9f9dfc32a72e
tree012b043ff525c2481d7cf891fcc82c7024d9f17e
parentdc12237ab092f0eee7ec5882196997804e635075
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.
Doc/reference/datamodel.rst
Lib/collections/abc.py
Lib/decimal.py
Lib/inspect.py
Lib/test/test_builtin.py
Lib/test/test_decimal.py
Lib/test/test_inspect/inspect_fodder2.py
Lib/test/test_inspect/test_inspect.py
Misc/NEWS.d/next/Core_and_Builtins/2024-09-02-20-36-45.gh-issue-123339.QcmpSs.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2024-09-02-20-34-04.gh-issue-123339.czgcSu.rst [new file with mode: 0644]
Objects/typeobject.c