Commit graph

6 commits

Author SHA1 Message Date
Miss Islington (bot)
08738ce521
[3.14] gh-139783: Fix inspect.getsourcelines() for the case when a decorator is followed by a comment or an empty line (GH-139836) (GH-139889)
(cherry picked from commit f4104f5d74)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-10 08:18:32 +00:00
Miss Islington (bot)
ed9c0c3cbe
[3.14] gh-137477: Fix inspect.getblock() for generator expressions (GH-137488) (#137993)
gh-137477: Fix inspect.getblock() for generator expressions (GH-137488)

This fixes also inspect.getsourcelines() and inspect.getsource().
(cherry picked from commit eae9d7de1c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:48:40 +02:00
Serhiy Storchaka
69a4063ca5
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.
2024-09-28 20:51:49 +03:00
Serhiy Storchaka
f88c14d412
gh-122981: Fix inspect.getsource() for generated classes with Python base classes (GH-123001)
Look up __firstlineno__ only in the class' dict, without searching in
base classes.
2024-08-20 20:10:15 +03:00
Tian Gao
d16c9d1278
gh-116987: Support class code objects in inspect.findsource() (GH-117025) 2024-03-21 10:30:10 +00:00
Nikita Sobolev
732532b0af
gh-108303: Move all inspect test files to test_inspect/ (#109607) 2023-10-10 22:15:11 +02:00
Renamed from Lib/test/inspect_fodder2.py (Browse further)