[New-bugs-announce] [issue24078] inspect.getsourcelines ignores context and returns wrong line #
Siming Yuan
report at bugs.python.org
Thu Apr 30 01:04:32 CEST 2015
New submission from Siming Yuan:
if the same class name is used within a module, but defined in different contexts (either class in class or class in function), inspect.getsourcelines() on the class object ignores the object context and only returns the first matched name.
reproduce:
a.py
----
class A(object):
class B(object):
pass
class C(object):
class B(object):
pass
------------------
>>> import inspect
>>> import a
>>> inspect.getsourcelines(a.C.B)
([' class B(object):\n', ' pass\n'], 2)
----------
components: Library (Lib)
messages: 242254
nosy: siyuan
priority: normal
severity: normal
status: open
title: inspect.getsourcelines ignores context and returns wrong line #
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24078>
_______________________________________
More information about the New-bugs-announce
mailing list