Mark Dickinson
3a7946ff35
Merged revisions 74285 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74285 | mark.dickinson | 2009-08-02 16:40:11 +0100 (Sun, 02 Aug 2009) | 3 lines
Issue #6619 : Remove duplicate 'isgenerator' function from inspect module.
Thanks Vincent Legoll.
........
2009-08-02 15:41:08 +00:00
Michael Foord
133ebff5c8
Issue 6581. Michael Foord
2009-07-26 21:11:42 +00:00
Georg Brandl
47fe9817f1
Merged revisions 67952-67953,67955,67957-67958,67960-67961,67963,67965,67967,67970-67971,67973,67982,67988,67990,67995,68014,68016,68030,68057,68061,68112,68115-68118,68120-68121,68123-68128 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67952 | georg.brandl | 2008-12-27 18:42:40 +0100 (Sat, 27 Dec 2008) | 2 lines
#4752 : actually use custom handler in example.
........
r67953 | georg.brandl | 2008-12-27 19:20:04 +0100 (Sat, 27 Dec 2008) | 3 lines
Patch #4739 by David Laban: add symbols to pydoc help topics,
so that ``help('@')`` works as expected.
........
r67955 | georg.brandl | 2008-12-27 19:27:53 +0100 (Sat, 27 Dec 2008) | 3 lines
Follow-up to r67746 in order to restore backwards-compatibility for
those who (monkey-)patch TextWrapper.wordsep_re with a custom RE.
........
r67957 | georg.brandl | 2008-12-27 19:49:19 +0100 (Sat, 27 Dec 2008) | 2 lines
#4754 : improve winsound documentation.
........
r67958 | georg.brandl | 2008-12-27 20:02:59 +0100 (Sat, 27 Dec 2008) | 2 lines
#4682 : 'b' is actually unsigned char.
........
r67960 | georg.brandl | 2008-12-27 20:04:44 +0100 (Sat, 27 Dec 2008) | 2 lines
#4695 : fix backslashery.
........
r67961 | georg.brandl | 2008-12-27 20:06:04 +0100 (Sat, 27 Dec 2008) | 2 lines
Use :samp: role.
........
r67963 | georg.brandl | 2008-12-27 20:11:15 +0100 (Sat, 27 Dec 2008) | 2 lines
#4671 : document that pydoc imports modules.
........
r67965 | antoine.pitrou | 2008-12-27 21:34:52 +0100 (Sat, 27 Dec 2008) | 3 lines
Issue #4677 : add two list comprehension tests to pybench.
........
r67967 | benjamin.peterson | 2008-12-27 23:18:58 +0100 (Sat, 27 Dec 2008) | 1 line
fix markup
........
r67970 | alexandre.vassalotti | 2008-12-28 02:52:58 +0100 (Sun, 28 Dec 2008) | 2 lines
Fix name mangling of PyUnicode_ClearFreeList.
........
r67971 | alexandre.vassalotti | 2008-12-28 03:10:35 +0100 (Sun, 28 Dec 2008) | 2 lines
Sort UCS-2/UCS-4 name mangling list.
........
r67973 | alexandre.vassalotti | 2008-12-28 03:58:22 +0100 (Sun, 28 Dec 2008) | 2 lines
Document Py_VaBuildValue.
........
r67982 | benjamin.peterson | 2008-12-28 16:37:31 +0100 (Sun, 28 Dec 2008) | 1 line
fix WORD_BIGEDIAN declaration in Universal builds; fixes #4060 and #4728
........
r67988 | ronald.oussoren | 2008-12-28 20:40:56 +0100 (Sun, 28 Dec 2008) | 1 line
Issue4064: architecture string for universal builds on OSX
........
r67990 | ronald.oussoren | 2008-12-28 20:50:40 +0100 (Sun, 28 Dec 2008) | 3 lines
Update the fix for issue4064 to deal correctly with all three variants of
universal builds that are presented by the configure script.
........
r67995 | benjamin.peterson | 2008-12-28 22:16:07 +0100 (Sun, 28 Dec 2008) | 1 line
#4763 PyErr_ExceptionMatches won't blow up with NULL arguments
........
r68014 | benjamin.peterson | 2008-12-29 18:47:42 +0100 (Mon, 29 Dec 2008) | 1 line
#4764 set IOError.filename when trying to open a directory on POSIX platforms
........
r68016 | benjamin.peterson | 2008-12-29 18:56:58 +0100 (Mon, 29 Dec 2008) | 1 line
#4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms
........
r68030 | benjamin.peterson | 2008-12-29 22:38:14 +0100 (Mon, 29 Dec 2008) | 1 line
fix French
........
r68057 | vinay.sajip | 2008-12-30 08:01:25 +0100 (Tue, 30 Dec 2008) | 1 line
Minor documentation change relating to NullHandler.
........
r68061 | georg.brandl | 2008-12-30 11:15:49 +0100 (Tue, 30 Dec 2008) | 2 lines
#4778 : attributes can't be called.
........
r68112 | benjamin.peterson | 2009-01-01 00:48:39 +0100 (Thu, 01 Jan 2009) | 1 line
#4795 inspect.isgeneratorfunction() should return False instead of None
........
r68115 | benjamin.peterson | 2009-01-01 05:04:41 +0100 (Thu, 01 Jan 2009) | 1 line
simplfy code
........
r68116 | georg.brandl | 2009-01-01 12:46:51 +0100 (Thu, 01 Jan 2009) | 2 lines
#4100 : note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 12:53:55 +0100 (Thu, 01 Jan 2009) | 2 lines
#4156 : make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 13:00:19 +0100 (Thu, 01 Jan 2009) | 2 lines
#4185 : clarify escape behavior of replacement strings.
........
r68120 | georg.brandl | 2009-01-01 13:15:31 +0100 (Thu, 01 Jan 2009) | 4 lines
#4228 : Pack negative values the same way as 2.4
in struct's L format.
........
r68121 | georg.brandl | 2009-01-01 13:43:33 +0100 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 13:52:29 +0100 (Thu, 01 Jan 2009) | 2 lines
#4784 : ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 13:53:19 +0100 (Thu, 01 Jan 2009) | 2 lines
#4782 : Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 14:02:09 +0100 (Thu, 01 Jan 2009) | 2 lines
#4776 : add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 14:05:13 +0100 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 14:14:49 +0100 (Thu, 01 Jan 2009) | 2 lines
#4767 : Use correct submodules for all MIME classes.
........
r68128 | antoine.pitrou | 2009-01-01 15:11:22 +0100 (Thu, 01 Jan 2009) | 3 lines
Issue #3680 : Reference cycles created through a dict, set or deque iterator did not get collected.
........
2009-01-01 15:46:10 +00:00
Benjamin Peterson
3e80861cb7
Merged revisions 66995-66996 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66995 | benjamin.peterson | 2008-10-21 17:18:29 -0500 (Tue, 21 Oct 2008) | 1 line
return ArgInfo from inspect.getargvalues #4092
........
r66996 | benjamin.peterson | 2008-10-21 17:20:31 -0500 (Tue, 21 Oct 2008) | 1 line
add NEWs note for last change
........
2008-10-21 22:28:54 +00:00
Brett Cannon
7b96f07feb
Remove an unneeded import of abc.ABCMeta from 'inspect'.
2008-08-18 00:41:11 +00:00
Brett Cannon
f5eb2ff100
Silence (Syntax|Deprecation)Warning for 'inspect'. Had to remove tuple
...
unpacking in a parameter list and set some constants by hand that were pulled
from the 'compiler' package.
2008-08-01 01:40:24 +00:00
Georg Brandl
7be19aabe2
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
...
to ease standalone use of the algorithm.
2008-06-07 15:59:10 +00:00
Amaury Forgeot d'Arc
24f3c5c646
Prevent an error when inspect.isabstract() is called with something else than a new-style class.
2008-04-08 21:51:57 +00:00
Christian Heimes
608c1d8e87
Since abc._Abstract was replaces by a new type flags the regression test 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?
2008-03-03 18:28:04 +00:00
Facundo Batista
759bfc6207
Issue #1916 . Added isgenerator() and isgeneratorfunction() to
...
inspect.py. Thanks Javi Mansilla for patch review and
corrections.
2008-02-18 03:43:43 +00:00
Raymond Hettinger
e896acc98c
Let most inspect functions return named tuples
2008-01-11 03:04:50 +00:00
Georg Brandl
bc5fbd9f8c
Patch #1739696 : use code.co_code only if really necessary
2007-07-12 08:11:29 +00:00
Georg Brandl
b2e81e307d
Bug #1550524 : better heuristics to find correct class definition
...
in inspect.findsource().
2006-10-12 09:20:33 +00:00
Nick Coghlan
c495c66ea9
Fix the speed regression in inspect.py by adding another cache to speed up getmodule(). Patch #1553314
2006-09-07 10:50:34 +00:00
Tim Peters
ce70a3b306
Whitespace normalization.
2006-07-27 23:45:48 +00:00
Barry Warsaw
00decd7835
Patch #1520294 : Support for getset and member descriptors in types.py,
...
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.
2006-07-27 23:43:15 +00:00
Phillip J. Eby
1a2959cfa8
Fix SF#1516184 (again) and add a test to prevent regression.
...
(There was a problem with empty filenames still causing recursion)
2006-07-20 15:54:16 +00:00
Phillip J. Eby
5d86bdb3ae
Fix SF#1516184 and add a test to prevent regression.
2006-07-10 19:03:29 +00:00
Georg Brandl
208badda27
Fix another problem in inspect: if the module for an object cannot be found, don't try to give its __dict__ to linecache.
2006-04-30 17:42:26 +00:00
Phillip J. Eby
72ae6c80d4
Fix infinite regress when inspecting <string> or <stdin> frames.
2006-04-30 15:59:26 +00:00
Neal Norwitz
b94a368ff4
Add whitespace after comma
2006-04-11 07:17:08 +00:00
Phillip J. Eby
4703211080
Updated the warnings, linecache, inspect, traceback, site, and doctest modules
...
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects. Tests and doc updates are included.
2006-04-11 01:07:43 +00:00
Armin Rigo
dd5c023af5
some more fixes and tests for inspect.getsource(), triggered by crashes
...
from the PyPy project as well as the SF bug #1295909 .
2005-09-25 11:45:45 +00:00
Johannes Gijsbers
a5855d5ace
Patch #1159931/bug #1143895 : inspect.getsource failed when functions,
...
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!
2005-03-12 16:37:11 +00:00
Raymond Hettinger
a1a992c0a0
Apply itemgetter() instead of lambda.
2005-03-11 06:46:45 +00:00
Raymond Hettinger
dbecd93b72
Replace list of constants with tuples of constants.
2005-02-06 06:57:08 +00:00
Johannes Gijsbers
1542f34c42
Patch #1011890 : fix inspect.getsource breaking with line-continuation &
...
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.
2004-12-12 16:46:28 +00:00
Raymond Hettinger
61656203cd
Import no longer needed.
2004-09-20 18:08:31 +00:00
Skip Montanaro
13dea5a42b
Raymond reminded me to use DSU key
2004-09-20 16:43:30 +00:00
Skip Montanaro
41f89a4f3d
Sort classes by fully qualified name. In the common case where you are
...
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.
2004-09-20 15:40:38 +00:00
Johannes Gijsbers
9324526a76
Use __module__ attribute when available instead of using isclass() predicate
...
(functions and methods have grown the __module__ attribute too). See bug #570300 .
2004-09-11 15:53:22 +00:00
Johannes Gijsbers
c473c99d16
Patch #1006219 : let inspect.getsource show '@' decorators and add tests for
...
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!
2004-08-18 12:40:31 +00:00
Matthias Klose
2e829c0214
- Bug #891637 , patch #1005466 : fix inspect.getargs() crash on def foo((bar)).
2004-08-15 17:04:33 +00:00
Brett Cannon
b3de2e13ba
'inspect' was not listing the functions in a module properly if the module was
...
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.
2004-08-13 18:46:24 +00:00
Raymond Hettinger
a050171ee9
SF bug #973092 : inspect.getframeinfo bug if 'context' is to big
...
Make sure the start argument is not negative.
2004-06-15 11:22:53 +00:00
Andrew M. Kuchling
ba8b6bc86f
[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:11:59 +00:00
Raymond Hettinger
3375fc5a3b
Apply extract functions instead of lambda.
2003-12-01 20:12:15 +00:00
Raymond Hettinger
6b59f5f3fd
Let library modules use the new keyword arguments for list.sort().
2003-10-16 05:53:16 +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