mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
gh-106727: Add __module__
check for inspect.getsource(cls)
(#106968)
This commit is contained in:
parent
8ebc9fc321
commit
b383703491
2 changed files with 30 additions and 1 deletions
|
@ -1078,7 +1078,8 @@ class _ClassFinder(ast.NodeVisitor):
|
|||
|
||||
# First, let's see if there are any method definitions
|
||||
for member in self.cls.__dict__.values():
|
||||
if isinstance(member, types.FunctionType):
|
||||
if (isinstance(member, types.FunctionType) and
|
||||
member.__module__ == self.cls.__module__):
|
||||
for lineno, end_lineno in self.lineno_found:
|
||||
if lineno <= member.__code__.co_firstlineno <= end_lineno:
|
||||
return lineno
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue