summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* This is my patchMichael W. Hudson2002-08-151-13/+3
| | | | | | | | [ 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.
* Add encoding declaration.Martin v. Löwis2002-08-041-0/+1
|
* Replaced .keys() with dictionary iteratorsRaymond Hettinger2002-06-021-1/+1
|
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-4/+4
|
* Replaced boolean test with is NoneRaymond Hettinger2002-06-011-2/+2
|
* Use types.StringTypes instead of explicit (str, unicode) listMichael W. Hudson2002-05-201-1/+1
|
* Clean up uses of some deprecated features.Fred Drake2002-04-261-2/+2
| | | | Reported by Neal Norwitz on python-dev.
* Fix getcomments() so that it doesn't fail with TypeErrors.Jeremy Hylton2002-03-281-3/+8
| | | | | | | | | 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...
* tighten up unqualified except in currentframe()Skip Montanaro2002-03-251-2/+2
| | | | see bug 411881
* Use linecache for loading source code. Closes SF patch 490374.Neil Schemenauer2002-03-231-7/+5
|
* SF patch 530070: pydoc regression, from Martin and Guido.Tim Peters2002-03-171-2/+11
| | | | | Change the way __doc__ is handled, to avoid blowing up on non-string __doc__ values.
* SF #515015, raise exception if code not found in findsource()Neal Norwitz2002-03-131-0/+1
|
* Get rid of __defined__ and tp_defined -- there's no need toGuido van Rossum2001-10-151-16/+1
| | | | | distinguish __dict__ and __defined__ any more. In the C structure, tp_cache takes its place -- but this hasn't been implemented yet.
* New function classify_class_attrs(). As a number of SF bug reportsTim Peters2001-09-231-0/+85
| | | | | | | | | | | | | | | | | | | 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).
* Add a function to compute a class's method resolution order. This isTim Peters2001-09-221-0/+18
| | | | | | easy for 2.2 new-style classes, but trickier for classic classes, and different approaches are needed "depending". The function will allow later code to treat all flavors of classes uniformly.
* Ensure that isfunction(obj) and (the new) ismethoddescriptor(obj) neverTim Peters2001-09-201-5/+8
| | | | | both return true. This restores pydoc's ability to deduce argument lists for functions and methods coded in Python.
* After much thrashing, I believe this is a truly minimal patch to teachTim Peters2001-09-201-1/+21
| | | | | pydoc how to do something sensible with 2.2 descriptors. To see the difference, browse __builtin__ via pydoc before and after the patch.
* In a world with a growing number of subclassable types, replaceTim Peters2001-09-161-10/+8
| | | | | | | | type(x) is T tests with isinstance(x, T) Also got rid of a future-generators import, left over from code that wasn't intended to get checked in.
* The first batch of changes recommended by the fixdiv tool. These areGuido van Rossum2001-09-041-1/+1
| | | | | mostly changes of / operators into //. Once or twice I did more or less than recommended.
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+2
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* Turns out Neil didn't intend for *all* of his gen-branch work to getTim Peters2001-06-291-19/+23
| | | | | | | | | | | | | | | | | | | | committed. tokenize.py: I like these changes, and have tested them extensively without even realizing it, so I just updated the docstring and the docs. tabnanny.py: Also liked this, but did a little code fiddling. I should really rewrite this to *exploit* generators, but that's near the bottom of my effort/benefit scale so doubt I'll get to it anytime soon (it would be most useful as a non-trivial example of ideal use of generators; but test_generators.py has already grown plenty of food-for-thought examples). inspect.py: I'm sure Ping intended for this to continue running even under 1.5.2, so I reverted this to the last pre-gen-branch version. The "bugfix" I checked in in-between was actually repairing a bug *introduced* by the conversion to generators, so it's OK that the reverted version doesn't reflect that checkin.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-23/+19
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* Clean up isroutine().Ka-Ping Yee2001-04-131-2/+1
|
* Robustify getfile() against classes that lie about their __module__sKa-Ping Yee2001-04-131-1/+1
| | | | (such as the exceptions in _weakref and _locale!)
* Remove duplicate type objects from isroutine() and isbuiltin().Ka-Ping Yee2001-04-131-4/+4
| | | | Make getmodule() on a module return the module itself.
* Robustify getcomments() so it doesn't crash on empty files.Ka-Ping Yee2001-04-121-2/+2
|
* Add getmodulename() and getmoduleinfo() routines to inspect filenames.Ka-Ping Yee2001-04-101-0/+15
|
* Extend isclass() to work for extension classes (by looking for __bases__).Ka-Ping Yee2001-03-231-1/+1
|
* Don't have trace() skip the top frame; return them all.Ka-Ping Yee2001-03-231-1/+0
|
* Whitespace normalization.Tim Peters2001-03-161-2/+0
|
* Fix findsource() to work for derived classes.Ka-Ping Yee2001-03-101-5/+5
|
* Make getsourcefile() succeed even if the filename doesn't end in '.py' --Ka-Ping Yee2001-03-021-25/+29
| | | | | | | as long as the filename also doesn't end in a suffix that indicates a binary file (according to the flags in imp.get_suffixes()). Shrink try...except clauses and replace some of them with explicit checks.
* Clarify the purpose of getsourcefile().Ka-Ping Yee2001-03-021-12/+19
| | | | Add getabsfile() for getting a most-normalized path.
* When seeking the module for an object, compare absolute (not relative) paths.Ka-Ping Yee2001-03-021-3/+4
|
* Add __author__ variable.Ka-Ping Yee2001-03-011-2/+5
| | | | Robustify: don't rely on modules being present in sys.modules.
* Add getlineno() routine to account for LINENO optimization.Ka-Ping Yee2001-03-011-3/+19
|
* Whitespace normalization.Tim Peters2001-02-281-1/+1
|
* inspect: a module for getting information out of live Python objectsKa-Ping Yee2001-02-271-0/+616