2007-08-15 11:28:22 -03:00
|
|
|
:mod:`inspect` --- Inspect live objects
|
|
|
|
=======================================
|
|
|
|
|
|
|
|
.. module:: inspect
|
|
|
|
:synopsis: Extract information and source code from live objects.
|
|
|
|
.. moduleauthor:: Ka-Ping Yee <ping@lfw.org>
|
|
|
|
.. sectionauthor:: Ka-Ping Yee <ping@lfw.org>
|
|
|
|
|
2011-01-27 16:38:46 -04:00
|
|
|
**Source code:** :source:`Lib/inspect.py`
|
|
|
|
|
|
|
|
--------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
The :mod:`inspect` module provides several useful functions to help get
|
|
|
|
information about live objects such as modules, classes, methods, functions,
|
|
|
|
tracebacks, frame objects, and code objects. For example, it can help you
|
|
|
|
examine the contents of a class, retrieve the source code of a method, extract
|
|
|
|
and format the argument list for a function, or get all the information you need
|
|
|
|
to display a detailed traceback.
|
|
|
|
|
|
|
|
There are four main kinds of services provided by this module: type checking,
|
|
|
|
getting source code, inspecting classes and functions, and examining the
|
|
|
|
interpreter stack.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inspect-types:
|
|
|
|
|
|
|
|
Types and members
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
The :func:`getmembers` function retrieves the members of an object such as a
|
Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61209 | georg.brandl | 2008-03-03 21:37:55 +0100 (Mon, 03 Mar 2008) | 2 lines
There are now sixteen isfoo functions.
........
r61210 | georg.brandl | 2008-03-03 21:39:00 +0100 (Mon, 03 Mar 2008) | 2 lines
15 -> 16, the 2nd
........
r61211 | georg.brandl | 2008-03-03 22:22:47 +0100 (Mon, 03 Mar 2008) | 2 lines
Actually import itertools.
........
r61212 | georg.brandl | 2008-03-03 22:31:50 +0100 (Mon, 03 Mar 2008) | 2 lines
Expand a bit on genexp scopes.
........
r61213 | raymond.hettinger | 2008-03-03 23:04:55 +0100 (Mon, 03 Mar 2008) | 1 line
Remove dependency on itertools -- a simple genexp suffices.
........
r61214 | raymond.hettinger | 2008-03-03 23:19:58 +0100 (Mon, 03 Mar 2008) | 1 line
Issue 2226: Callable checked for the wrong abstract method.
........
r61217 | andrew.kuchling | 2008-03-04 01:40:32 +0100 (Tue, 04 Mar 2008) | 1 line
Typo fix
........
r61218 | andrew.kuchling | 2008-03-04 02:30:10 +0100 (Tue, 04 Mar 2008) | 1 line
Grammar fix; markup fix
........
r61219 | andrew.kuchling | 2008-03-04 02:47:38 +0100 (Tue, 04 Mar 2008) | 1 line
Fix sentence fragment
........
r61220 | andrew.kuchling | 2008-03-04 02:48:26 +0100 (Tue, 04 Mar 2008) | 1 line
Typo fix
........
r61221 | andrew.kuchling | 2008-03-04 02:49:37 +0100 (Tue, 04 Mar 2008) | 1 line
Add versionadded tags
........
r61222 | andrew.kuchling | 2008-03-04 02:50:32 +0100 (Tue, 04 Mar 2008) | 1 line
Thesis night results: add various items
........
r61224 | raymond.hettinger | 2008-03-04 05:17:08 +0100 (Tue, 04 Mar 2008) | 1 line
Beef-up docs and tests for itertools. Fix-up end-case for product().
........
r61225 | georg.brandl | 2008-03-04 08:25:54 +0100 (Tue, 04 Mar 2008) | 2 lines
Fix some patch attributions.
........
r61226 | georg.brandl | 2008-03-04 08:33:30 +0100 (Tue, 04 Mar 2008) | 2 lines
#2230: document that PyArg_* leaves addresses alone on error.
........
r61233 | neal.norwitz | 2008-03-04 17:22:46 +0100 (Tue, 04 Mar 2008) | 3 lines
Close the file before trying to remove the directory so it works on Windows.
As reported by Trent Nelson on python-dev.
........
r61234 | thomas.heller | 2008-03-04 21:09:11 +0100 (Tue, 04 Mar 2008) | 9 lines
Merged changes from libffi3-branch.
The bundled libffi copy is now in sync with the recently released
libffi3.0.4 version, apart from some small changes to
Modules/_ctypes/libffi/configure.ac.
I gave up on using libffi3 files on os x.
Instead, static configuration with files from pyobjc is used.
........
r61235 | thomas.heller | 2008-03-04 21:21:42 +0100 (Tue, 04 Mar 2008) | 1 line
Try to fix the build for PY_LINUX.
........
r61236 | fred.drake | 2008-03-04 22:14:04 +0100 (Tue, 04 Mar 2008) | 2 lines
fix typo
........
r61237 | raymond.hettinger | 2008-03-04 23:29:44 +0100 (Tue, 04 Mar 2008) | 1 line
Fix refleak in chain().
........
2008-03-04 19:39:23 -04:00
|
|
|
class or module. The sixteen functions whose names begin with "is" are mainly
|
2007-08-15 11:28:22 -03:00
|
|
|
provided as convenient choices for the second argument to :func:`getmembers`.
|
|
|
|
They also help you determine when you can expect to find the following special
|
|
|
|
attributes:
|
|
|
|
|
2007-09-01 10:51:09 -03:00
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| Type | Attribute | Description |
|
|
|
|
+===========+=================+===========================+
|
|
|
|
| module | __doc__ | documentation string |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __file__ | filename (missing for |
|
|
|
|
| | | built-in modules) |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| class | __doc__ | documentation string |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2015-05-30 14:53:49 -03:00
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | class was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-09-01 10:51:09 -03:00
|
|
|
| | __module__ | name of module in which |
|
|
|
|
| | | this class was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| method | __doc__ | documentation string |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | method was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2015-05-30 14:53:49 -03:00
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-11-27 06:40:20 -04:00
|
|
|
| | __func__ | function object |
|
2007-09-01 10:51:09 -03:00
|
|
|
| | | containing implementation |
|
|
|
|
| | | of method |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-11-27 06:40:20 -04:00
|
|
|
| | __self__ | instance to which this |
|
2007-09-01 10:51:09 -03:00
|
|
|
| | | method is bound, or |
|
|
|
|
| | | ``None`` |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| function | __doc__ | documentation string |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | function was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2015-05-30 14:53:49 -03:00
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-09-01 10:51:09 -03:00
|
|
|
| | __code__ | code object containing |
|
|
|
|
| | | compiled function |
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
| | | :term:`bytecode` |
|
2007-09-01 10:51:09 -03:00
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __defaults__ | tuple of any default |
|
2014-01-27 15:26:28 -04:00
|
|
|
| | | values for positional or |
|
|
|
|
| | | keyword parameters |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __kwdefaults__ | mapping of any default |
|
|
|
|
| | | values for keyword-only |
|
|
|
|
| | | parameters |
|
2007-09-01 10:51:09 -03:00
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __globals__ | global namespace in which |
|
|
|
|
| | | this function was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| traceback | tb_frame | frame object at this |
|
|
|
|
| | | level |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | tb_lasti | index of last attempted |
|
|
|
|
| | | instruction in bytecode |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | tb_lineno | current line number in |
|
|
|
|
| | | Python source code |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | tb_next | next inner traceback |
|
|
|
|
| | | object (called by this |
|
|
|
|
| | | level) |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| frame | f_back | next outer frame object |
|
|
|
|
| | | (this frame's caller) |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2010-02-06 14:46:57 -04:00
|
|
|
| | f_builtins | builtins namespace seen |
|
2007-09-01 10:51:09 -03:00
|
|
|
| | | by this frame |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_code | code object being |
|
|
|
|
| | | executed in this frame |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_globals | global namespace seen by |
|
|
|
|
| | | this frame |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_lasti | index of last attempted |
|
|
|
|
| | | instruction in bytecode |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_lineno | current line number in |
|
|
|
|
| | | Python source code |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_locals | local namespace seen by |
|
|
|
|
| | | this frame |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_restricted | 0 or 1 if frame is in |
|
|
|
|
| | | restricted execution mode |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | f_trace | tracing function for this |
|
|
|
|
| | | frame, or ``None`` |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| code | co_argcount | number of arguments (not |
|
|
|
|
| | | including \* or \*\* |
|
|
|
|
| | | args) |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_code | string of raw compiled |
|
|
|
|
| | | bytecode |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_consts | tuple of constants used |
|
|
|
|
| | | in the bytecode |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_filename | name of file in which |
|
|
|
|
| | | this code object was |
|
|
|
|
| | | created |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_firstlineno | number of first line in |
|
|
|
|
| | | Python source code |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_flags | bitmap: 1=optimized ``|`` |
|
|
|
|
| | | 2=newlocals ``|`` 4=\*arg |
|
|
|
|
| | | ``|`` 8=\*\*arg |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_lnotab | encoded mapping of line |
|
|
|
|
| | | numbers to bytecode |
|
|
|
|
| | | indices |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_name | name with which this code |
|
|
|
|
| | | object was defined |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_names | tuple of names of local |
|
|
|
|
| | | variables |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_nlocals | number of local variables |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_stacksize | virtual machine stack |
|
|
|
|
| | | space required |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | co_varnames | tuple of names of |
|
|
|
|
| | | arguments and local |
|
|
|
|
| | | variables |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2014-06-16 10:59:28 -03:00
|
|
|
| generator | __name__ | name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | gi_frame | frame |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | gi_running | is the generator running? |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | gi_code | code |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-09-01 10:51:09 -03:00
|
|
|
| builtin | __doc__ | documentation string |
|
|
|
|
+-----------+-----------------+---------------------------+
|
|
|
|
| | __name__ | original name of this |
|
|
|
|
| | | function or method |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2015-05-30 14:53:49 -03:00
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-09-01 10:51:09 -03:00
|
|
|
| | __self__ | instance to which a |
|
|
|
|
| | | method is bound, or |
|
|
|
|
| | | ``None`` |
|
|
|
|
+-----------+-----------------+---------------------------+
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-06-16 10:59:28 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
|
2014-06-16 11:25:22 -03:00
|
|
|
Add ``__qualname__`` attribute to generators. The ``__name__`` attribute of
|
|
|
|
generators is now set from the function name, instead of the code name, and
|
|
|
|
it can now be modified.
|
2014-06-16 10:59:28 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getmembers(object[, predicate])
|
|
|
|
|
|
|
|
Return all the members of an object in a list of (name, value) pairs sorted by
|
|
|
|
name. If the optional *predicate* argument is supplied, only members for which
|
|
|
|
the predicate returns a true value are included.
|
|
|
|
|
Merged revisions 59774-59783 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59774 | georg.brandl | 2008-01-06 16:41:50 +0100 (Sun, 06 Jan 2008) | 2 lines
#1501: document that 0**0 == 1.
........
r59775 | georg.brandl | 2008-01-06 16:48:20 +0100 (Sun, 06 Jan 2008) | 2 lines
#759525: document that dir() doesn't return metaclass attrs when given a class as arg.
........
r59776 | georg.brandl | 2008-01-06 16:55:26 +0100 (Sun, 06 Jan 2008) | 2 lines
#1615275: clarify return object types of different tempfile factories.
........
r59777 | georg.brandl | 2008-01-06 17:01:26 +0100 (Sun, 06 Jan 2008) | 2 lines
#1727024: document that Popen.returncode is set by Popen.poll/wait.
........
r59778 | georg.brandl | 2008-01-06 17:04:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1686390: add example for csv.Sniffer use.
........
r59779 | georg.brandl | 2008-01-06 17:12:39 +0100 (Sun, 06 Jan 2008) | 2 lines
#1559684: document that shutil.copy* doesn't copy all metadata on Posix and Windows too.
........
r59780 | georg.brandl | 2008-01-06 17:17:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1582: document __reversed__, patch by Mark Russell.
........
r59781 | georg.brandl | 2008-01-06 17:22:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1499: Document compile() exceptions.
........
r59782 | georg.brandl | 2008-01-06 17:49:50 +0100 (Sun, 06 Jan 2008) | 2 lines
#1325: Add docs and tests for zipimporter.archive and zipimporter.prefix.
........
2008-01-06 13:05:40 -04:00
|
|
|
.. note::
|
|
|
|
|
2013-10-18 04:27:39 -03:00
|
|
|
:func:`getmembers` will only return class attributes defined in the
|
|
|
|
metaclass when the argument is a class and those attributes have been
|
|
|
|
listed in the metaclass' custom :meth:`__dir__`.
|
Merged revisions 59774-59783 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59774 | georg.brandl | 2008-01-06 16:41:50 +0100 (Sun, 06 Jan 2008) | 2 lines
#1501: document that 0**0 == 1.
........
r59775 | georg.brandl | 2008-01-06 16:48:20 +0100 (Sun, 06 Jan 2008) | 2 lines
#759525: document that dir() doesn't return metaclass attrs when given a class as arg.
........
r59776 | georg.brandl | 2008-01-06 16:55:26 +0100 (Sun, 06 Jan 2008) | 2 lines
#1615275: clarify return object types of different tempfile factories.
........
r59777 | georg.brandl | 2008-01-06 17:01:26 +0100 (Sun, 06 Jan 2008) | 2 lines
#1727024: document that Popen.returncode is set by Popen.poll/wait.
........
r59778 | georg.brandl | 2008-01-06 17:04:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1686390: add example for csv.Sniffer use.
........
r59779 | georg.brandl | 2008-01-06 17:12:39 +0100 (Sun, 06 Jan 2008) | 2 lines
#1559684: document that shutil.copy* doesn't copy all metadata on Posix and Windows too.
........
r59780 | georg.brandl | 2008-01-06 17:17:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1582: document __reversed__, patch by Mark Russell.
........
r59781 | georg.brandl | 2008-01-06 17:22:56 +0100 (Sun, 06 Jan 2008) | 2 lines
#1499: Document compile() exceptions.
........
r59782 | georg.brandl | 2008-01-06 17:49:50 +0100 (Sun, 06 Jan 2008) | 2 lines
#1325: Add docs and tests for zipimporter.archive and zipimporter.prefix.
........
2008-01-06 13:05:40 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getmoduleinfo(path)
|
|
|
|
|
2011-01-06 05:23:56 -04:00
|
|
|
Returns a :term:`named tuple` ``ModuleInfo(name, suffix, mode, module_type)``
|
|
|
|
of values that describe how Python will interpret the file identified by
|
|
|
|
*path* if it is a module, or ``None`` if it would not be identified as a
|
|
|
|
module. In that tuple, *name* is the name of the module without the name of
|
|
|
|
any enclosing package, *suffix* is the trailing part of the file name (which
|
|
|
|
may not be a dot-delimited extension), *mode* is the :func:`open` mode that
|
|
|
|
would be used (``'r'`` or ``'rb'``), and *module_type* is an integer giving
|
|
|
|
the type of the module. *module_type* will have a value which can be
|
|
|
|
compared to the constants defined in the :mod:`imp` module; see the
|
|
|
|
documentation for that module for more information on module types.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-05-11 13:58:42 -03:00
|
|
|
.. deprecated:: 3.3
|
|
|
|
You may check the file path's suffix against the supported suffixes
|
|
|
|
listed in :mod:`importlib.machinery` to infer the same information.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getmodulename(path)
|
|
|
|
|
|
|
|
Return the name of the module named by the file *path*, without including the
|
2012-07-18 10:14:57 -03:00
|
|
|
names of enclosing packages. The file extension is checked against all of
|
|
|
|
the entries in :func:`importlib.machinery.all_suffixes`. If it matches,
|
|
|
|
the final path component is returned with the extension removed.
|
|
|
|
Otherwise, ``None`` is returned.
|
|
|
|
|
|
|
|
Note that this function *only* returns a meaningful name for actual
|
|
|
|
Python modules - paths that potentially refer to Python packages will
|
|
|
|
still return ``None``.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.3
|
|
|
|
This function is now based directly on :mod:`importlib` rather than the
|
|
|
|
deprecated :func:`getmoduleinfo`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: ismodule(object)
|
|
|
|
|
|
|
|
Return true if the object is a module.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isclass(object)
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
Return true if the object is a class, whether built-in or created in Python
|
|
|
|
code.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: ismethod(object)
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
Return true if the object is a bound method written in Python.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isfunction(object)
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
Return true if the object is a Python function, which includes functions
|
|
|
|
created by a :term:`lambda` expression.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60878,60880-60892,60894-60898 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60876 | georg.brandl | 2008-02-17 16:14:10 +0100 (Sun, 17 Feb 2008) | 2 lines
Fix function name.
........
r60877 | facundo.batista | 2008-02-17 17:21:13 +0100 (Sun, 17 Feb 2008) | 4 lines
Now we handle different the backup copy, because of security
issues regarding user/group and permissions. Fixes 1050828.
........
r60878 | facundo.batista | 2008-02-17 19:59:29 +0100 (Sun, 17 Feb 2008) | 4 lines
Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
........
r60882 | amaury.forgeotdarc | 2008-02-17 21:56:31 +0100 (Sun, 17 Feb 2008) | 5 lines
Compilation was broken on Windows since the introduction of Advanced String Formatting.
Only PCBuild (vs9) was really tested.
Changes for older compilers were done manually.
........
r60883 | georg.brandl | 2008-02-17 22:18:55 +0100 (Sun, 17 Feb 2008) | 2 lines
#2133: fix HTML color spec.
........
r60884 | facundo.batista | 2008-02-18 04:43:43 +0100 (Mon, 18 Feb 2008) | 5 lines
Issue #1916. Added isgenerator() and isgeneratorfunction() to
inspect.py. Thanks Javi Mansilla for patch review and
corrections.
........
r60885 | facundo.batista | 2008-02-18 13:48:43 +0100 (Mon, 18 Feb 2008) | 4 lines
Issue 1224. Now we support again the double slash in the URL.
Thanks Anthony Lenton.
........
r60887 | eric.smith | 2008-02-18 15:25:02 +0100 (Mon, 18 Feb 2008) | 1 line
Temporarily removed float tests. See issue 1600.
........
r60891 | kristjan.jonsson | 2008-02-18 18:40:47 +0100 (Mon, 18 Feb 2008) | 1 line
Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled.
........
2008-02-19 10:21:46 -04:00
|
|
|
.. function:: isgeneratorfunction(object)
|
|
|
|
|
|
|
|
Return true if the object is a Python generator function.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isgenerator(object)
|
|
|
|
|
|
|
|
Return true if the object is a generator.
|
|
|
|
|
|
|
|
|
2015-05-21 12:50:30 -03:00
|
|
|
.. function:: iscoroutinefunction(object)
|
|
|
|
|
2015-05-21 18:02:31 -03:00
|
|
|
Return true if the object is a :term:`coroutine function`.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
Coroutine functions are defined with an ``async def`` syntax,
|
|
|
|
or are generators decorated with :func:`types.coroutine`
|
|
|
|
or :func:`asyncio.coroutine`.
|
|
|
|
|
2015-05-21 18:02:31 -03:00
|
|
|
The function will return false for plain Python generator
|
2015-05-21 12:50:30 -03:00
|
|
|
functions.
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: iscoroutine(object)
|
|
|
|
|
2015-05-21 18:02:31 -03:00
|
|
|
Return true if the object is a :term:`coroutine`.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
Coroutines are results of calls of coroutine functions or
|
|
|
|
generator functions decorated with :func:`types.coroutine`
|
|
|
|
or :func:`asyncio.coroutine`.
|
|
|
|
|
|
|
|
The function will return false for plain python generators.
|
|
|
|
|
2015-05-21 18:02:31 -03:00
|
|
|
See also :class:`collections.abc.Coroutine`.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isawaitable(object)
|
|
|
|
|
|
|
|
Return true if the object can be used in :keyword:`await`
|
|
|
|
expression.
|
|
|
|
|
2015-05-21 18:02:31 -03:00
|
|
|
See also :class:`collections.abc.Awaitable`.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: istraceback(object)
|
|
|
|
|
|
|
|
Return true if the object is a traceback.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isframe(object)
|
|
|
|
|
|
|
|
Return true if the object is a frame.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: iscode(object)
|
|
|
|
|
|
|
|
Return true if the object is a code.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isbuiltin(object)
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
Return true if the object is a built-in function or a bound built-in method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isroutine(object)
|
|
|
|
|
|
|
|
Return true if the object is a user-defined or built-in function or method.
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
|
2008-03-03 15:18:51 -04:00
|
|
|
.. function:: isabstract(object)
|
|
|
|
|
|
|
|
Return true if the object is an abstract base class.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: ismethoddescriptor(object)
|
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
Return true if the object is a method descriptor, but not if
|
|
|
|
:func:`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin`
|
|
|
|
are true.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-05-12 15:05:20 -03:00
|
|
|
This, for example, is true of ``int.__add__``. An object passing this test
|
|
|
|
has a :attr:`__get__` attribute but not a :attr:`__set__` attribute, but
|
|
|
|
beyond that the set of attributes varies. :attr:`__name__` is usually
|
|
|
|
sensible, and :attr:`__doc__` often is.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
Methods implemented via descriptors that also pass one of the other tests
|
|
|
|
return false from the :func:`ismethoddescriptor` test, simply because the
|
|
|
|
other tests promise more -- you can, e.g., count on having the
|
2007-11-27 06:40:20 -04:00
|
|
|
:attr:`__func__` attribute (etc) when an object passes :func:`ismethod`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isdatadescriptor(object)
|
|
|
|
|
|
|
|
Return true if the object is a data descriptor.
|
|
|
|
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute.
|
|
|
|
Examples are properties (defined in Python), getsets, and members. The
|
|
|
|
latter two are defined in C and there are more specific tests available for
|
|
|
|
those types, which is robust across Python implementations. Typically, data
|
|
|
|
descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes
|
|
|
|
(properties, getsets, and members have both of these attributes), but this is
|
|
|
|
not guaranteed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isgetsetdescriptor(object)
|
|
|
|
|
|
|
|
Return true if the object is a getset descriptor.
|
|
|
|
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
.. impl-detail::
|
|
|
|
|
|
|
|
getsets are attributes defined in extension modules via
|
2010-10-06 07:11:56 -03:00
|
|
|
:c:type:`PyGetSetDef` structures. For Python implementations without such
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
types, this method will always return ``False``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: ismemberdescriptor(object)
|
|
|
|
|
|
|
|
Return true if the object is a member descriptor.
|
|
|
|
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
.. impl-detail::
|
|
|
|
|
|
|
|
Member descriptors are attributes defined in extension modules via
|
2010-10-06 07:11:56 -03:00
|
|
|
:c:type:`PyMemberDef` structures. For Python implementations without such
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
types, this method will always return ``False``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _inspect-source:
|
|
|
|
|
|
|
|
Retrieving source code
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
.. function:: getdoc(object)
|
|
|
|
|
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
|
|
|
Get the documentation string for an object, cleaned up with :func:`cleandoc`.
|
2015-04-03 16:38:53 -03:00
|
|
|
If the documentation string for an object is not provided and the object is
|
|
|
|
a class, a method, a property or a descriptor, retrieve the documentation
|
|
|
|
string from the inheritance hierarchy.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getcomments(object)
|
|
|
|
|
|
|
|
Return in a single string any lines of comments immediately preceding the
|
|
|
|
object's source code (for a class, function, or method), or at the top of the
|
|
|
|
Python source file (if the object is a module).
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getfile(object)
|
|
|
|
|
|
|
|
Return the name of the (text or binary) file in which an object was defined.
|
|
|
|
This will fail with a :exc:`TypeError` if the object is a built-in module,
|
|
|
|
class, or function.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getmodule(object)
|
|
|
|
|
|
|
|
Try to guess which module an object was defined in.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getsourcefile(object)
|
|
|
|
|
|
|
|
Return the name of the Python source file in which an object was defined. This
|
|
|
|
will fail with a :exc:`TypeError` if the object is a built-in module, class, or
|
|
|
|
function.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getsourcelines(object)
|
|
|
|
|
|
|
|
Return a list of source lines and starting line number for an object. The
|
|
|
|
argument may be a module, class, method, function, traceback, frame, or code
|
|
|
|
object. The source code is returned as a list of the lines corresponding to the
|
|
|
|
object and the line number indicates where in the original source file the first
|
2011-10-12 15:10:51 -03:00
|
|
|
line of code was found. An :exc:`OSError` is raised if the source code cannot
|
2007-08-15 11:28:22 -03:00
|
|
|
be retrieved.
|
|
|
|
|
2011-10-12 15:10:51 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
|
|
|
|
former.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getsource(object)
|
|
|
|
|
|
|
|
Return the text of the source code for an object. The argument may be a module,
|
|
|
|
class, method, function, traceback, frame, or code object. The source code is
|
2011-10-12 15:10:51 -03:00
|
|
|
returned as a single string. An :exc:`OSError` is raised if the source code
|
2007-08-15 11:28:22 -03:00
|
|
|
cannot be retrieved.
|
|
|
|
|
2011-10-12 15:10:51 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
|
|
|
|
former.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
|
|
|
.. function:: cleandoc(doc)
|
|
|
|
|
|
|
|
Clean up indentation from docstrings that are indented to line up with blocks
|
|
|
|
of code. Any whitespace that can be uniformly removed from the second line
|
|
|
|
onwards is removed. Also, all tabs are expanded to spaces.
|
|
|
|
|
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
.. _inspect-signature-object:
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Introspecting callables with the Signature object
|
|
|
|
-------------------------------------------------
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
The Signature object represents the call signature of a callable object and its
|
|
|
|
return annotation. To retrieve a Signature object, use the :func:`signature`
|
|
|
|
function.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2015-05-20 15:30:08 -03:00
|
|
|
.. function:: signature(callable, \*, follow_wrapped=True)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Return a :class:`Signature` object for the given ``callable``::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> from inspect import signature
|
|
|
|
>>> def foo(a, *, b:int, **kwargs):
|
|
|
|
... pass
|
|
|
|
|
|
|
|
>>> sig = signature(foo)
|
|
|
|
|
|
|
|
>>> str(sig)
|
|
|
|
'(a, *, b:int, **kwargs)'
|
|
|
|
|
|
|
|
>>> str(sig.parameters['b'])
|
|
|
|
'b:int'
|
|
|
|
|
|
|
|
>>> sig.parameters['b'].annotation
|
|
|
|
<class 'int'>
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Accepts a wide range of python callables, from plain functions and classes to
|
|
|
|
:func:`functools.partial` objects.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2014-01-24 10:17:25 -04:00
|
|
|
Raises :exc:`ValueError` if no signature can be provided, and
|
|
|
|
:exc:`TypeError` if that type of object is not supported.
|
|
|
|
|
2015-05-20 15:30:08 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
``follow_wrapped`` parameter. Pass ``False`` to get a signature of
|
|
|
|
``callable`` specifically (``callable.__wrapped__`` will not be used to
|
|
|
|
unwrap decorated callables.)
|
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
.. note::
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Some callables may not be introspectable in certain implementations of
|
2014-01-30 01:22:57 -04:00
|
|
|
Python. For example, in CPython, some built-in functions defined in
|
|
|
|
C provide no metadata about their arguments.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
|
2014-01-30 01:10:54 -04:00
|
|
|
.. class:: Signature(parameters=None, \*, return_annotation=Signature.empty)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
A Signature object represents the call signature of a function and its return
|
|
|
|
annotation. For each parameter accepted by the function it stores a
|
|
|
|
:class:`Parameter` object in its :attr:`parameters` collection.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2014-01-30 01:10:54 -04:00
|
|
|
The optional *parameters* argument is a sequence of :class:`Parameter`
|
|
|
|
objects, which is validated to check that there are no parameters with
|
|
|
|
duplicate names, and that the parameters are in the right order, i.e.
|
|
|
|
positional-only first, then positional-or-keyword, and that parameters with
|
|
|
|
defaults follow parameters without defaults.
|
|
|
|
|
|
|
|
The optional *return_annotation* argument, can be an arbitrary Python object,
|
|
|
|
is the "return" annotation of the callable.
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Signature objects are *immutable*. Use :meth:`Signature.replace` to make a
|
|
|
|
modified copy.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2014-03-29 14:24:14 -03:00
|
|
|
.. versionchanged:: 3.5
|
2014-04-08 12:46:50 -03:00
|
|
|
Signature objects are picklable and hashable.
|
2014-03-29 14:24:14 -03:00
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
.. attribute:: Signature.empty
|
|
|
|
|
|
|
|
A special class-level marker to specify absence of a return annotation.
|
|
|
|
|
|
|
|
.. attribute:: Signature.parameters
|
|
|
|
|
|
|
|
An ordered mapping of parameters' names to the corresponding
|
|
|
|
:class:`Parameter` objects.
|
|
|
|
|
|
|
|
.. attribute:: Signature.return_annotation
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
The "return" annotation for the callable. If the callable has no "return"
|
|
|
|
annotation, this attribute is set to :attr:`Signature.empty`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. method:: Signature.bind(*args, **kwargs)
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Create a mapping from positional and keyword arguments to parameters.
|
|
|
|
Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the
|
|
|
|
signature, or raises a :exc:`TypeError`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. method:: Signature.bind_partial(*args, **kwargs)
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Works the same way as :meth:`Signature.bind`, but allows the omission of
|
|
|
|
some required arguments (mimics :func:`functools.partial` behavior.)
|
|
|
|
Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the
|
|
|
|
passed arguments do not match the signature.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-09-14 00:35:09 -03:00
|
|
|
.. method:: Signature.replace(*[, parameters][, return_annotation])
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Create a new Signature instance based on the instance replace was invoked
|
|
|
|
on. It is possible to pass different ``parameters`` and/or
|
|
|
|
``return_annotation`` to override the corresponding properties of the base
|
|
|
|
signature. To remove return_annotation from the copied Signature, pass in
|
|
|
|
:attr:`Signature.empty`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
>>> def test(a, b):
|
|
|
|
... pass
|
|
|
|
>>> sig = signature(test)
|
|
|
|
>>> new_sig = sig.replace(return_annotation="new return anno")
|
|
|
|
>>> str(new_sig)
|
|
|
|
"(a, b) -> 'new return anno'"
|
|
|
|
|
2015-05-20 15:30:08 -03:00
|
|
|
.. classmethod:: Signature.from_callable(obj, \*, follow_wrapped=True)
|
2014-03-27 13:09:24 -03:00
|
|
|
|
|
|
|
Return a :class:`Signature` (or its subclass) object for a given callable
|
2015-05-20 15:30:08 -03:00
|
|
|
``obj``. Pass ``follow_wrapped=False`` to get a signature of ``obj``
|
|
|
|
without unwrapping its ``__wrapped__`` chain.
|
2014-03-27 13:09:24 -03:00
|
|
|
|
2015-05-20 15:30:08 -03:00
|
|
|
This method simplifies subclassing of :class:`Signature`::
|
2014-03-27 13:09:24 -03:00
|
|
|
|
|
|
|
class MySignature(Signature):
|
|
|
|
pass
|
|
|
|
sig = MySignature.from_callable(min)
|
|
|
|
assert isinstance(sig, MySignature)
|
|
|
|
|
2014-03-29 14:18:30 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2014-01-30 01:10:54 -04:00
|
|
|
.. class:: Parameter(name, kind, \*, default=Parameter.empty, annotation=Parameter.empty)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Parameter objects are *immutable*. Instead of modifying a Parameter object,
|
2012-08-13 11:10:28 -03:00
|
|
|
you can use :meth:`Parameter.replace` to create a modified copy.
|
|
|
|
|
2014-03-29 14:24:14 -03:00
|
|
|
.. versionchanged:: 3.5
|
2014-04-08 12:46:50 -03:00
|
|
|
Parameter objects are picklable and hashable.
|
2014-03-29 14:24:14 -03:00
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
.. attribute:: Parameter.empty
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
A special class-level marker to specify absence of default values and
|
|
|
|
annotations.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. attribute:: Parameter.name
|
|
|
|
|
2014-01-27 16:07:58 -04:00
|
|
|
The name of the parameter as a string. The name must be a valid
|
|
|
|
Python identifier.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. attribute:: Parameter.default
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
The default value for the parameter. If the parameter has no default
|
2012-08-13 11:10:28 -03:00
|
|
|
value, this attribute is set to :attr:`Parameter.empty`.
|
|
|
|
|
|
|
|
.. attribute:: Parameter.annotation
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
The annotation for the parameter. If the parameter has no annotation,
|
2012-08-13 11:10:28 -03:00
|
|
|
this attribute is set to :attr:`Parameter.empty`.
|
|
|
|
|
|
|
|
.. attribute:: Parameter.kind
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Describes how argument values are bound to the parameter. Possible values
|
|
|
|
(accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2013-03-28 09:28:44 -03:00
|
|
|
.. tabularcolumns:: |l|L|
|
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| Name | Meaning |
|
|
|
|
+========================+==============================================+
|
|
|
|
| *POSITIONAL_ONLY* | Value must be supplied as a positional |
|
|
|
|
| | argument. |
|
|
|
|
| | |
|
|
|
|
| | Python has no explicit syntax for defining |
|
|
|
|
| | positional-only parameters, but many built-in|
|
|
|
|
| | and extension module functions (especially |
|
|
|
|
| | those that accept only one or two parameters)|
|
|
|
|
| | accept them. |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| *POSITIONAL_OR_KEYWORD*| Value may be supplied as either a keyword or |
|
|
|
|
| | positional argument (this is the standard |
|
|
|
|
| | binding behaviour for functions implemented |
|
|
|
|
| | in Python.) |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| *VAR_POSITIONAL* | A tuple of positional arguments that aren't |
|
|
|
|
| | bound to any other parameter. This |
|
|
|
|
| | corresponds to a ``*args`` parameter in a |
|
|
|
|
| | Python function definition. |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| *KEYWORD_ONLY* | Value must be supplied as a keyword argument.|
|
|
|
|
| | Keyword only parameters are those which |
|
|
|
|
| | appear after a ``*`` or ``*args`` entry in a |
|
|
|
|
| | Python function definition. |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| *VAR_KEYWORD* | A dict of keyword arguments that aren't bound|
|
|
|
|
| | to any other parameter. This corresponds to a|
|
|
|
|
| | ``**kwargs`` parameter in a Python function |
|
|
|
|
| | definition. |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
|
2012-08-13 12:23:54 -03:00
|
|
|
Example: print all keyword-only arguments without default values::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> def foo(a, b, *, c, d=10):
|
|
|
|
... pass
|
|
|
|
|
|
|
|
>>> sig = signature(foo)
|
|
|
|
>>> for param in sig.parameters.values():
|
|
|
|
... if (param.kind == param.KEYWORD_ONLY and
|
|
|
|
... param.default is param.empty):
|
|
|
|
... print('Parameter:', param)
|
|
|
|
Parameter: c
|
|
|
|
|
2012-09-14 00:35:09 -03:00
|
|
|
.. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Create a new Parameter instance based on the instance replaced was invoked
|
|
|
|
on. To override a :class:`Parameter` attribute, pass the corresponding
|
|
|
|
argument. To remove a default value or/and an annotation from a
|
|
|
|
Parameter, pass :attr:`Parameter.empty`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
>>> from inspect import Parameter
|
|
|
|
>>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
|
|
|
|
>>> str(param)
|
|
|
|
'foo=42'
|
|
|
|
|
|
|
|
>>> str(param.replace()) # Will create a shallow copy of 'param'
|
|
|
|
'foo=42'
|
|
|
|
|
|
|
|
>>> str(param.replace(default=Parameter.empty, annotation='spam'))
|
|
|
|
"foo:'spam'"
|
|
|
|
|
2014-01-27 16:07:58 -04:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
In Python 3.3 Parameter objects were allowed to have ``name`` set
|
|
|
|
to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``.
|
|
|
|
This is no longer permitted.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. class:: BoundArguments
|
|
|
|
|
|
|
|
Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call.
|
|
|
|
Holds the mapping of arguments to the function's parameters.
|
|
|
|
|
|
|
|
.. attribute:: BoundArguments.arguments
|
|
|
|
|
|
|
|
An ordered, mutable mapping (:class:`collections.OrderedDict`) of
|
2012-08-14 04:45:28 -03:00
|
|
|
parameters' names to arguments' values. Contains only explicitly bound
|
|
|
|
arguments. Changes in :attr:`arguments` will reflect in :attr:`args` and
|
|
|
|
:attr:`kwargs`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
Should be used in conjunction with :attr:`Signature.parameters` for any
|
|
|
|
argument processing purposes.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Arguments for which :meth:`Signature.bind` or
|
|
|
|
:meth:`Signature.bind_partial` relied on a default value are skipped.
|
2015-05-16 14:45:09 -03:00
|
|
|
However, if needed, use :meth:`BoundArguments.apply_defaults` to add
|
|
|
|
them.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. attribute:: BoundArguments.args
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
A tuple of positional arguments values. Dynamically computed from the
|
|
|
|
:attr:`arguments` attribute.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. attribute:: BoundArguments.kwargs
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
A dict of keyword arguments values. Dynamically computed from the
|
|
|
|
:attr:`arguments` attribute.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2015-05-14 15:14:02 -03:00
|
|
|
.. attribute:: BoundArguments.signature
|
|
|
|
|
|
|
|
A reference to the parent :class:`Signature` object.
|
|
|
|
|
2015-05-16 14:45:09 -03:00
|
|
|
.. method:: BoundArguments.apply_defaults()
|
|
|
|
|
|
|
|
Set default values for missing arguments.
|
|
|
|
|
|
|
|
For variable-positional arguments (``*args``) the default is an
|
|
|
|
empty tuple.
|
|
|
|
|
|
|
|
For variable-keyword arguments (``**kwargs``) the default is an
|
|
|
|
empty dict.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
>>> def foo(a, b='ham', *args): pass
|
|
|
|
>>> ba = inspect.signature(foo).bind('spam')
|
|
|
|
>>> ba.apply_defaults()
|
|
|
|
>>> ba.arguments
|
|
|
|
OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])
|
|
|
|
|
2015-05-16 17:29:31 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
The :attr:`args` and :attr:`kwargs` properties can be used to invoke
|
|
|
|
functions::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
def test(a, *, b):
|
|
|
|
...
|
|
|
|
|
|
|
|
sig = signature(test)
|
|
|
|
ba = sig.bind(10, b=20)
|
|
|
|
test(*ba.args, **ba.kwargs)
|
|
|
|
|
|
|
|
|
2012-08-14 04:45:28 -03:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:pep:`362` - Function Signature Object.
|
|
|
|
The detailed specification, implementation details and examples.
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _inspect-classes-functions:
|
|
|
|
|
|
|
|
Classes and functions
|
|
|
|
---------------------
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: getclasstree(classes, unique=False)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Arrange the given list of classes into a hierarchy of nested lists. Where a
|
|
|
|
nested list appears, it contains classes derived from the class whose entry
|
|
|
|
immediately precedes the list. Each entry is a 2-tuple containing a class and a
|
|
|
|
tuple of its base classes. If the *unique* argument is true, exactly one entry
|
|
|
|
appears in the returned structure for each class in the given list. Otherwise,
|
|
|
|
classes using multiple inheritance and their descendants will appear multiple
|
|
|
|
times.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getargspec(func)
|
|
|
|
|
2010-01-09 05:48:46 -04:00
|
|
|
Get the names and default values of a Python function's arguments. A
|
2011-01-06 05:23:56 -04:00
|
|
|
:term:`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is
|
|
|
|
returned. *args* is a list of the argument names. *varargs* and *keywords*
|
|
|
|
are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is a
|
2012-09-21 13:40:41 -03:00
|
|
|
tuple of default argument values or ``None`` if there are no default
|
|
|
|
arguments; if this tuple has *n* elements, they correspond to the last
|
|
|
|
*n* elements listed in *args*.
|
2007-09-12 16:04:21 -03:00
|
|
|
|
|
|
|
.. deprecated:: 3.0
|
2015-05-22 17:28:05 -03:00
|
|
|
Use :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>`, which provide a
|
|
|
|
better introspecting API for callables. This function will be removed
|
|
|
|
in Python 3.6.
|
2007-09-12 16:04:21 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getfullargspec(func)
|
|
|
|
|
2010-01-09 05:48:46 -04:00
|
|
|
Get the names and default values of a Python function's arguments. A
|
|
|
|
:term:`named tuple` is returned:
|
2007-09-12 16:04:21 -03:00
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults,
|
|
|
|
annotations)``
|
2007-09-12 16:04:21 -03:00
|
|
|
|
|
|
|
*args* is a list of the argument names. *varargs* and *varkw* are the names
|
2012-09-21 13:40:41 -03:00
|
|
|
of the ``*`` and ``**`` arguments or ``None``. *defaults* is an *n*-tuple
|
|
|
|
of the default values of the last *n* arguments, or ``None`` if there are no
|
|
|
|
default arguments. *kwonlyargs* is a list of
|
2007-09-12 16:04:21 -03:00
|
|
|
keyword-only argument names. *kwonlydefaults* is a dictionary mapping names
|
|
|
|
from kwonlyargs to defaults. *annotations* is a dictionary mapping argument
|
|
|
|
names to annotations.
|
|
|
|
|
|
|
|
The first four items in the tuple correspond to :func:`getargspec`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-03-08 02:36:37 -04:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
This function is now based on :func:`signature`, but still ignores
|
|
|
|
``__wrapped__`` attributes and includes the already bound first
|
|
|
|
parameter in the signature output for bound methods.
|
|
|
|
|
2015-05-22 12:38:38 -03:00
|
|
|
.. deprecated:: 3.5
|
|
|
|
Use :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>`, which provide a
|
|
|
|
better introspecting API for callables.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getargvalues(frame)
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
Get information about arguments passed into a particular frame. A
|
|
|
|
:term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is
|
2011-01-06 05:23:56 -04:00
|
|
|
returned. *args* is a list of the argument names. *varargs* and *keywords*
|
|
|
|
are the names of the ``*`` and ``**`` arguments or ``None``. *locals* is the
|
2010-10-15 13:07:41 -03:00
|
|
|
locals dictionary of the given frame.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-05-22 17:28:05 -03:00
|
|
|
.. deprecated:: 3.5
|
|
|
|
Use :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>`, which provide a
|
|
|
|
better introspecting API for callables.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-10-26 18:28:20 -03:00
|
|
|
.. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]])
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-04-21 14:22:28 -03:00
|
|
|
Format a pretty argument spec from the values returned by
|
|
|
|
:func:`getargspec` or :func:`getfullargspec`.
|
|
|
|
|
|
|
|
The first seven arguments are (``args``, ``varargs``, ``varkw``,
|
2014-10-31 06:25:48 -03:00
|
|
|
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``).
|
|
|
|
|
|
|
|
The other six arguments are functions that are called to turn argument names,
|
|
|
|
``*`` argument name, ``**`` argument name, default values, return annotation
|
|
|
|
and individual annotations into strings, respectively.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
>>> from inspect import formatargspec, getfullargspec
|
|
|
|
>>> def f(a: int, b: float):
|
|
|
|
... pass
|
|
|
|
...
|
|
|
|
>>> formatargspec(*getfullargspec(f))
|
|
|
|
'(a: int, b: float)'
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-05-22 17:28:05 -03:00
|
|
|
.. deprecated:: 3.5
|
|
|
|
Use :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>`, which provide a
|
|
|
|
better introspecting API for callables.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 13:07:41 -03:00
|
|
|
.. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue])
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Format a pretty argument spec from the four values returned by
|
|
|
|
:func:`getargvalues`. The format\* arguments are the corresponding optional
|
|
|
|
formatting functions that are called to turn names and values into strings.
|
|
|
|
|
2015-05-22 17:28:05 -03:00
|
|
|
.. deprecated:: 3.5
|
|
|
|
Use :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>`, which provide a
|
|
|
|
better introspecting API for callables.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getmro(cls)
|
|
|
|
|
|
|
|
Return a tuple of class cls's base classes, including cls, in method resolution
|
|
|
|
order. No class appears more than once in this tuple. Note that the method
|
|
|
|
resolution order depends on cls's type. Unless a very peculiar user-defined
|
|
|
|
metatype is in use, cls will be the first element of the tuple.
|
|
|
|
|
|
|
|
|
2014-01-02 14:22:30 -04:00
|
|
|
.. function:: getcallargs(func, *args, **kwds)
|
2010-03-30 15:42:32 -03:00
|
|
|
|
|
|
|
Bind the *args* and *kwds* to the argument names of the Python function or
|
|
|
|
method *func*, as if it was called with them. For bound methods, bind also the
|
|
|
|
first argument (typically named ``self``) to the associated instance. A dict
|
|
|
|
is returned, mapping the argument names (including the names of the ``*`` and
|
|
|
|
``**`` arguments, if any) to their values from *args* and *kwds*. In case of
|
|
|
|
invoking *func* incorrectly, i.e. whenever ``func(*args, **kwds)`` would raise
|
|
|
|
an exception because of incompatible signature, an exception of the same type
|
|
|
|
and the same or similar message is raised. For example::
|
|
|
|
|
|
|
|
>>> from inspect import getcallargs
|
|
|
|
>>> def f(a, b=1, *pos, **named):
|
|
|
|
... pass
|
2012-08-09 07:25:32 -03:00
|
|
|
>>> getcallargs(f, 1, 2, 3) == {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}
|
|
|
|
True
|
|
|
|
>>> getcallargs(f, a=2, x=4) == {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}
|
|
|
|
True
|
2010-03-30 15:42:32 -03:00
|
|
|
>>> getcallargs(f)
|
|
|
|
Traceback (most recent call last):
|
|
|
|
...
|
2012-08-09 07:25:32 -03:00
|
|
|
TypeError: f() missing 1 required positional argument: 'a'
|
2010-03-30 15:42:32 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2015-05-22 12:38:38 -03:00
|
|
|
.. deprecated:: 3.5
|
|
|
|
Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2010-03-30 15:42:32 -03:00
|
|
|
|
2012-06-23 06:39:55 -03:00
|
|
|
.. function:: getclosurevars(func)
|
|
|
|
|
|
|
|
Get the mapping of external name references in a Python function or
|
|
|
|
method *func* to their current values. A
|
|
|
|
:term:`named tuple` ``ClosureVars(nonlocals, globals, builtins, unbound)``
|
|
|
|
is returned. *nonlocals* maps referenced names to lexical closure
|
|
|
|
variables, *globals* to the function's module globals and *builtins* to
|
|
|
|
the builtins visible from the function body. *unbound* is the set of names
|
|
|
|
referenced in the function that could not be resolved at all given the
|
|
|
|
current module globals and builtins.
|
|
|
|
|
|
|
|
:exc:`TypeError` is raised if *func* is not a Python function or method.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2013-07-28 07:00:01 -03:00
|
|
|
.. function:: unwrap(func, *, stop=None)
|
|
|
|
|
|
|
|
Get the object wrapped by *func*. It follows the chain of :attr:`__wrapped__`
|
|
|
|
attributes returning the last object in the chain.
|
|
|
|
|
|
|
|
*stop* is an optional callback accepting an object in the wrapper chain
|
|
|
|
as its sole argument that allows the unwrapping to be terminated early if
|
|
|
|
the callback returns a true value. If the callback never returns a true
|
|
|
|
value, the last object in the chain is returned as usual. For example,
|
|
|
|
:func:`signature` uses this to stop unwrapping if any object in the
|
|
|
|
chain has a ``__signature__`` attribute defined.
|
|
|
|
|
|
|
|
:exc:`ValueError` is raised if a cycle is encountered.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _inspect-stack:
|
|
|
|
|
|
|
|
The interpreter stack
|
|
|
|
---------------------
|
|
|
|
|
2014-08-24 11:50:28 -03:00
|
|
|
When the following functions return "frame records," each record is a
|
|
|
|
:term:`named tuple`
|
|
|
|
``FrameInfo(frame, filename, lineno, function, code_context, index)``.
|
|
|
|
The tuple contains the frame object, the filename, the line number of the
|
|
|
|
current line,
|
2007-08-15 11:28:22 -03:00
|
|
|
the function name, a list of lines of context from the source code, and the
|
|
|
|
index of the current line within that list.
|
|
|
|
|
2014-08-24 11:50:28 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Return a named tuple instead of a tuple.
|
|
|
|
|
2009-04-27 13:20:50 -03:00
|
|
|
.. note::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Keeping references to frame objects, as found in the first element of the frame
|
|
|
|
records these functions return, can cause your program to create reference
|
|
|
|
cycles. Once a reference cycle has been created, the lifespan of all objects
|
|
|
|
which can be accessed from the objects which form the cycle can become much
|
|
|
|
longer even if Python's optional cycle detector is enabled. If such cycles must
|
|
|
|
be created, it is important to ensure they are explicitly broken to avoid the
|
|
|
|
delayed destruction of objects and increased memory consumption which occurs.
|
|
|
|
|
|
|
|
Though the cycle detector will catch these, destruction of the frames (and local
|
|
|
|
variables) can be made deterministic by removing the cycle in a
|
|
|
|
:keyword:`finally` clause. This is also important if the cycle detector was
|
|
|
|
disabled when Python was compiled or using :func:`gc.disable`. For example::
|
|
|
|
|
|
|
|
def handle_stackframe_without_leak():
|
|
|
|
frame = inspect.currentframe()
|
|
|
|
try:
|
|
|
|
# do something with the frame
|
|
|
|
finally:
|
|
|
|
del frame
|
|
|
|
|
2013-08-05 18:26:40 -03:00
|
|
|
If you want to keep the frame around (for example to print a traceback
|
|
|
|
later), you can also break reference cycles by using the
|
|
|
|
:meth:`frame.clear` method.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The optional *context* argument supported by most of these functions specifies
|
|
|
|
the number of lines of context to return, which are centered around the current
|
|
|
|
line.
|
|
|
|
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: getframeinfo(frame, context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-01-03 17:18:54 -04:00
|
|
|
Get information about a frame or traceback object. A :term:`named tuple`
|
Merged revisions 59883-59920 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59887 | neal.norwitz | 2008-01-10 06:42:58 +0100 (Thu, 10 Jan 2008) | 1 line
Reword entry, not sure I made it much better though.
........
r59888 | andrew.kuchling | 2008-01-10 14:37:12 +0100 (Thu, 10 Jan 2008) | 1 line
Check for fd of -1 to save fsync() and fstat() call
........
r59891 | thomas.heller | 2008-01-10 19:45:40 +0100 (Thu, 10 Jan 2008) | 1 line
Reflow a paragraph, and fix a typo.
........
r59892 | raymond.hettinger | 2008-01-10 20:15:10 +0100 (Thu, 10 Jan 2008) | 1 line
Examples for named tuple subclassing should include __slots__
........
r59895 | raymond.hettinger | 2008-01-10 21:37:12 +0100 (Thu, 10 Jan 2008) | 1 line
Clarify how to add a field to a named tuple.
........
r59896 | amaury.forgeotdarc | 2008-01-10 22:59:42 +0100 (Thu, 10 Jan 2008) | 12 lines
Closing issue1761.
Surprising behaviour of the "$" regexp: it matches the
end of the string, AND just before the newline at the end
of the string::
re.sub('$', '#', 'foo\n') == 'foo#\n#'
Python is consistent with Perl and the pcre library, so
we just document it.
Guido prefers "\Z" to match only the end of the string.
........
r59898 | raymond.hettinger | 2008-01-11 00:00:01 +0100 (Fri, 11 Jan 2008) | 1 line
Neaten-up the named tuple docs
........
r59900 | raymond.hettinger | 2008-01-11 01:23:13 +0100 (Fri, 11 Jan 2008) | 1 line
Run doctests on the collections module
........
r59903 | raymond.hettinger | 2008-01-11 02:25:54 +0100 (Fri, 11 Jan 2008) | 1 line
Doctest results return a named tuple for readability
........
r59904 | raymond.hettinger | 2008-01-11 03:12:33 +0100 (Fri, 11 Jan 2008) | 1 line
Comment-out missing constant (from rev 59819)
........
r59905 | raymond.hettinger | 2008-01-11 03:24:13 +0100 (Fri, 11 Jan 2008) | 1 line
Have Decimal.as_tuple return a named tuple.
........
r59906 | raymond.hettinger | 2008-01-11 04:04:50 +0100 (Fri, 11 Jan 2008) | 1 line
Let most inspect functions return named tuples
........
r59907 | raymond.hettinger | 2008-01-11 04:20:54 +0100 (Fri, 11 Jan 2008) | 1 line
Improve usability of the SequenceMatcher by returning named tuples describing match ranges.
........
r59909 | thomas.heller | 2008-01-11 09:04:03 +0100 (Fri, 11 Jan 2008) | 1 line
Add an important missing blank.
........
r59910 | georg.brandl | 2008-01-11 10:19:11 +0100 (Fri, 11 Jan 2008) | 2 lines
Guard definition of TIPC_SUB_CANCEL with an #ifdef.
........
r59911 | georg.brandl | 2008-01-11 10:20:58 +0100 (Fri, 11 Jan 2008) | 2 lines
News entries for rev. 5990[567].
........
r59912 | georg.brandl | 2008-01-11 10:55:53 +0100 (Fri, 11 Jan 2008) | 2 lines
Documentation for r5990[3567].
........
r59913 | thomas.heller | 2008-01-11 13:41:39 +0100 (Fri, 11 Jan 2008) | 4 lines
The sqlite3 dll, when compiled in debug mode, must be linked with /MDd
to use the debug runtime library. Further, the dll will be named
sqlite3_d.dll.
........
r59919 | thomas.heller | 2008-01-11 16:38:46 +0100 (Fri, 11 Jan 2008) | 6 lines
Revert revision 59913, because it was wrong:
The sqlite3 dll, when compiled in debug mode, must be linked with
/MDd to use the debug runtime library. Further, the dll will be
named sqlite3_d.dll.
........
r59920 | christian.heimes | 2008-01-11 16:42:29 +0100 (Fri, 11 Jan 2008) | 1 line
Removed unused variable
........
2008-01-11 12:17:00 -04:00
|
|
|
``Traceback(filename, lineno, function, code_context, index)`` is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: getouterframes(frame, context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Get a list of frame records for a frame and all outer frames. These frames
|
|
|
|
represent the calls that lead to the creation of *frame*. The first entry in the
|
|
|
|
returned list represents *frame*; the last entry represents the outermost call
|
|
|
|
on *frame*'s stack.
|
|
|
|
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: getinnerframes(traceback, context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Get a list of frame records for a traceback's frame and all inner frames. These
|
|
|
|
frames represent calls made as a consequence of *frame*. The first entry in the
|
|
|
|
list represents *traceback*; the last entry represents where the exception was
|
|
|
|
raised.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: currentframe()
|
|
|
|
|
|
|
|
Return the frame object for the caller's stack frame.
|
|
|
|
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
.. impl-detail::
|
|
|
|
|
|
|
|
This function relies on Python stack frame support in the interpreter,
|
|
|
|
which isn't guaranteed to exist in all implementations of Python. If
|
|
|
|
running in an implementation without Python stack frame support this
|
|
|
|
function returns ``None``.
|
Merged revisions 74779-74786,74793,74795,74811,74860-74861,74863,74876,74886,74896,74901,74903,74908,74912,74930,74933,74943,74946,74952-74955,75015,75019,75032,75068,75076,75095,75098,75102,75129,75139,75230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74779 | michael.foord | 2009-09-13 11:13:36 -0500 (Sun, 13 Sep 2009) | 1 line
Change to tutorial wording for reading text / binary files on Windows. Issue #6301.
........
r74780 | michael.foord | 2009-09-13 11:40:02 -0500 (Sun, 13 Sep 2009) | 1 line
Objects that compare equal automatically pass or fail assertAlmostEqual and assertNotAlmostEqual tests on unittest.TestCase. Issue 6567.
........
r74781 | michael.foord | 2009-09-13 11:46:19 -0500 (Sun, 13 Sep 2009) | 1 line
Note that sys._getframe is not guaranteed to exist in all implementations of Python, and a corresponding note in inspect.currentframe. Issue 6712.
........
r74782 | michael.foord | 2009-09-13 12:07:46 -0500 (Sun, 13 Sep 2009) | 1 line
Tutorial tweaks. Issue 6849.
........
r74783 | michael.foord | 2009-09-13 12:28:35 -0500 (Sun, 13 Sep 2009) | 1 line
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
........
r74784 | georg.brandl | 2009-09-13 13:15:07 -0500 (Sun, 13 Sep 2009) | 1 line
Typo fix.
........
r74785 | michael.foord | 2009-09-13 14:07:03 -0500 (Sun, 13 Sep 2009) | 1 line
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
........
r74786 | michael.foord | 2009-09-13 14:08:18 -0500 (Sun, 13 Sep 2009) | 1 line
Remove an extraneous space in unittest documentation.
........
r74793 | georg.brandl | 2009-09-14 09:50:47 -0500 (Mon, 14 Sep 2009) | 1 line
#6908: fix association of hashlib hash attributes.
........
r74795 | benjamin.peterson | 2009-09-14 22:36:26 -0500 (Mon, 14 Sep 2009) | 1 line
Py_SetPythonHome uses static storage #6913
........
r74811 | georg.brandl | 2009-09-15 15:26:59 -0500 (Tue, 15 Sep 2009) | 1 line
Add Armin Ronacher.
........
r74860 | benjamin.peterson | 2009-09-16 21:46:54 -0500 (Wed, 16 Sep 2009) | 1 line
kill bare except
........
r74861 | benjamin.peterson | 2009-09-16 22:18:28 -0500 (Wed, 16 Sep 2009) | 1 line
pep 8 defaults
........
r74863 | benjamin.peterson | 2009-09-16 22:27:33 -0500 (Wed, 16 Sep 2009) | 1 line
rationalize a bit
........
r74876 | georg.brandl | 2009-09-17 11:15:53 -0500 (Thu, 17 Sep 2009) | 1 line
#6932: remove paragraph that advises relying on __del__ being called.
........
r74886 | benjamin.peterson | 2009-09-17 16:33:46 -0500 (Thu, 17 Sep 2009) | 1 line
use macros
........
r74896 | georg.brandl | 2009-09-18 02:22:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6936: for interactive use, quit() is just fine.
........
r74901 | georg.brandl | 2009-09-18 04:14:52 -0500 (Fri, 18 Sep 2009) | 1 line
#6905: use better exception messages in inspect when the argument is of the wrong type.
........
r74903 | georg.brandl | 2009-09-18 04:18:27 -0500 (Fri, 18 Sep 2009) | 1 line
#6938: "ident" is always a string, so use a format code which works.
........
r74908 | georg.brandl | 2009-09-18 08:57:11 -0500 (Fri, 18 Sep 2009) | 1 line
Use str.format() to fix beginner's mistake with %-style string formatting.
........
r74912 | georg.brandl | 2009-09-18 11:19:56 -0500 (Fri, 18 Sep 2009) | 1 line
Optimize optimization and fix method name in docstring.
........
r74930 | georg.brandl | 2009-09-18 16:21:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6925: rewrite docs for locals() and vars() a bit.
........
r74933 | georg.brandl | 2009-09-18 16:35:59 -0500 (Fri, 18 Sep 2009) | 1 line
#6930: clarify description about byteorder handling in UTF decoder routines.
........
r74943 | georg.brandl | 2009-09-19 02:35:07 -0500 (Sat, 19 Sep 2009) | 1 line
#6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple.
........
r74946 | georg.brandl | 2009-09-19 03:43:16 -0500 (Sat, 19 Sep 2009) | 1 line
Update bug tracker reference.
........
r74952 | georg.brandl | 2009-09-19 05:42:34 -0500 (Sat, 19 Sep 2009) | 1 line
#6946: fix duplicate index entries for datetime classes.
........
r74953 | georg.brandl | 2009-09-19 07:04:16 -0500 (Sat, 19 Sep 2009) | 1 line
Fix references to threading.enumerate().
........
r74954 | georg.brandl | 2009-09-19 08:13:56 -0500 (Sat, 19 Sep 2009) | 1 line
Add Doug.
........
r74955 | georg.brandl | 2009-09-19 08:20:49 -0500 (Sat, 19 Sep 2009) | 1 line
Add Mark Summerfield.
........
r75015 | georg.brandl | 2009-09-22 05:55:08 -0500 (Tue, 22 Sep 2009) | 1 line
Fix encoding name.
........
r75019 | vinay.sajip | 2009-09-22 12:23:41 -0500 (Tue, 22 Sep 2009) | 1 line
Fixed a typo, and added sections on optimization and using arbitrary objects as messages.
........
r75032 | benjamin.peterson | 2009-09-22 17:15:28 -0500 (Tue, 22 Sep 2009) | 1 line
fix typos/rephrase
........
r75068 | benjamin.peterson | 2009-09-25 21:57:59 -0500 (Fri, 25 Sep 2009) | 1 line
comment out ugly xxx
........
r75076 | vinay.sajip | 2009-09-26 09:53:32 -0500 (Sat, 26 Sep 2009) | 1 line
Tidied up name of parameter in StreamHandler
........
r75095 | michael.foord | 2009-09-27 14:15:41 -0500 (Sun, 27 Sep 2009) | 1 line
Test creation moved from TestProgram.parseArgs to TestProgram.createTests exclusively. Issue 6956.
........
r75098 | michael.foord | 2009-09-27 15:08:23 -0500 (Sun, 27 Sep 2009) | 1 line
Documentation improvement for load_tests protocol in unittest. Issue 6515.
........
r75102 | skip.montanaro | 2009-09-27 21:12:27 -0500 (Sun, 27 Sep 2009) | 3 lines
Patch from Thomas Barr so that csv.Sniffer will set doublequote property.
Closes issue 6606.
........
r75129 | vinay.sajip | 2009-09-29 02:08:54 -0500 (Tue, 29 Sep 2009) | 1 line
Issue #7014: logging: Improved IronPython 2.6 compatibility.
........
r75139 | raymond.hettinger | 2009-09-29 13:53:24 -0500 (Tue, 29 Sep 2009) | 3 lines
Issue 7008: Better document str.title and show how to work around the apostrophe problem.
........
r75230 | benjamin.peterson | 2009-10-04 08:38:38 -0500 (Sun, 04 Oct 2009) | 1 line
test logging
........
2009-10-04 11:49:41 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: stack(context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return a list of frame records for the caller's stack. The first entry in the
|
|
|
|
returned list represents the caller; the last entry represents the outermost
|
|
|
|
call on the stack.
|
|
|
|
|
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: trace(context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return a list of frame records for the stack between the current frame and the
|
|
|
|
frame in which an exception currently being handled was raised in. The first
|
|
|
|
entry in the list represents the caller; the last entry represents where the
|
|
|
|
exception was raised.
|
|
|
|
|
2010-11-20 11:07:30 -04:00
|
|
|
|
|
|
|
Fetching attributes statically
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
Both :func:`getattr` and :func:`hasattr` can trigger code execution when
|
|
|
|
fetching or checking for the existence of attributes. Descriptors, like
|
|
|
|
properties, will be invoked and :meth:`__getattr__` and :meth:`__getattribute__`
|
|
|
|
may be called.
|
|
|
|
|
|
|
|
For cases where you want passive introspection, like documentation tools, this
|
2011-08-31 21:47:34 -03:00
|
|
|
can be inconvenient. :func:`getattr_static` has the same signature as :func:`getattr`
|
2010-11-20 11:07:30 -04:00
|
|
|
but avoids executing code when it fetches attributes.
|
|
|
|
|
|
|
|
.. function:: getattr_static(obj, attr, default=None)
|
|
|
|
|
|
|
|
Retrieve attributes without triggering dynamic lookup via the
|
2011-08-31 21:47:34 -03:00
|
|
|
descriptor protocol, :meth:`__getattr__` or :meth:`__getattribute__`.
|
2010-11-20 11:07:30 -04:00
|
|
|
|
|
|
|
Note: this function may not be able to retrieve all attributes
|
|
|
|
that getattr can fetch (like dynamically created attributes)
|
|
|
|
and may find attributes that getattr can't (like descriptors
|
|
|
|
that raise AttributeError). It can also return descriptors objects
|
|
|
|
instead of instance members.
|
|
|
|
|
2013-10-13 17:09:14 -03:00
|
|
|
If the instance :attr:`~object.__dict__` is shadowed by another member (for
|
|
|
|
example a property) then this function will be unable to find instance
|
|
|
|
members.
|
2010-11-20 23:55:53 -04:00
|
|
|
|
2011-03-15 20:20:44 -03:00
|
|
|
.. versionadded:: 3.2
|
2010-11-20 12:40:44 -04:00
|
|
|
|
2011-08-31 21:47:34 -03:00
|
|
|
:func:`getattr_static` does not resolve descriptors, for example slot descriptors or
|
2010-11-20 12:40:44 -04:00
|
|
|
getset descriptors on objects implemented in C. The descriptor object
|
2010-11-20 11:07:30 -04:00
|
|
|
is returned instead of the underlying attribute.
|
|
|
|
|
|
|
|
You can handle these with code like the following. Note that
|
|
|
|
for arbitrary getset descriptors invoking these may trigger
|
|
|
|
code execution::
|
|
|
|
|
|
|
|
# example code for resolving the builtin descriptor types
|
2010-11-21 23:09:19 -04:00
|
|
|
class _foo:
|
2010-11-20 11:07:30 -04:00
|
|
|
__slots__ = ['foo']
|
|
|
|
|
|
|
|
slot_descriptor = type(_foo.foo)
|
|
|
|
getset_descriptor = type(type(open(__file__)).name)
|
|
|
|
wrapper_descriptor = type(str.__dict__['__add__'])
|
|
|
|
descriptor_types = (slot_descriptor, getset_descriptor, wrapper_descriptor)
|
|
|
|
|
|
|
|
result = getattr_static(some_object, 'foo')
|
|
|
|
if type(result) in descriptor_types:
|
|
|
|
try:
|
|
|
|
result = result.__get__()
|
|
|
|
except AttributeError:
|
|
|
|
# descriptors can raise AttributeError to
|
|
|
|
# indicate there is no underlying value
|
|
|
|
# in which case the descriptor itself will
|
|
|
|
# have to do
|
|
|
|
pass
|
2010-11-20 23:44:04 -04:00
|
|
|
|
2010-11-20 23:55:53 -04:00
|
|
|
|
2010-11-20 23:44:04 -04:00
|
|
|
Current State of a Generator
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
When implementing coroutine schedulers and for other advanced uses of
|
|
|
|
generators, it is useful to determine whether a generator is currently
|
|
|
|
executing, is waiting to start or resume or execution, or has already
|
2010-12-15 20:30:53 -04:00
|
|
|
terminated. :func:`getgeneratorstate` allows the current state of a
|
2010-11-20 23:44:04 -04:00
|
|
|
generator to be determined easily.
|
|
|
|
|
|
|
|
.. function:: getgeneratorstate(generator)
|
|
|
|
|
2010-12-15 20:30:53 -04:00
|
|
|
Get current state of a generator-iterator.
|
2010-11-20 23:44:04 -04:00
|
|
|
|
2010-12-15 20:30:53 -04:00
|
|
|
Possible states are:
|
2011-01-20 00:03:19 -04:00
|
|
|
* GEN_CREATED: Waiting to start execution.
|
|
|
|
* GEN_RUNNING: Currently being executed by the interpreter.
|
|
|
|
* GEN_SUSPENDED: Currently suspended at a yield expression.
|
|
|
|
* GEN_CLOSED: Execution has completed.
|
2010-11-20 23:44:04 -04:00
|
|
|
|
2010-11-20 23:55:53 -04:00
|
|
|
.. versionadded:: 3.2
|
2012-06-23 06:52:05 -03:00
|
|
|
|
|
|
|
The current internal state of the generator can also be queried. This is
|
|
|
|
mostly useful for testing purposes, to ensure that internal state is being
|
|
|
|
updated as expected:
|
|
|
|
|
|
|
|
.. function:: getgeneratorlocals(generator)
|
|
|
|
|
|
|
|
Get the mapping of live local variables in *generator* to their current
|
|
|
|
values. A dictionary is returned that maps from variable names to values.
|
|
|
|
This is the equivalent of calling :func:`locals` in the body of the
|
|
|
|
generator, and all the same caveats apply.
|
|
|
|
|
|
|
|
If *generator* is a :term:`generator` with no currently associated frame,
|
|
|
|
then an empty dictionary is returned. :exc:`TypeError` is raised if
|
|
|
|
*generator* is not a Python generator object.
|
|
|
|
|
|
|
|
.. impl-detail::
|
|
|
|
|
|
|
|
This function relies on the generator exposing a Python stack frame
|
|
|
|
for introspection, which isn't guaranteed to be the case in all
|
|
|
|
implementations of Python. In such cases, this function will always
|
|
|
|
return an empty dictionary.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
2013-09-22 09:46:49 -03:00
|
|
|
|
|
|
|
|
2013-10-26 12:57:34 -03:00
|
|
|
.. _inspect-module-cli:
|
|
|
|
|
2013-09-22 09:46:49 -03:00
|
|
|
Command Line Interface
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
The :mod:`inspect` module also provides a basic introspection capability
|
|
|
|
from the command line.
|
|
|
|
|
|
|
|
.. program:: inspect
|
|
|
|
|
|
|
|
By default, accepts the name of a module and prints the source of that
|
|
|
|
module. A class or function within the module can be printed instead by
|
|
|
|
appended a colon and the qualified name of the target object.
|
|
|
|
|
|
|
|
.. cmdoption:: --details
|
|
|
|
|
|
|
|
Print information about the specified object rather than the source code
|