| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
displaying a set of classes from one module it doesn't matter, but if you
are displaying a large class tree from multiple modules it improves the
display to sort by module.name.
|
|
|
|
| |
(functions and methods have grown the __module__ attribute too). See bug #570300.
|
|
|
|
|
| |
this (which are rather ugly, but it'll have to do until test_inspect gets a
major overhaul and a conversion to unittest). Thanks Simon Percivall!
|
| |
|
|
|
|
|
|
|
|
| |
reached through a symlink (was comparing path of module to path to function and
were not matching because of the symlink). os.path.realpath() is now used to
solve this discrepency.
Closes bug #570300. Thanks Johannes Gijsbers for the fix.
|
|
|
|
| |
Make sure the start argument is not negative.
|
|
|
|
| |
line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
found when object has no __name__ attr but is needed to figure out location of object.
|
| |
|
|
|
|
| |
sys.modules previously produced an exception).
|
|
|
|
|
|
| |
the end of code blocks.
Patch contributed by Patrick O'Brien.
|
|
|
|
|
|
|
| |
inspect.getsource would crash with one line definitions like:
def f(x): return x
or
f = lambda x: x
|
|
|
|
|
|
| |
Remove leading whitespace from first line; remove leading and
trailing blank lines from docstrings. (Patch 645938 submitted
by David Goodger.)
|
|
|
|
|
|
|
|
| |
[ 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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Reported by Neal Norwitz on python-dev.
|
|
|
|
|
|
|
|
|
| |
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...
|
|
|
|
| |
see bug 411881
|
| |
|
|
|
|
|
| |
Change the way __doc__ is handled, to avoid blowing up on non-string
__doc__ values.
|
| |
|
|
|
|
|
| |
distinguish __dict__ and __defined__ any more. In the C structure,
tp_cache takes its place -- but this hasn't been implemented yet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
both return true. This restores pydoc's ability to deduce argument lists
for functions and methods coded in Python.
|
|
|
|
|
| |
pydoc how to do something sensible with 2.2 descriptors. To see the
difference, browse __builtin__ via pydoc before and after the patch.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
mostly changes of / operators into //. Once or twice I did more or
less than recommended.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Bugfix candidate in inspect.py: it was referencing "self" outside of
a method.
|
| |
|
|
|
|
| |
(such as the exceptions in _weakref and _locale!)
|
|
|
|
| |
Make getmodule() on a module return the module itself.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|