Bugs item #1550524, was opened at 2006-09-01 13:26
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1550524&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Ali Gholami Rudi (aligrudi)
>Assigned to: Georg Brandl (gbrandl)
Summary: inspect module and class startlineno

Initial Comment:
Inspect module fails to find the correct starting line
number of a class. ::

  import inspect

  def a_func():
      class AClass(object):
          pass

  class AClass(object):
      pass

  print inspect.findsource(AClass)[1]
  # the result should have been 7, but it is 4

After reading `inspect` module I realized that for
classes it does a
simple RE search to find their definition location. 
Apart from that I
think python does not seem to fully support classes
with the same name
in one module (nested classes that are defined in other
functions or
classes).  That is a `ClassType` only holds its module
and its name
and that is hardly enough for runtime analysis of objects.


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-10-12 09:21

Message:
Logged In: YES 
user_id=849994

Added a better find heuristics in rev.  52299, 52300 (2.5).
(More can't be done)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1550524&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to