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 <rep...@bugs.python.org>
<http://bugs.python.org/issue24078>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to