49 Commits

Author SHA1 Message Date
Matthias Klose
c1a97ef731 - Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)). 2004-08-15 17:16:25 +00:00
Andrew M. Kuchling
832166025a [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. 2004-06-05 14:14:49 +00:00
Tim Peters
478c10554b Whitespace normalization. 2003-06-29 05:46:54 +00:00
Jeremy Hylton
ab91902f6f A bit o' reformatting and removal of non-_getframe currentframe(). 2003-06-27 18:41:20 +00:00
Jeremy Hylton
6496788e7a Fix for SF bug 620190: getargspec() doesn't work with methods. 2003-06-27 18:14:39 +00:00
Brett Cannon
4a671fe634 Return None to signal that the module the object was defined in was not found when object has no __name__ attr but is needed to figure out location of object. 2003-06-15 22:33:28 +00:00
Martin v. Löwis
e59e2bab8f Patch #711902: Cause pydoc to show data descriptor __doc__ strings. 2003-05-03 09:09:02 +00:00
Ka-Ping Yee
b38bbbd387 Make module lookup a little more robust (certain kinds of fiddling to
sys.modules previously produced an exception).
2003-03-28 16:29:50 +00:00
Raymond Hettinger
2e7b748a9e SF patch #634557: inspect.BlockFinder didn't do a good enough job finding
the end of code blocks.

Patch contributed by Patrick O'Brien.
2003-01-19 13:21:20 +00:00
Raymond Hettinger
2d375f78a5 SF bug #661184: inspect.getsource bug
inspect.getsource would crash with one line definitions like:
   def f(x): return x
or
   f = lambda x: x
2003-01-14 02:19:36 +00:00
Ka-Ping Yee
a59ef7bbe0 getdoc():
Remove leading whitespace from first line; remove leading and
    trailing blank lines from docstrings.  (Patch 645938 submitted
    by David Goodger.)
2002-11-30 03:53:15 +00:00
Michael W. Hudson
dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Martin v. Löwis
09776b7afd Add encoding declaration. 2002-08-04 17:22:59 +00:00
Raymond Hettinger
e0d4972acc Replaced .keys() with dictionary iterators 2002-06-02 18:55:56 +00:00
Raymond Hettinger
54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Raymond Hettinger
936654bce0 Replaced boolean test with is None 2002-06-01 03:06:31 +00:00
Michael W. Hudson
755f75eef8 Use types.StringTypes instead of explicit (str, unicode) list 2002-05-20 17:29:46 +00:00
Fred Drake
d451ec1cdb Clean up uses of some deprecated features.
Reported by Neal Norwitz on python-dev.
2002-04-26 02:29:55 +00:00
Jeremy Hylton
b4c17c8992 Fix getcomments() so that it doesn't fail with TypeErrors.
It appears that getcomments() can get called for classes defined in
C.  Since these don't have source code, it can't do anything useful.
A function buried many levels deep was raising a TypeError that was
not caught.

Who knows why this broke...
2002-03-28 23:01:56 +00:00
Skip Montanaro
a959a36288 tighten up unqualified except in currentframe()
see bug 411881
2002-03-25 21:37:54 +00:00
Neil Schemenauer
f06f8530f1 Use linecache for loading source code. Closes SF patch 490374. 2002-03-23 23:51:04 +00:00
Tim Peters
2400831773 SF patch 530070: pydoc regression, from Martin and Guido.
Change the way __doc__ is handled, to avoid blowing up on non-string
__doc__ values.
2002-03-17 18:56:20 +00:00
Neal Norwitz
8a11f5dc7b SF #515015, raise exception if code not found in findsource() 2002-03-13 03:14:26 +00:00
Guido van Rossum
687ae00460 Get rid of __defined__ and tp_defined -- there's no need to
distinguish __dict__ and __defined__ any more.  In the C structure,
tp_cache takes its place -- but this hasn't been implemented yet.
2001-10-15 22:03:32 +00:00
Tim Peters
13b49d3374 New function classify_class_attrs(). As a number of SF bug reports
point out, pydoc doesn't tell you where class attributes were defined,
gets several new 2.2 features wrong, and isn't aware of some new features
checked in on Thursday <wink>.  pydoc is hampered in part because
inspect.py has the same limitations.  Alas, I can't think of a way to
fix this within the current architecture of inspect/pydoc:  it's simply
not possible in 2.2 to figure out everything needed just from examining
the object you get back from class.attr.  You also need the class
context, and the method resolution order, and tests against various things
that simply didn't exist before.  OTOH, knowledge of how to do that is
getting quite complex, so doesn't belong in pydoc.

classify_class_attrs takes a different approach, analyzing all
the class attrs "at once", and returning the most interesting stuff for
each, all in one gulp.  pydoc needs to be reworked to use this for
classes (instead of the current "filter dir(class) umpteen times against
assorted predicates" approach).
2001-09-23 02:00:29 +00:00