2007-08-15 11:28:22 -03:00
|
|
|
:mod:`inspect` --- Inspect live objects
|
|
|
|
=======================================
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
.. testsetup:: *
|
|
|
|
|
|
|
|
import inspect
|
|
|
|
from inspect import *
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. module:: inspect
|
|
|
|
:synopsis: Extract information and source code from live objects.
|
2016-06-11 16:02:54 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. 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
|
2015-06-30 23:06:42 -03:00
|
|
|
class or module. The 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
|
2022-11-25 15:10:22 -04:00
|
|
|
attributes (see :ref:`import-mod-attrs` for module attributes):
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-01-21 10:44:07 -04:00
|
|
|
.. this function name is too big to fit in the ascii-art table below
|
|
|
|
.. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth`
|
|
|
|
|
2017-04-12 23:38:28 -03:00
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| Type | Attribute | Description |
|
|
|
|
+===========+===================+===========================+
|
|
|
|
| class | __doc__ | documentation string |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | class was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __module__ | name of module in which |
|
|
|
|
| | | this class was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| method | __doc__ | documentation string |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | method was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __func__ | function object |
|
|
|
|
| | | containing implementation |
|
|
|
|
| | | of method |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __self__ | instance to which this |
|
|
|
|
| | | method is bound, or |
|
|
|
|
| | | ``None`` |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2019-12-20 15:18:33 -04:00
|
|
|
| | __module__ | name of module in which |
|
|
|
|
| | | this method was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2017-04-12 23:38:28 -03:00
|
|
|
| function | __doc__ | documentation string |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __name__ | name with which this |
|
|
|
|
| | | function was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __code__ | code object containing |
|
|
|
|
| | | compiled function |
|
|
|
|
| | | :term:`bytecode` |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __defaults__ | tuple of any default |
|
|
|
|
| | | values for positional or |
|
|
|
|
| | | keyword parameters |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __kwdefaults__ | mapping of any default |
|
|
|
|
| | | values for keyword-only |
|
|
|
|
| | | parameters |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __globals__ | global namespace in which |
|
|
|
|
| | | this function was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2021-02-18 07:35:37 -04:00
|
|
|
| | __builtins__ | builtins namespace |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2017-04-12 23:38:28 -03:00
|
|
|
| | __annotations__ | mapping of parameters |
|
|
|
|
| | | names to annotations; |
|
|
|
|
| | | ``"return"`` key is |
|
|
|
|
| | | reserved for return |
|
|
|
|
| | | annotations. |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2019-12-20 15:18:33 -04:00
|
|
|
| | __module__ | name of module in which |
|
|
|
|
| | | this function was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2017-04-12 23:38:28 -03:00
|
|
|
| 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) |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | f_builtins | builtins namespace seen |
|
|
|
|
| | | 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_trace | tracing function for this |
|
|
|
|
| | | frame, or ``None`` |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| code | co_argcount | number of arguments (not |
|
|
|
|
| | | including keyword only |
|
|
|
|
| | | arguments, \* or \*\* |
|
|
|
|
| | | args) |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_code | string of raw compiled |
|
|
|
|
| | | bytecode |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_cellvars | tuple of names of cell |
|
|
|
|
| | | variables (referenced by |
|
|
|
|
| | | containing scopes) |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | 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 of ``CO_*`` flags, |
|
|
|
|
| | | read more :ref:`here |
|
|
|
|
| | | <inspect-module-co-flags>`|
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_lnotab | encoded mapping of line |
|
|
|
|
| | | numbers to bytecode |
|
|
|
|
| | | indices |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_freevars | tuple of names of free |
|
|
|
|
| | | variables (referenced via |
|
|
|
|
| | | a function's closure) |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2019-05-28 20:45:32 -03:00
|
|
|
| | co_posonlyargcount| number of positional only |
|
|
|
|
| | | arguments |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2017-04-12 23:38:28 -03:00
|
|
|
| | co_kwonlyargcount | number of keyword only |
|
|
|
|
| | | arguments (not including |
|
|
|
|
| | | \*\* arg) |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_name | name with which this code |
|
|
|
|
| | | object was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2022-07-05 06:16:10 -03:00
|
|
|
| | co_qualname | fully qualified name with |
|
2021-07-07 10:20:49 -03:00
|
|
|
| | | which this code object |
|
|
|
|
| | | was defined |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2022-03-02 15:03:38 -04:00
|
|
|
| | co_names | tuple of names other |
|
|
|
|
| | | than arguments and |
|
|
|
|
| | | function locals |
|
2017-04-12 23:38:28 -03:00
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_nlocals | number of local variables |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_stacksize | virtual machine stack |
|
|
|
|
| | | space required |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | co_varnames | tuple of names of |
|
|
|
|
| | | arguments and local |
|
|
|
|
| | | variables |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| generator | __name__ | name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | gi_frame | frame |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | gi_running | is the generator running? |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | gi_code | code |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | gi_yieldfrom | object being iterated by |
|
|
|
|
| | | ``yield from``, or |
|
|
|
|
| | | ``None`` |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| coroutine | __name__ | name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | cr_await | object being awaited on, |
|
|
|
|
| | | or ``None`` |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | cr_frame | frame |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | cr_running | is the coroutine running? |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | cr_code | code |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2018-01-21 10:44:07 -04:00
|
|
|
| | cr_origin | where coroutine was |
|
|
|
|
| | | created, or ``None``. See |
|
|
|
|
| | | |coroutine-origin-link| |
|
|
|
|
+-----------+-------------------+---------------------------+
|
2017-04-12 23:38:28 -03:00
|
|
|
| builtin | __doc__ | documentation string |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __name__ | original name of this |
|
|
|
|
| | | function or method |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __qualname__ | qualified name |
|
|
|
|
+-----------+-------------------+---------------------------+
|
|
|
|
| | __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
|
|
|
|
|
2015-08-17 14:04:41 -03:00
|
|
|
Add ``__qualname__`` and ``gi_yieldfrom`` attributes 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
|
|
|
|
2018-01-21 10:44:07 -04:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
|
|
|
|
Add ``cr_origin`` attribute to coroutines.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2021-02-18 07:35:37 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
|
|
|
|
Add ``__builtins__`` attribute to functions.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: getmembers(object[, predicate])
|
|
|
|
|
2018-04-26 20:48:26 -03:00
|
|
|
Return all the members of an object in a list of ``(name, value)``
|
|
|
|
pairs sorted by name. If the optional *predicate* argument—which will be
|
|
|
|
called with the ``value`` object of each member—is supplied, only members
|
|
|
|
for which the predicate returns a true value are included.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
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
|
2023-12-03 13:32:49 -04:00
|
|
|
listed in the metaclass' custom :meth:`~object.__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
|
|
|
|
2021-12-01 15:23:46 -04:00
|
|
|
.. function:: getmembers_static(object[, predicate])
|
|
|
|
|
|
|
|
Return all the members of an object in a list of ``(name, value)``
|
|
|
|
pairs sorted by name without triggering dynamic lookup via the descriptor
|
|
|
|
protocol, __getattr__ or __getattribute__. Optionally, only return members
|
|
|
|
that satisfy a given predicate.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
:func:`getmembers_static` may not be able to retrieve all members
|
|
|
|
that getmembers can fetch (like dynamically created attributes)
|
|
|
|
and may find members that getmembers can't (like descriptors
|
|
|
|
that raise AttributeError). It can also return descriptor objects
|
|
|
|
instead of instance members in some cases.
|
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
|
|
|
|
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
|
2015-07-23 11:49:00 -03:00
|
|
|
The function is based directly on :mod:`importlib`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: ismodule(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a module.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isclass(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a class, whether built-in or created in Python
|
2010-10-15 13:53:24 -03:00
|
|
|
code.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: ismethod(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a bound method written in Python.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isfunction(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a Python function, which includes functions
|
2010-10-15 13:53:24 -03:00
|
|
|
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)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a Python generator function.
|
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
|
|
|
|
2018-10-26 08:19:14 -03:00
|
|
|
.. versionchanged:: 3.8
|
2019-11-12 10:57:03 -04:00
|
|
|
Functions wrapped in :func:`functools.partial` now return ``True`` if the
|
2018-10-26 08:19:14 -03:00
|
|
|
wrapped function is a Python generator function.
|
|
|
|
|
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:: isgenerator(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a generator.
|
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
|
|
|
|
|
|
|
|
2015-05-21 12:50:30 -03:00
|
|
|
.. function:: iscoroutinefunction(object)
|
|
|
|
|
2022-12-18 15:13:24 -04:00
|
|
|
Return ``True`` if the object is a :term:`coroutine function` (a function
|
|
|
|
defined with an :keyword:`async def` syntax), a :func:`functools.partial`
|
|
|
|
wrapping a :term:`coroutine function`, or a sync function marked with
|
|
|
|
:func:`markcoroutinefunction`.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2018-10-26 08:19:14 -03:00
|
|
|
.. versionchanged:: 3.8
|
2019-11-12 10:57:03 -04:00
|
|
|
Functions wrapped in :func:`functools.partial` now return ``True`` if the
|
2018-10-26 08:19:14 -03:00
|
|
|
wrapped function is a :term:`coroutine function`.
|
|
|
|
|
2022-12-18 15:13:24 -04:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
Sync functions marked with :func:`markcoroutinefunction` now return
|
|
|
|
``True``.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: markcoroutinefunction(func)
|
|
|
|
|
|
|
|
Decorator to mark a callable as a :term:`coroutine function` if it would not
|
|
|
|
otherwise be detected by :func:`iscoroutinefunction`.
|
|
|
|
|
|
|
|
This may be of use for sync functions that return a :term:`coroutine`, if
|
|
|
|
the function is passed to an API that requires :func:`iscoroutinefunction`.
|
|
|
|
|
|
|
|
When possible, using an :keyword:`async def` function is preferred. Also
|
|
|
|
acceptable is calling the function and testing the return with
|
|
|
|
:func:`iscoroutine`.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
.. function:: iscoroutine(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a :term:`coroutine` created by an
|
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
|
|
|
:keyword:`async def` function.
|
2015-05-21 12:50:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
2015-07-03 14:11:35 -03:00
|
|
|
.. function:: isawaitable(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object can be used in :keyword:`await` expression.
|
2015-07-03 14:11:35 -03:00
|
|
|
|
|
|
|
Can also be used to distinguish generator-based coroutines from regular
|
2023-12-03 07:50:22 -04:00
|
|
|
generators:
|
|
|
|
|
|
|
|
.. testcode::
|
|
|
|
|
|
|
|
import types
|
2015-07-03 14:11:35 -03:00
|
|
|
|
|
|
|
def gen():
|
|
|
|
yield
|
|
|
|
@types.coroutine
|
|
|
|
def gen_coro():
|
|
|
|
yield
|
|
|
|
|
|
|
|
assert not isawaitable(gen())
|
|
|
|
assert isawaitable(gen_coro())
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
2016-12-15 18:36:05 -04:00
|
|
|
.. function:: isasyncgenfunction(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is an :term:`asynchronous generator` function,
|
2023-12-03 07:50:22 -04:00
|
|
|
for example:
|
2016-12-15 18:36:05 -04:00
|
|
|
|
2023-12-03 07:50:22 -04:00
|
|
|
.. doctest::
|
|
|
|
|
|
|
|
>>> async def agen():
|
|
|
|
... yield 1
|
|
|
|
...
|
|
|
|
>>> inspect.isasyncgenfunction(agen)
|
|
|
|
True
|
2016-12-15 18:36:05 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
2018-10-26 08:19:14 -03:00
|
|
|
.. versionchanged:: 3.8
|
2019-11-12 10:57:03 -04:00
|
|
|
Functions wrapped in :func:`functools.partial` now return ``True`` if the
|
2018-10-26 08:19:14 -03:00
|
|
|
wrapped function is a :term:`asynchronous generator` function.
|
|
|
|
|
2016-12-15 18:36:05 -04:00
|
|
|
|
|
|
|
.. function:: isasyncgen(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is an :term:`asynchronous generator iterator`
|
2016-12-15 18:36:05 -04:00
|
|
|
created by an :term:`asynchronous generator` function.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: istraceback(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a traceback.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isframe(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a frame.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: iscode(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a code.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isbuiltin(object)
|
|
|
|
|
2019-11-12 10:57:03 -04: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
|
|
|
|
|
|
|
|
2022-02-16 08:46:20 -04:00
|
|
|
.. function:: ismethodwrapper(object)
|
|
|
|
|
|
|
|
Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`.
|
|
|
|
|
2022-10-22 16:12:04 -03:00
|
|
|
These are instances of :class:`~types.MethodWrapperType`, such as :meth:`~object.__str__`,
|
|
|
|
:meth:`~object.__eq__` and :meth:`~object.__repr__`.
|
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
2022-02-16 08:46:20 -04:00
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: isroutine(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a user-defined or built-in function or method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 13:53:24 -03:00
|
|
|
|
2008-03-03 15:18:51 -04:00
|
|
|
.. function:: isabstract(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is an abstract base class.
|
2008-03-03 15:18:51 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: ismethoddescriptor(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a method descriptor, but not if
|
2010-10-15 13:53:24 -03:00
|
|
|
: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
|
2016-06-18 00:57:31 -03:00
|
|
|
has a :meth:`~object.__get__` method but not a :meth:`~object.__set__`
|
|
|
|
method, but beyond that the set of attributes varies. A
|
|
|
|
:attr:`~definition.__name__` attribute is usually
|
2023-12-03 13:32:49 -04:00
|
|
|
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
|
2019-11-12 10:57:03 -04:00
|
|
|
return ``False`` from the :func:`ismethoddescriptor` test, simply because the
|
#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
|
|
|
other tests promise more -- you can, e.g., count on having the
|
2023-12-03 13:32:49 -04:00
|
|
|
:ref:`__func__ <instance-methods>` attribute (etc) when an object passes
|
|
|
|
:func:`ismethod`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isdatadescriptor(object)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a data descriptor.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-11-15 17:47:26 -04:00
|
|
|
Data descriptors have a :attr:`~object.__set__` or a :attr:`~object.__delete__` method.
|
#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
|
|
|
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
|
2023-12-03 13:32:49 -04:00
|
|
|
descriptors will also have :attr:`~definition.__name__` and :attr:`!__doc__` attributes
|
#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
|
|
|
(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)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a getset descriptor.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
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)
|
|
|
|
|
2019-11-12 10:57:03 -04:00
|
|
|
Return ``True`` if the object is a member descriptor.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
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
|
2020-05-18 14:25:07 -03:00
|
|
|
a class, a method, a property or a descriptor, retrieve the documentation
|
2015-04-03 16:38:53 -03:00
|
|
|
string from the inheritance hierarchy.
|
2022-05-17 22:24:35 -03:00
|
|
|
Return ``None`` if the documentation string is invalid or missing.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-07-30 12:06:09 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Documentation strings are now inherited if not overridden.
|
|
|
|
|
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
|
2017-03-17 05:50:23 -03:00
|
|
|
Python source file (if the object is a module). If the object's source code
|
|
|
|
is unavailable, return ``None``. This could happen if the object has been
|
|
|
|
defined in C or the interactive shell.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. 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)
|
|
|
|
|
2022-05-17 22:24:35 -03:00
|
|
|
Try to guess which module an object was defined in. Return ``None``
|
|
|
|
if the module cannot be determined.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getsourcefile(object)
|
|
|
|
|
2022-05-17 22:24:35 -03:00
|
|
|
Return the name of the Python source file in which an object was defined
|
|
|
|
or ``None`` if no way can be identified to get the source. This
|
2007-08-15 11:28:22 -03:00
|
|
|
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.
|
2023-03-23 16:35:02 -03:00
|
|
|
A :exc:`TypeError` is raised if the object is a built-in module, class, or
|
|
|
|
function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
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.
|
2023-03-23 16:35:02 -03:00
|
|
|
A :exc:`TypeError` is raised if the object is a built-in module, class, or
|
|
|
|
function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
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
|
2016-05-30 00:36:58 -03:00
|
|
|
of code.
|
|
|
|
|
|
|
|
All leading whitespace is removed from the first line. Any leading whitespace
|
|
|
|
that can be uniformly removed from the second line onwards is removed. Empty
|
|
|
|
lines at the beginning and end are subsequently removed. Also, all tabs are
|
|
|
|
expanded to spaces.
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
The :class:`Signature` object represents the call signature of a callable object
|
|
|
|
and its return annotation. To retrieve a :class:`!Signature` object,
|
|
|
|
use the :func:`!signature`
|
2012-08-14 04:45:28 -03:00
|
|
|
function.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2021-04-30 01:16:28 -03:00
|
|
|
.. function:: signature(callable, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Return a :class:`Signature` object for the given *callable*:
|
|
|
|
|
|
|
|
.. doctest::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> from inspect import signature
|
|
|
|
>>> def foo(a, *, b:int, **kwargs):
|
|
|
|
... pass
|
|
|
|
|
|
|
|
>>> sig = signature(foo)
|
|
|
|
|
|
|
|
>>> str(sig)
|
2023-12-03 05:37:34 -04:00
|
|
|
'(a, *, b: int, **kwargs)'
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> str(sig.parameters['b'])
|
2023-12-03 05:37:34 -04:00
|
|
|
'b: int'
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> sig.parameters['b'].annotation
|
|
|
|
<class 'int'>
|
|
|
|
|
2018-09-14 14:13:09 -03:00
|
|
|
Accepts a wide range of Python callables, from plain functions and classes to
|
2012-08-14 04:45:28 -03:00
|
|
|
:func:`functools.partial` objects.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-10-20 19:54:02 -03:00
|
|
|
If the passed object has a ``__signature__`` attribute, this function
|
|
|
|
returns it without further computations.
|
|
|
|
|
2021-04-30 01:16:28 -03:00
|
|
|
For objects defined in modules using stringized annotations
|
|
|
|
(``from __future__ import annotations``), :func:`signature` will
|
|
|
|
attempt to automatically un-stringize the annotations using
|
2023-12-02 09:13:44 -04:00
|
|
|
:func:`get_annotations`. The
|
2023-12-03 05:37:34 -04:00
|
|
|
*globals*, *locals*, and *eval_str* parameters are passed
|
2023-12-02 09:13:44 -04:00
|
|
|
into :func:`get_annotations` when resolving the
|
|
|
|
annotations; see the documentation for :func:`get_annotations`
|
2021-04-30 01:16:28 -03:00
|
|
|
for instructions on how to use these parameters.
|
2014-01-24 10:17:25 -04:00
|
|
|
|
2021-04-30 01:16:28 -03:00
|
|
|
Raises :exc:`ValueError` if no signature can be provided, and
|
|
|
|
:exc:`TypeError` if that type of object is not supported. Also,
|
2023-12-02 09:13:44 -04:00
|
|
|
if the annotations are stringized, and *eval_str* is not false,
|
|
|
|
the ``eval()`` call(s) to un-stringize the annotations in :func:`get_annotations`
|
|
|
|
could potentially raise any kind of exception.
|
2020-12-23 18:45:13 -04:00
|
|
|
|
2019-03-10 08:30:11 -03:00
|
|
|
A slash(/) in the signature of a function denotes that the parameters prior
|
|
|
|
to it are positional-only. For more info, see
|
|
|
|
:ref:`the FAQ entry on positional-only parameters <faq-positional-only-arguments>`.
|
|
|
|
|
2023-12-02 09:13:44 -04:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
The *follow_wrapped* parameter was added.
|
|
|
|
Pass ``False`` to get a signature of
|
|
|
|
*callable* specifically (``callable.__wrapped__`` will not be used to
|
2015-05-20 15:30:08 -03:00
|
|
|
unwrap decorated callables.)
|
|
|
|
|
2023-12-02 09:13:44 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
The *globals*, *locals*, and *eval_str* parameters were added.
|
2020-12-23 18:45:13 -04:00
|
|
|
|
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
|
|
|
|
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. class:: Signature(parameters=None, *, return_annotation=Signature.empty)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
A :class:`!Signature` object represents the call signature of a function
|
|
|
|
and its return
|
2012-08-14 04:45:28 -03:00
|
|
|
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.
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
The optional *return_annotation* argument can be an arbitrary Python object.
|
|
|
|
It represents the "return" annotation of the callable.
|
2014-01-30 01:10:54 -04:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` or
|
2023-09-06 17:55:42 -03:00
|
|
|
:func:`copy.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
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`!Signature` objects are now picklable and :term:`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
|
|
|
|
|
2020-03-02 05:54:49 -04:00
|
|
|
An ordered mapping of parameters' names to the corresponding
|
|
|
|
:class:`Parameter` objects. Parameters appear in strict definition
|
|
|
|
order, including keyword-only parameters.
|
2018-01-28 15:13:09 -04:00
|
|
|
|
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Python only explicitly guaranteed that it preserved the declaration
|
|
|
|
order of keyword-only parameters as of version 3.7, although in practice
|
|
|
|
this order had always been preserved in Python 3.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
.. 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
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Create a new :class:`Signature` instance based on the instance
|
|
|
|
:meth:`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
|
|
|
|
:class:`!Signature`, pass in
|
2012-08-14 04:45:28 -03:00
|
|
|
:attr:`Signature.empty`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
.. doctest::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
>>> def test(a, b):
|
|
|
|
... pass
|
2022-12-08 23:31:19 -04:00
|
|
|
...
|
2012-08-13 11:10:28 -03:00
|
|
|
>>> sig = signature(test)
|
|
|
|
>>> new_sig = sig.replace(return_annotation="new return anno")
|
|
|
|
>>> str(new_sig)
|
|
|
|
"(a, b) -> 'new return anno'"
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`Signature` objects are also supported by the generic function
|
2023-09-06 17:55:42 -03:00
|
|
|
:func:`copy.replace`.
|
|
|
|
|
2023-12-02 19:39:43 -04:00
|
|
|
.. method:: format(*, max_width=None)
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Create a string representation of the :class:`Signature` object.
|
2023-12-02 19:39:43 -04:00
|
|
|
|
|
|
|
If *max_width* is passed, the method will attempt to fit
|
|
|
|
the signature into lines of at most *max_width* characters.
|
|
|
|
If the signature is longer than *max_width*,
|
|
|
|
all parameters will be on separate lines.
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
2023-12-02 09:13:44 -04:00
|
|
|
.. classmethod:: Signature.from_callable(obj, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)
|
2014-03-27 13:09:24 -03:00
|
|
|
|
|
|
|
Return a :class:`Signature` (or its subclass) object for a given callable
|
2023-12-02 09:13:44 -04:00
|
|
|
*obj*.
|
2014-03-27 13:09:24 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
This method simplifies subclassing of :class:`Signature`:
|
|
|
|
|
|
|
|
.. testcode::
|
2014-03-27 13:09:24 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
class MySignature(Signature):
|
|
|
|
pass
|
|
|
|
sig = MySignature.from_callable(sum)
|
|
|
|
assert isinstance(sig, MySignature)
|
2014-03-27 13:09:24 -03:00
|
|
|
|
2023-10-20 19:54:02 -03:00
|
|
|
Its behavior is otherwise identical to that of :func:`signature`.
|
|
|
|
|
2014-03-29 14:18:30 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2023-12-02 09:13:44 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
The *globals*, *locals*, and *eval_str* parameters were added.
|
2020-12-23 18:45:13 -04:00
|
|
|
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. class:: Parameter(name, kind, *, default=Parameter.empty, annotation=Parameter.empty)
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`!Parameter` objects are *immutable*.
|
|
|
|
Instead of modifying a :class:`!Parameter` object,
|
2023-09-06 17:55:42 -03:00
|
|
|
you can use :meth:`Parameter.replace` or :func:`copy.replace` to create a modified copy.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2014-03-29 14:24:14 -03:00
|
|
|
.. versionchanged:: 3.5
|
2023-12-03 05:37:34 -04:00
|
|
|
Parameter objects are now picklable and :term:`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
|
|
|
|
2016-06-04 18:40:03 -03:00
|
|
|
.. impl-detail::
|
|
|
|
|
|
|
|
CPython generates implicit parameter names of the form ``.0`` on the
|
|
|
|
code objects used to implement comprehensions and generator
|
|
|
|
expressions.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.6
|
2023-12-03 05:37:34 -04:00
|
|
|
These parameter names are now exposed by this module as names like
|
2016-06-04 18:40:03 -03:00
|
|
|
``implicit0``.
|
|
|
|
|
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
|
|
|
|
|
2023-02-27 11:13:18 -04:00
|
|
|
Describes how argument values are bound to the parameter. The possible
|
|
|
|
values are accessible via :class:`Parameter` (like ``Parameter.KEYWORD_ONLY``),
|
|
|
|
and support comparison and ordering, in the following order:
|
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 |
|
2019-05-28 20:45:32 -03:00
|
|
|
| | argument. Positional only parameters are |
|
|
|
|
| | those which appear before a ``/`` entry (if |
|
|
|
|
| | present) in a Python function definition. |
|
2012-08-13 11:10:28 -03:00
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
| *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. |
|
|
|
|
+------------------------+----------------------------------------------+
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Example: print all keyword-only arguments without default values:
|
|
|
|
|
|
|
|
.. doctest::
|
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
|
|
|
|
|
2018-06-08 00:46:31 -03:00
|
|
|
.. attribute:: Parameter.kind.description
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Describes a enum value of :attr:`Parameter.kind`.
|
2018-06-08 00:46:31 -03:00
|
|
|
|
2018-06-08 13:07:52 -03:00
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Example: print all descriptions of arguments:
|
|
|
|
|
|
|
|
.. doctest::
|
2018-06-08 00:46:31 -03:00
|
|
|
|
|
|
|
>>> def foo(a, b, *, c, d=10):
|
|
|
|
... pass
|
|
|
|
|
|
|
|
>>> sig = signature(foo)
|
|
|
|
>>> for param in sig.parameters.values():
|
|
|
|
... print(param.kind.description)
|
|
|
|
positional or keyword
|
|
|
|
positional or keyword
|
|
|
|
keyword-only
|
|
|
|
keyword-only
|
|
|
|
|
2012-09-14 00:35:09 -03:00
|
|
|
.. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
Create a new :class:`Parameter` instance based on the instance replaced was invoked
|
|
|
|
on. To override a :class:`!Parameter` attribute, pass the corresponding
|
2012-08-14 04:45:28 -03:00
|
|
|
argument. To remove a default value or/and an annotation from a
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`!Parameter`, pass :attr:`Parameter.empty`.
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
.. doctest::
|
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'))
|
2023-12-03 05:37:34 -04:00
|
|
|
"foo: 'spam'"
|
2012-08-13 11:10:28 -03:00
|
|
|
|
2023-12-03 05:37:34 -04:00
|
|
|
:class:`Parameter` objects are also supported by the generic function
|
|
|
|
:func:`copy.replace`.
|
2023-09-06 17:55:42 -03:00
|
|
|
|
2021-05-21 14:05:35 -03:00
|
|
|
.. versionchanged:: 3.4
|
2023-12-03 05:37:34 -04:00
|
|
|
In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set
|
2021-05-21 14:05:35 -03:00
|
|
|
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
|
|
|
|
|
2020-03-02 05:54:49 -04:00
|
|
|
A mutable mapping of parameters' names to arguments' values.
|
2020-01-28 08:47:03 -04:00
|
|
|
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
|
|
|
|
2020-01-28 08:47:03 -04:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
:attr:`arguments` is now of type :class:`dict`. Formerly, it was of
|
|
|
|
type :class:`collections.OrderedDict`.
|
|
|
|
|
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.
|
|
|
|
|
2023-12-03 07:50:22 -04:00
|
|
|
.. doctest::
|
2015-05-16 14:45:09 -03:00
|
|
|
|
2023-12-03 07:50:22 -04:00
|
|
|
>>> def foo(a, b='ham', *args): pass
|
|
|
|
>>> ba = inspect.signature(foo).bind('spam')
|
|
|
|
>>> ba.apply_defaults()
|
|
|
|
>>> ba.arguments
|
|
|
|
{'a': 'spam', 'b': 'ham', 'args': ()}
|
2015-05-16 14:45:09 -03:00
|
|
|
|
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
|
2023-12-03 07:50:22 -04:00
|
|
|
functions:
|
|
|
|
|
|
|
|
.. testcode::
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
def test(a, *, b):
|
2016-05-10 06:01:23 -03:00
|
|
|
...
|
2012-08-13 11:10:28 -03:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2016-01-11 16:15:01 -04:00
|
|
|
|
2007-09-12 16:04:21 -03:00
|
|
|
.. function:: getfullargspec(func)
|
|
|
|
|
2016-12-02 06:29:57 -04:00
|
|
|
Get the names and default values of a Python function's parameters. A
|
2010-01-09 05:48:46 -04:00
|
|
|
: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
|
|
|
|
2016-12-02 06:29:57 -04:00
|
|
|
*args* is a list of the positional parameter names.
|
|
|
|
*varargs* is the name of the ``*`` parameter or ``None`` if arbitrary
|
|
|
|
positional arguments are not accepted.
|
|
|
|
*varkw* is the name of the ``**`` parameter or ``None`` if arbitrary
|
|
|
|
keyword arguments are not accepted.
|
|
|
|
*defaults* is an *n*-tuple of default argument values corresponding to the
|
|
|
|
last *n* positional parameters, or ``None`` if there are no such defaults
|
|
|
|
defined.
|
2018-01-28 15:13:09 -04:00
|
|
|
*kwonlyargs* is a list of keyword-only parameter names in declaration order.
|
2016-12-02 06:29:57 -04:00
|
|
|
*kwonlydefaults* is a dictionary mapping parameter names from *kwonlyargs*
|
|
|
|
to the default values used if no argument is supplied.
|
|
|
|
*annotations* is a dictionary mapping parameter names to annotations.
|
|
|
|
The special key ``"return"`` is used to report the function return value
|
|
|
|
annotation (if any).
|
|
|
|
|
|
|
|
Note that :func:`signature` and
|
|
|
|
:ref:`Signature Object <inspect-signature-object>` provide the recommended
|
|
|
|
API for callable introspection, and support additional behaviours (like
|
|
|
|
positional-only arguments) that are sometimes encountered in extension module
|
|
|
|
APIs. This function is retained primarily for use in code that needs to
|
|
|
|
maintain compatibility with the Python 2 ``inspect`` module API.
|
2007-09-12 16:04:21 -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.
|
|
|
|
|
2016-12-02 06:29:57 -04:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
This method was previously documented as deprecated in favour of
|
|
|
|
:func:`signature` in Python 3.5, but that decision has been reversed
|
|
|
|
in order to restore a clearly supported standard interface for
|
|
|
|
single-source Python 2/3 code migrating away from the legacy
|
|
|
|
:func:`getargspec` API.
|
2015-05-22 12:38:38 -03:00
|
|
|
|
2018-01-28 15:13:09 -04:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Python only explicitly guaranteed that it preserved the declaration
|
|
|
|
order of keyword-only parameters as of version 3.7, although in practice
|
|
|
|
this order had always been preserved in Python 3.
|
|
|
|
|
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
|
|
|
|
2017-02-22 01:45:51 -04:00
|
|
|
.. note::
|
|
|
|
This function was inadvertently marked as deprecated in Python 3.5.
|
2015-05-22 17:28:05 -03:00
|
|
|
|
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.
|
|
|
|
|
2017-02-22 01:45:51 -04:00
|
|
|
.. note::
|
|
|
|
This function was inadvertently marked as deprecated in Python 3.5.
|
2015-05-22 17:28:05 -03:00
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
2019-06-01 05:00:15 -03: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
|
2023-12-03 07:50:22 -04:00
|
|
|
and the same or similar message is raised. For example:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
|
|
|
|
>>> from inspect import getcallargs
|
|
|
|
>>> def f(a, b=1, *pos, **named):
|
|
|
|
... pass
|
|
|
|
...
|
|
|
|
>>> 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
|
|
|
|
>>> getcallargs(f)
|
|
|
|
Traceback (most recent call last):
|
|
|
|
...
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-04-30 01:16:28 -03:00
|
|
|
.. function:: get_annotations(obj, *, globals=None, locals=None, eval_str=False)
|
|
|
|
|
|
|
|
Compute the annotations dict for an object.
|
|
|
|
|
|
|
|
``obj`` may be a callable, class, or module.
|
|
|
|
Passing in an object of any other type raises :exc:`TypeError`.
|
|
|
|
|
|
|
|
Returns a dict. ``get_annotations()`` returns a new dict every time
|
|
|
|
it's called; calling it twice on the same object will return two
|
|
|
|
different but equivalent dicts.
|
|
|
|
|
|
|
|
This function handles several details for you:
|
|
|
|
|
|
|
|
* If ``eval_str`` is true, values of type ``str`` will
|
|
|
|
be un-stringized using :func:`eval()`. This is intended
|
|
|
|
for use with stringized annotations
|
|
|
|
(``from __future__ import annotations``).
|
|
|
|
* If ``obj`` doesn't have an annotations dict, returns an
|
|
|
|
empty dict. (Functions and methods always have an
|
|
|
|
annotations dict; classes, modules, and other types of
|
|
|
|
callables may not.)
|
|
|
|
* Ignores inherited annotations on classes. If a class
|
|
|
|
doesn't have its own annotations dict, returns an empty dict.
|
|
|
|
* All accesses to object members and dict values are done
|
|
|
|
using ``getattr()`` and ``dict.get()`` for safety.
|
2022-07-05 06:16:10 -03:00
|
|
|
* Always, always, always returns a freshly created dict.
|
2021-04-30 01:16:28 -03:00
|
|
|
|
|
|
|
``eval_str`` controls whether or not values of type ``str`` are replaced
|
|
|
|
with the result of calling :func:`eval()` on those values:
|
|
|
|
|
|
|
|
* If eval_str is true, :func:`eval()` is called on values of type ``str``.
|
2021-05-02 01:19:24 -03:00
|
|
|
(Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval()`
|
|
|
|
raises an exception, it will unwind the stack past the ``get_annotations``
|
|
|
|
call.)
|
2021-04-30 01:16:28 -03:00
|
|
|
* If eval_str is false (the default), values of type ``str`` are unchanged.
|
|
|
|
|
|
|
|
``globals`` and ``locals`` are passed in to :func:`eval()`; see the documentation
|
|
|
|
for :func:`eval()` for more information. If ``globals`` or ``locals``
|
|
|
|
is ``None``, this function may replace that value with a context-specific
|
|
|
|
default, contingent on ``type(obj)``:
|
|
|
|
|
|
|
|
* If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``.
|
|
|
|
* If ``obj`` is a class, ``globals`` defaults to
|
|
|
|
``sys.modules[obj.__module__].__dict__`` and ``locals`` defaults
|
|
|
|
to the ``obj`` class namespace.
|
|
|
|
* If ``obj`` is a callable, ``globals`` defaults to ``obj.__globals__``,
|
|
|
|
although if ``obj`` is a wrapped function (using
|
|
|
|
``functools.update_wrapper()``) it is first unwrapped.
|
|
|
|
|
2021-05-02 01:19:24 -03:00
|
|
|
Calling ``get_annotations`` is best practice for accessing the
|
|
|
|
annotations dict of any object. See :ref:`annotations-howto` for
|
|
|
|
more information on annotations best practices.
|
|
|
|
|
2021-04-30 01:16:28 -03:00
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _inspect-stack:
|
|
|
|
|
|
|
|
The interpreter stack
|
|
|
|
---------------------
|
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Some of the following functions return
|
|
|
|
:class:`FrameInfo` objects. For backwards compatibility these objects allow
|
|
|
|
tuple-like operations on all attributes except ``positions``. This behavior
|
|
|
|
is considered deprecated and may be removed in the future.
|
|
|
|
|
|
|
|
.. class:: FrameInfo
|
|
|
|
|
|
|
|
.. attribute:: frame
|
|
|
|
|
|
|
|
The :ref:`frame object <frame-objects>` that the record corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: filename
|
|
|
|
|
|
|
|
The file name associated with the code being executed by the frame this record
|
|
|
|
corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: lineno
|
|
|
|
|
|
|
|
The line number of the current line associated with the code being
|
|
|
|
executed by the frame this record corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: function
|
|
|
|
|
|
|
|
The function name that is being executed by the frame this record corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: code_context
|
|
|
|
|
|
|
|
A list of lines of context from the source code that's being executed by the frame
|
|
|
|
this record corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: index
|
|
|
|
|
|
|
|
The index of the current line being executed in the :attr:`code_context` list.
|
|
|
|
|
|
|
|
.. attribute:: positions
|
|
|
|
|
|
|
|
A :class:`dis.Positions` object containing the start line number, end line
|
|
|
|
number, start column offset, and end column offset associated with the
|
|
|
|
instruction being executed by the frame this record corresponds to.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-10-22 16:12:04 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Return a :term:`named tuple` instead of a :class:`tuple`.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.11
|
|
|
|
:class:`!FrameInfo` is now a class instance
|
|
|
|
(that is backwards compatible with the previous :term:`named tuple`).
|
2014-08-24 11:50:28 -03:00
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
|
|
|
|
.. class:: Traceback
|
|
|
|
|
|
|
|
.. attribute:: filename
|
|
|
|
|
|
|
|
The file name associated with the code being executed by the frame this traceback
|
|
|
|
corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: lineno
|
|
|
|
|
|
|
|
The line number of the current line associated with the code being
|
|
|
|
executed by the frame this traceback corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: function
|
|
|
|
|
|
|
|
The function name that is being executed by the frame this traceback corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: code_context
|
|
|
|
|
|
|
|
A list of lines of context from the source code that's being executed by the frame
|
|
|
|
this traceback corresponds to.
|
|
|
|
|
|
|
|
.. attribute:: index
|
|
|
|
|
|
|
|
The index of the current line being executed in the :attr:`code_context` list.
|
|
|
|
|
|
|
|
.. attribute:: positions
|
|
|
|
|
|
|
|
A :class:`dis.Positions` object containing the start line number, end
|
|
|
|
line number, start column offset, and end column offset associated with
|
|
|
|
the instruction being executed by the frame this traceback corresponds
|
|
|
|
to.
|
|
|
|
|
2022-10-22 16:12:04 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
:class:`!Traceback` is now a class instance
|
|
|
|
(that is backwards compatible with the previous :term:`named 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
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Get information about a frame or traceback object. A :class:`Traceback` object
|
|
|
|
is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
A :class:`Traceback` object is returned instead of a named tuple.
|
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
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Get a list of :class:`FrameInfo` objects 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.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 23:40:30 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
A list of :term:`named tuples <named tuple>`
|
|
|
|
``FrameInfo(frame, filename, lineno, function, code_context, index)``
|
|
|
|
is returned.
|
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
A list of :class:`FrameInfo` objects is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: getinnerframes(traceback, context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Get a list of :class:`FrameInfo` objects 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.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 23:40:30 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
A list of :term:`named tuples <named tuple>`
|
|
|
|
``FrameInfo(frame, filename, lineno, function, code_context, index)``
|
|
|
|
is returned.
|
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
A list of :class:`FrameInfo` objects is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. 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
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Return a list of :class:`FrameInfo` objects 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.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 23:40:30 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
A list of :term:`named tuples <named tuple>`
|
|
|
|
``FrameInfo(frame, filename, lineno, function, code_context, index)``
|
|
|
|
is returned.
|
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
A list of :class:`FrameInfo` objects is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-01 14:35:27 -03:00
|
|
|
.. function:: trace(context=1)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
Return a list of :class:`FrameInfo` objects 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.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 23:40:30 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
A list of :term:`named tuples <named tuple>`
|
|
|
|
``FrameInfo(frame, filename, lineno, function, code_context, index)``
|
|
|
|
is returned.
|
|
|
|
|
2022-04-22 23:16:48 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
A list of :class:`FrameInfo` objects is returned.
|
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
|
2023-12-03 13:32:49 -04:00
|
|
|
properties, will be invoked and :meth:`~object.__getattr__` and
|
|
|
|
:meth:`~object.__getattribute__`
|
2010-11-20 11:07:30 -04:00
|
|
|
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
|
2023-12-03 13:32:49 -04:00
|
|
|
descriptor protocol, :meth:`~object.__getattr__`
|
|
|
|
or :meth:`~object.__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
|
|
|
|
2023-03-11 09:19:40 -04:00
|
|
|
Current State of Generators, Coroutines, and Asynchronous Generators
|
|
|
|
--------------------------------------------------------------------
|
2010-11-20 23:44:04 -04:00
|
|
|
|
|
|
|
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:
|
2023-10-11 17:24:12 -03: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
|
|
|
|
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
|
|
|
.. function:: getcoroutinestate(coroutine)
|
|
|
|
|
|
|
|
Get current state of a coroutine object. The function is intended to be
|
|
|
|
used with coroutine objects created by :keyword:`async def` functions, but
|
|
|
|
will accept any coroutine-like object that has ``cr_running`` and
|
|
|
|
``cr_frame`` attributes.
|
|
|
|
|
|
|
|
Possible states are:
|
2023-10-11 17:24:12 -03:00
|
|
|
|
|
|
|
* CORO_CREATED: Waiting to start execution.
|
|
|
|
* CORO_RUNNING: Currently being executed by the interpreter.
|
|
|
|
* CORO_SUSPENDED: Currently suspended at an await expression.
|
|
|
|
* CORO_CLOSED: Execution has completed.
|
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2023-03-11 09:19:40 -04:00
|
|
|
.. function:: getasyncgenstate(agen)
|
|
|
|
|
|
|
|
Get current state of an asynchronous generator object. The function is
|
|
|
|
intended to be used with asynchronous iterator objects created by
|
|
|
|
:keyword:`async def` functions which use the :keyword:`yield` statement,
|
|
|
|
but will accept any asynchronous generator-like object that has
|
|
|
|
``ag_running`` and ``ag_frame`` attributes.
|
|
|
|
|
|
|
|
Possible states are:
|
2023-10-11 17:24:12 -03:00
|
|
|
|
|
|
|
* AGEN_CREATED: Waiting to start execution.
|
|
|
|
* AGEN_RUNNING: Currently being executed by the interpreter.
|
|
|
|
* AGEN_SUSPENDED: Currently suspended at a yield expression.
|
|
|
|
* AGEN_CLOSED: Execution has completed.
|
2023-03-11 09:19:40 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
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
|
|
|
|
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
|
|
|
.. function:: getcoroutinelocals(coroutine)
|
|
|
|
|
|
|
|
This function is analogous to :func:`~inspect.getgeneratorlocals`, but
|
|
|
|
works for coroutine objects created by :keyword:`async def` functions.
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2023-03-11 09:19:40 -04:00
|
|
|
.. function:: getasyncgenlocals(agen)
|
|
|
|
|
|
|
|
This function is analogous to :func:`~inspect.getgeneratorlocals`, but
|
|
|
|
works for asynchronous generator objects created by :keyword:`async def`
|
|
|
|
functions which use the :keyword:`yield` statement.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2013-09-22 09:46:49 -03:00
|
|
|
|
2016-10-20 14:06:30 -03:00
|
|
|
.. _inspect-module-co-flags:
|
|
|
|
|
|
|
|
Code Objects Bit Flags
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Python code objects have a ``co_flags`` attribute, which is a bitmap of
|
|
|
|
the following flags:
|
|
|
|
|
2017-04-12 23:38:28 -03:00
|
|
|
.. data:: CO_OPTIMIZED
|
|
|
|
|
|
|
|
The code object is optimized, using fast locals.
|
|
|
|
|
2016-10-20 14:06:30 -03:00
|
|
|
.. data:: CO_NEWLOCALS
|
|
|
|
|
|
|
|
If set, a new dict will be created for the frame's ``f_locals`` when
|
|
|
|
the code object is executed.
|
|
|
|
|
|
|
|
.. data:: CO_VARARGS
|
|
|
|
|
|
|
|
The code object has a variable positional parameter (``*args``-like).
|
|
|
|
|
|
|
|
.. data:: CO_VARKEYWORDS
|
|
|
|
|
|
|
|
The code object has a variable keyword parameter (``**kwargs``-like).
|
|
|
|
|
2017-04-12 23:38:28 -03:00
|
|
|
.. data:: CO_NESTED
|
|
|
|
|
|
|
|
The flag is set when the code object is a nested function.
|
|
|
|
|
2016-10-20 14:06:30 -03:00
|
|
|
.. data:: CO_GENERATOR
|
|
|
|
|
|
|
|
The flag is set when the code object is a generator function, i.e.
|
|
|
|
a generator object is returned when the code object is executed.
|
|
|
|
|
|
|
|
.. data:: CO_COROUTINE
|
|
|
|
|
2016-10-20 17:30:51 -03:00
|
|
|
The flag is set when the code object is a coroutine function.
|
|
|
|
When the code object is executed it returns a coroutine object.
|
|
|
|
See :pep:`492` for more details.
|
2016-10-20 14:06:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
.. data:: CO_ITERABLE_COROUTINE
|
|
|
|
|
2016-10-20 17:30:51 -03:00
|
|
|
The flag is used to transform generators into generator-based
|
|
|
|
coroutines. Generator objects with this flag can be used in
|
|
|
|
``await`` expression, and can ``yield from`` coroutine objects.
|
|
|
|
See :pep:`492` for more details.
|
2016-10-20 14:06:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2016-10-20 14:11:34 -03:00
|
|
|
.. data:: CO_ASYNC_GENERATOR
|
|
|
|
|
2016-10-20 17:30:51 -03:00
|
|
|
The flag is set when the code object is an asynchronous generator
|
|
|
|
function. When the code object is executed it returns an
|
|
|
|
asynchronous generator object. See :pep:`525` for more details.
|
2016-10-20 14:11:34 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
2016-10-20 14:06:30 -03:00
|
|
|
.. note::
|
|
|
|
The flags are specific to CPython, and may not be defined in other
|
|
|
|
Python implementations. Furthermore, the flags are an implementation
|
|
|
|
detail, and can be removed or deprecated in future Python releases.
|
|
|
|
It's recommended to use public APIs from the :mod:`inspect` module
|
|
|
|
for any introspection needs.
|
|
|
|
|
|
|
|
|
2023-05-04 12:23:40 -03:00
|
|
|
Buffer flags
|
|
|
|
------------
|
|
|
|
|
|
|
|
.. class:: BufferFlags
|
|
|
|
|
|
|
|
This is an :class:`enum.IntFlag` that represents the flags that
|
|
|
|
can be passed to the :meth:`~object.__buffer__` method of objects
|
|
|
|
implementing the :ref:`buffer protocol <bufferobjects>`.
|
|
|
|
|
|
|
|
The meaning of the flags is explained at :ref:`buffer-request-types`.
|
|
|
|
|
|
|
|
.. attribute:: BufferFlags.SIMPLE
|
|
|
|
.. attribute:: BufferFlags.WRITABLE
|
|
|
|
.. attribute:: BufferFlags.FORMAT
|
|
|
|
.. attribute:: BufferFlags.ND
|
|
|
|
.. attribute:: BufferFlags.STRIDES
|
|
|
|
.. attribute:: BufferFlags.C_CONTIGUOUS
|
|
|
|
.. attribute:: BufferFlags.F_CONTIGUOUS
|
|
|
|
.. attribute:: BufferFlags.ANY_CONTIGUOUS
|
|
|
|
.. attribute:: BufferFlags.INDIRECT
|
|
|
|
.. attribute:: BufferFlags.CONTIG
|
|
|
|
.. attribute:: BufferFlags.CONTIG_RO
|
|
|
|
.. attribute:: BufferFlags.STRIDED
|
|
|
|
.. attribute:: BufferFlags.STRIDED_RO
|
|
|
|
.. attribute:: BufferFlags.RECORDS
|
|
|
|
.. attribute:: BufferFlags.RECORDS_RO
|
|
|
|
.. attribute:: BufferFlags.FULL
|
|
|
|
.. attribute:: BufferFlags.FULL_RO
|
|
|
|
.. attribute:: BufferFlags.READ
|
|
|
|
.. attribute:: BufferFlags.WRITE
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
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.
|
|
|
|
|
2023-10-03 14:38:12 -03:00
|
|
|
.. option:: --details
|
2013-09-22 09:46:49 -03:00
|
|
|
|
|
|
|
Print information about the specified object rather than the source code
|