| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
than a new-style class.
|
|
|
|
| |
suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too?
|
|
|
|
|
| |
inspect.py. Thanks Javi Mansilla for patch review and
corrections.
|
| |
|
| |
|
|
|
|
| |
in inspect.findsource().
|
|
|
|
| |
getmodule(). Patch #1553314
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inspect.py, and pydoc.py. Specifically, this allows for querying the type of
an object against these built-in C types and more importantly, for getting
their docstrings printed in the interactive interpreter's help() function.
This patch includes a new built-in module called _types which provides
definitions of getset and member descriptors for use by the types.py module.
These types are exposed as types.GetSetDescriptorType and
types.MemberDescriptorType. Query functions are provided as
inspect.isgetsetdescriptor() and inspect.ismemberdescriptor(). The
implementations of these are robust enough to work with Python implementations
other than CPython, which may not have these fundamental types.
The patch also includes documentation and test suite updates.
I commit these changes now under these guiding principles:
1. Silence is assent. The release manager has not said "no", and of the few
people that cared enough to respond to the thread, the worst vote was "0".
2. It's easier to ask for forgiveness than permission.
3. It's so dang easy to revert stuff in svn, that you could view this as a
forcing function. :)
Windows build patches will follow.
|
|
|
|
| |
(There was a problem with empty filenames still causing recursion)
|
| |
|
|
|
|
| |
don't try to give its __dict__ to linecache.
|
| |
|
| |
|
|
|
|
|
| |
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects. Tests and doc updates are included.
|
|
|
|
| |
from the PyPy project as well as the SF bug #1295909.
|
|
|
|
|
|
| |
etc., had comments after the colon, and some other cases. This patch
take a simpler approach that doesn't rely on looking for a ':'. Thanks
Simon Percivall!
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
more. Thanks to Simon Percivall!
The patch makes changes to inspect.py in two places:
* the pattern to match against functions at line 436 is
modified: lambdas should be matched even if not
preceded by whitespace, as long as "lambda" isn't part
of another word.
* the BlockFinder class is heavily modified. Changes are:
- checking for "def", "class" or "lambda" names
before setting self.started to True. Then checking the
same line for word characters after the colon (if the
colon is on that line). If so, and the line does not
end with a line continuation marker, raise EndOfBlock
immediately.
- adding self.passline to show that the line is to be
included and no more checking is necessary on that
line. Since a NEWLINE token is not generated when a
line continuation marker exists, this allows getsource
to continue with these functions even if the following
line would not be indented.
Also add a bunch of
'quite-unlikely-to-occur-in-real-life-but-working-anyway' tests.
|
| |
|
| |
|
|
|
|
|
|
| |
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
|
| |
|