2007-08-15 11:28:22 -03:00
:mod: `sys` --- System-specific parameters and functions
=======================================================
.. module :: sys
:synopsis: Access system-specific parameters and functions.
2016-06-11 16:02:54 -03:00
--------------
2007-08-15 11:28:22 -03:00
This module provides access to some variables used or maintained by the
interpreter and to functions that interact strongly with the interpreter. It is
always available.
2010-10-16 11:17:50 -03:00
.. data :: abiflags
2014-03-24 05:06:18 -03:00
On POSIX systems where Python was built with the standard `` configure ``
2010-10-16 11:17:50 -03:00
script, this contains the ABI flags as specified by :pep: `3149` .
2019-06-14 22:24:41 -03:00
.. versionchanged :: 3.8
Default flags became an empty string (`` m `` flag for pymalloc has been
removed).
2010-10-16 11:17:50 -03:00
.. versionadded :: 3.2
2023-09-27 12:24:12 -03:00
.. availability :: Unix.
2014-03-24 05:06:18 -03:00
2019-05-23 12:45:22 -03:00
.. function :: addaudithook(hook)
2019-11-26 13:07:48 -04:00
Append the callable *hook* to the list of active auditing hooks for the
2021-04-21 19:34:29 -03:00
current (sub)interpreter.
2019-05-23 12:45:22 -03:00
When an auditing event is raised through the :func: `sys.audit` function, each
hook will be called in the order it was added with the event name and the
tuple of arguments. Native hooks added by :c:func: `PySys_AddAuditHook` are
2021-04-21 19:34:29 -03:00
called first, followed by hooks added in the current (sub)interpreter. Hooks
2020-10-20 11:41:02 -03:00
can then log the event, raise an exception to abort the operation,
or terminate the process entirely.
2019-05-23 12:45:22 -03:00
2022-11-11 09:35:02 -04:00
Note that audit hooks are primarily for collecting information about internal
or otherwise unobservable actions, whether by Python or libraries written in
Python. They are not suitable for implementing a "sandbox". In particular,
malicious code can trivially disable or bypass hooks added using this
function. At a minimum, any security-sensitive hooks must be added using the
C API :c:func: `PySys_AddAuditHook` before initialising the runtime, and any
modules allowing arbitrary memory modification (such as :mod: `ctypes` ) should
be completely removed or closely monitored.
2019-10-26 17:02:30 -03:00
.. audit-event :: sys.addaudithook "" sys.addaudithook
2020-10-20 11:41:02 -03:00
Calling :func: `sys.addaudithook` will itself raise an auditing event
named `` sys.addaudithook `` with no arguments. If any
2019-11-28 12:46:11 -04:00
existing hooks raise an exception derived from :class: `RuntimeError` , the
2019-10-26 17:02:30 -03:00
new hook will not be added and the exception suppressed. As a result,
callers cannot assume that their hook has been added unless they control
all existing hooks.
2019-05-23 12:45:22 -03:00
2020-10-20 11:41:02 -03:00
See the :ref: `audit events table <audit-events>` for all events raised by
CPython, and :pep: `578` for the original design discussion.
2019-05-23 12:45:22 -03:00
.. versionadded :: 3.8
2019-11-28 12:46:11 -04:00
.. versionchanged :: 3.8.1
Exceptions derived from :class: `Exception` but not :class: `RuntimeError`
are no longer suppressed.
2019-05-23 12:45:22 -03:00
.. impl-detail ::
2019-10-26 17:02:30 -03:00
When tracing is enabled (see :func: `settrace` ), Python hooks are only
traced if the callable has a `` __cantrace__ `` member that is set to a
true value. Otherwise, trace functions will skip the hook.
2019-05-23 12:45:22 -03:00
2007-08-15 11:28:22 -03:00
.. data :: argv
The list of command line arguments passed to a Python script. `` argv[0] `` is the
script name (it is operating system dependent whether this is a full pathname or
not). If the command was executed using the :option: `-c` command line option to
the interpreter, `` argv[0] `` is set to the string `` '-c' `` . If no script name
was passed to the Python interpreter, `` argv[0] `` is the empty string.
To loop over the standard input, or the list of files given on the
command line, see the :mod: `fileinput` module.
2020-06-29 19:49:03 -03:00
See also :data: `sys.orig_argv` .
2019-03-30 02:32:08 -03:00
.. note ::
On Unix, command line arguments are passed by bytes from OS. Python decodes
them with filesystem encoding and "surrogateescape" error handler.
When you need original bytes, you can get it by
`` [os.fsencode(arg) for arg in sys.argv] `` .
2007-08-15 11:28:22 -03:00
2019-05-23 12:45:22 -03:00
.. _auditing:
.. function :: audit(event, *args)
.. index :: single: auditing
2020-10-20 11:41:02 -03:00
Raise an auditing event and trigger any active auditing hooks.
*event* is a string identifying the event, and *args* may contain
optional arguments with more information about the event. The
number and types of arguments for a given event are considered a
public and stable API and should not be modified between releases.
For example, one auditing event is named `` os.chdir `` . This event has
one argument called *path* that will contain the requested new
working directory.
:func: `sys.audit` will call the existing auditing hooks, passing
the event name and arguments, and will re-raise the first exception
from any hook. In general, if an exception is raised, it should not
be handled and the process should be terminated as quickly as
possible. This allows hook implementations to decide how to respond
to particular events: they can merely log the event or abort the
operation by raising an exception.
2019-05-23 12:45:22 -03:00
Hooks are added using the :func: `sys.addaudithook` or
:c:func: `PySys_AddAuditHook` functions.
The native equivalent of this function is :c:func: `PySys_Audit` . Using the
native function is preferred when possible.
2019-06-27 14:47:59 -03:00
See the :ref: `audit events table <audit-events>` for all events raised by
2019-10-26 17:02:30 -03:00
CPython.
2019-06-27 14:47:59 -03:00
2019-05-23 12:45:22 -03:00
.. versionadded :: 3.8
2012-05-25 23:45:29 -03:00
.. data :: base_exec_prefix
Set during Python startup, before `` site.py `` is run, to the same value as
2012-07-09 06:37:01 -03:00
:data: `exec_prefix` . If not running in a
:ref: `virtual environment <venv-def>` , the values will stay the same; if
`` site.py `` finds that a virtual environment is in use, the values of
:data: `prefix` and :data: `exec_prefix` will be changed to point to the
virtual environment, whereas :data: `base_prefix` and
2012-05-25 23:45:29 -03:00
:data: `base_exec_prefix` will remain pointing to the base Python
installation (the one which the virtual environment was created from).
2012-05-26 04:11:22 -03:00
.. versionadded :: 3.3
2012-05-25 23:45:29 -03:00
.. data :: base_prefix
Set during Python startup, before `` site.py `` is run, to the same value as
2012-07-09 06:37:01 -03:00
:data: `prefix` . If not running in a :ref: `virtual environment <venv-def>` , the values
2012-05-25 23:45:29 -03:00
will stay the same; if `` site.py `` finds that a virtual environment is in
use, the values of :data: `prefix` and :data: `exec_prefix` will be changed to
point to the virtual environment, whereas :data: `base_prefix` and
:data: `base_exec_prefix` will remain pointing to the base Python
installation (the one which the virtual environment was created from).
2012-05-26 04:11:22 -03:00
.. versionadded :: 3.3
2007-08-15 11:28:22 -03:00
.. data :: byteorder
An indicator of the native byte order. This will have the value `` 'big' `` on
big-endian (most-significant byte first) platforms, and `` 'little' `` on
little-endian (least-significant byte first) platforms.
.. data :: builtin_module_names
2021-01-25 08:24:42 -04:00
A tuple of strings containing the names of all modules that are compiled into this
2007-08-15 11:28:22 -03:00
Python interpreter. (This information is not available in any other way ---
`` modules.keys() `` only lists the imported modules.)
2023-07-21 06:34:30 -03:00
See also the :data: `sys.stdlib_module_names` list.
2021-01-25 08:24:42 -04:00
2007-08-15 11:28:22 -03:00
2010-10-17 08:06:14 -03:00
.. function :: call_tracing(func, args)
Call `` func(*args) `` , while tracing is enabled. The tracing state is saved,
and restored afterwards. This is intended to be called from a debugger from
2023-10-31 13:24:54 -03:00
a checkpoint, to recursively debug or profile some other code.
Tracing is suspended while calling a tracing function set by
:func: `settrace` or :func: `setprofile` to avoid infinite recursion.
:func: `!call_tracing` enables explicit recursion of the tracing function.
2010-10-17 08:06:14 -03:00
2007-08-15 11:28:22 -03:00
.. data :: copyright
A string containing the copyright pertaining to the Python interpreter.
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552-60567 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60553 | neal.norwitz | 2008-02-03 17:53:09 +0100 (Sun, 03 Feb 2008) | 1 line
Ignore leaky warnings from test_asynchat
........
r60555 | christian.heimes | 2008-02-03 20:51:13 +0100 (Sun, 03 Feb 2008) | 1 line
Another int -> pid_t case
........
r60560 | amaury.forgeotdarc | 2008-02-03 23:51:43 +0100 (Sun, 03 Feb 2008) | 6 lines
Ensure that PySet_Add() operates on a newly created frozenset, like PyTuple_SetItem does.
Add PyFrozenSet_Check(), which was not needed before; The list of Py*Set_Check* macros seems to be complete now.
Add missing NEWS entries about all this.
........
r60563 | amaury.forgeotdarc | 2008-02-04 00:14:32 +0100 (Mon, 04 Feb 2008) | 2 lines
Nasty typo in setobject.h
........
r60564 | amaury.forgeotdarc | 2008-02-04 00:15:32 +0100 (Mon, 04 Feb 2008) | 3 lines
Correct test_mailbox on win32: since the test sets a custom 'colon' attribute
to the main mailbox, copy it to secondary mailbox instances.
........
r60565 | amaury.forgeotdarc | 2008-02-04 00:57:24 +0100 (Mon, 04 Feb 2008) | 2 lines
Let test_socketserver pass on win32, which does not have AF_UNIX sockets.
........
r60566 | jeffrey.yasskin | 2008-02-04 02:04:35 +0100 (Mon, 04 Feb 2008) | 2 lines
Make int() and long() fall back to __trunc__(). See issue 2002.
........
r60567 | christian.heimes | 2008-02-04 19:00:12 +0100 (Mon, 04 Feb 2008) | 3 lines
Patch #1953
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers.
The patch also renames sys._cleartypecache to sys._clear_type_cache
........
2008-02-04 14:48:49 -04:00
.. function :: _clear_type_cache()
Clear the internal type cache. The type cache is used to speed up attribute
and method lookups. Use the function *only* to drop unnecessary references
during reference leak debugging.
This function should be used for internal and specialized purposes only.
2008-01-27 19:50:43 -04:00
2024-02-12 05:04:36 -04:00
.. deprecated :: 3.13
Use the more general :func: `_clear_internal_caches` function instead.
.. function :: _clear_internal_caches()
Clear all internal performance-related caches. Use this function *only* to
release unnecessary references and memory blocks when hunting for leaks.
.. versionadded :: 3.13
2008-01-27 19:50:43 -04:00
2007-08-15 11:28:22 -03:00
.. function :: _current_frames()
Return a dictionary mapping each thread's identifier to the topmost stack frame
currently active in that thread at the time the function is called. Note that
functions in the :mod: `traceback` module can build the call stack given such a
frame.
This is most useful for debugging deadlock: this function does not require the
deadlocked threads' cooperation, and such threads' call stacks are frozen for as
long as they remain deadlocked. The frame returned for a non-deadlocked thread
may bear no relationship to that thread's current activity by the time calling
code examines the frame.
This function should be used for internal and specialized purposes only.
2019-06-27 14:47:59 -03:00
.. audit-event :: sys._current_frames "" sys._current_frames
2019-05-23 12:45:22 -03:00
2020-11-02 10:16:25 -04:00
.. function :: _current_exceptions()
Return a dictionary mapping each thread's identifier to the topmost exception
currently active in that thread at the time the function is called.
If a thread is not currently handling an exception, it is not included in
the result dictionary.
This is most useful for statistical profiling.
This function should be used for internal and specialized purposes only.
.. audit-event :: sys._current_exceptions "" sys._current_exceptions
2007-08-15 11:28:22 -03:00
2023-04-11 05:38:37 -03:00
.. versionchanged :: 3.12
Each value in the dictionary is now a single exception instance, rather
than a 3-tuple as returned from `` sys.exc_info() `` .
2017-10-05 13:11:18 -03:00
.. function :: breakpointhook()
This hook function is called by built-in :func: `breakpoint` . By default,
it drops you into the :mod: `pdb` debugger, but it can be set to any other
function so that you can choose which debugger gets used.
The signature of this function is dependent on what it calls. For example,
the default binding (e.g. `` pdb.set_trace() `` ) expects no arguments, but
you might bind it to a function that expects additional arguments
(positional and/or keyword). The built-in `` breakpoint() `` function passes
its `` *args `` and `` **kws `` straight through. Whatever
`` breakpointhooks() `` returns is returned from `` breakpoint() `` .
The default implementation first consults the environment variable
:envvar: `PYTHONBREAKPOINT` . If that is set to `` "0" `` then this function
returns immediately; i.e. it is a no-op. If the environment variable is
not set, or is set to the empty string, `` pdb.set_trace() `` is called.
Otherwise this variable should name a function to run, using Python's
dotted-import nomenclature, e.g. `` package.subpackage.module.function `` .
In this case, `` package.subpackage.module `` would be imported and the
resulting module must have a callable named `` function() `` . This is run,
passing in `` *args `` and `` **kws `` , and whatever `` function() `` returns,
`` sys.breakpointhook() `` returns to the built-in :func: `breakpoint`
function.
Note that if anything goes wrong while importing the callable named by
:envvar: `PYTHONBREAKPOINT` , a :exc: `RuntimeWarning` is reported and the
breakpoint is ignored.
Also note that if `` sys.breakpointhook() `` is overridden programmatically,
:envvar: `PYTHONBREAKPOINT` is *not* consulted.
.. versionadded :: 3.7
2012-06-22 15:55:41 -03:00
.. function :: _debugmallocstats()
Print low-level information to stderr about the state of CPython's memory
allocator.
2022-10-06 22:01:30 -03:00
If Python is :ref: `built in debug mode <debug-build>` (:option:`configure
2021-04-12 18:27:35 -03:00
--with-pydebug option <--with-pydebug>`), it also performs some expensive
internal consistency checks.
2012-06-22 15:55:41 -03:00
.. versionadded :: 3.3
.. impl-detail ::
This function is specific to CPython. The exact output format is not
defined here, and may change.
2007-08-15 11:28:22 -03:00
.. data :: dllhandle
2018-10-12 11:55:20 -03:00
Integer specifying the handle of the Python DLL.
.. availability :: Windows.
2007-08-15 11:28:22 -03:00
.. function :: displayhook(value)
2010-12-04 13:24:33 -04:00
If *value* is not `` None `` , this function prints `` repr(value) `` to
`` sys.stdout `` , and saves *value* in `` builtins._ `` . If `` repr(value) `` is
not encodable to `` sys.stdout.encoding `` with `` sys.stdout.errors `` error
handler (which is probably `` 'strict' `` ), encode it to
`` sys.stdout.encoding `` with `` 'backslashreplace' `` error handler.
2007-08-15 11:28:22 -03:00
Merged revisions 59259-59274 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59260 | lars.gustaebel | 2007-12-01 22:02:12 +0100 (Sat, 01 Dec 2007) | 5 lines
Issue #1531: Read fileobj from the current offset, do not seek to
the start.
(will backport to 2.5)
........
r59262 | georg.brandl | 2007-12-01 23:24:47 +0100 (Sat, 01 Dec 2007) | 4 lines
Document PyEval_* functions from ceval.c.
Credits to Michael Sloan from GHOP.
........
r59263 | georg.brandl | 2007-12-01 23:27:56 +0100 (Sat, 01 Dec 2007) | 2 lines
Add a few refcount data entries.
........
r59264 | georg.brandl | 2007-12-01 23:38:48 +0100 (Sat, 01 Dec 2007) | 4 lines
Add test suite for cmd module.
Written by Michael Schneider for GHOP.
........
r59265 | georg.brandl | 2007-12-01 23:42:46 +0100 (Sat, 01 Dec 2007) | 3 lines
Add examples to the ElementTree documentation.
Written by h4wk.cz for GHOP.
........
r59266 | georg.brandl | 2007-12-02 00:12:45 +0100 (Sun, 02 Dec 2007) | 3 lines
Add "Using Python on Windows" document, by Robert Lehmann.
Written for GHOP.
........
r59271 | georg.brandl | 2007-12-02 15:34:34 +0100 (Sun, 02 Dec 2007) | 3 lines
Add example to mmap docs.
Written for GHOP by Rafal Rawicki.
........
r59272 | georg.brandl | 2007-12-02 15:37:29 +0100 (Sun, 02 Dec 2007) | 2 lines
Convert bdb.rst line endings to Unix style.
........
r59274 | georg.brandl | 2007-12-02 15:58:50 +0100 (Sun, 02 Dec 2007) | 4 lines
Add more entries to the glossary.
Written by Jeff Wheeler for GHOP.
........
2007-12-02 11:22:16 -04:00
`` sys.displayhook `` is called on the result of evaluating an :term: `expression`
entered in an interactive Python session. The display of these values can be
customized by assigning another one-argument function to `` sys.displayhook `` .
2007-08-15 11:28:22 -03:00
2010-12-04 13:24:33 -04:00
Pseudo-code::
def displayhook(value):
if value is None:
return
# Set '_' to None to avoid recursion
builtins._ = None
text = repr(value)
try:
sys.stdout.write(text)
except UnicodeEncodeError:
bytes = text.encode(sys.stdout.encoding, 'backslashreplace')
if hasattr(sys.stdout, 'buffer'):
sys.stdout.buffer.write(bytes)
else:
text = bytes.decode(sys.stdout.encoding, 'strict')
sys.stdout.write(text)
sys.stdout.write("\n")
builtins._ = value
.. versionchanged :: 3.2
Use `` 'backslashreplace' `` error handler on :exc: `UnicodeEncodeError` .
2007-08-15 11:28:22 -03:00
2011-10-04 20:17:38 -03:00
.. data :: dont_write_bytecode
2015-04-13 15:21:02 -03:00
If this is true, Python won't try to write `` .pyc `` files on the
2011-10-04 20:17:38 -03:00
import of source modules. This value is initially set to `` True `` or
`` False `` depending on the :option: `-B` command line option and the
:envvar: `PYTHONDONTWRITEBYTECODE` environment variable, but you can set it
yourself to control bytecode file generation.
2022-04-23 04:52:16 -03:00
.. data :: _emscripten_info
A :term: `named tuple` holding information about the environment on the
*wasm32-emscripten* platform. The named tuple is provisional and may change
in the future.
2023-08-20 08:09:33 -03:00
.. attribute :: _emscripten_info.emscripten_version
Emscripten version as tuple of ints (major, minor, micro), e.g. `` (3, 1, 8) `` .
.. attribute :: _emscripten_info.runtime
Runtime string, e.g. browser user agent, `` 'Node.js v14.18.2' `` , or `` 'UNKNOWN' `` .
.. attribute :: _emscripten_info.pthreads
`` True `` if Python is compiled with Emscripten pthreads support.
.. attribute :: _emscripten_info.shared_memory
`` True `` if Python is compiled with shared memory support.
2022-04-23 04:52:16 -03:00
2022-07-29 11:42:09 -03:00
.. availability :: Emscripten.
2022-04-23 04:52:16 -03:00
.. versionadded :: 3.11
2018-06-16 01:40:56 -03:00
.. data :: pycache_prefix
If this is set (not `` None `` ), Python will write bytecode-cache `` .pyc ``
files to (and read them from) a parallel directory tree rooted at this
directory, rather than from `` __pycache__ `` directories in the source code
tree. Any `` __pycache__ `` directories in the source code tree will be ignored
2022-10-06 22:01:30 -03:00
and new `` .pyc `` files written within the pycache prefix. Thus if you use
2018-06-16 01:40:56 -03:00
:mod: `compileall` as a pre-build step, you must ensure you run it with the
same pycache prefix (if any) that you will use at runtime.
A relative path is interpreted relative to the current working directory.
This value is initially set based on the value of the :option: `-X`
`` pycache_prefix=PATH `` command-line option or the
:envvar: `PYTHONPYCACHEPREFIX` environment variable (command-line takes
precedence). If neither are set, it is `` None `` .
.. versionadded :: 3.8
2007-08-15 11:28:22 -03:00
.. function :: excepthook(type, value, traceback)
This function prints out a given traceback and exception to `` sys.stderr `` .
2023-09-07 10:14:27 -03:00
When an exception other than :exc: `SystemExit` is raised and uncaught, the interpreter calls
2007-08-15 11:28:22 -03:00
`` sys.excepthook `` with three arguments, the exception class, exception
instance, and a traceback object. In an interactive session this happens just
before control is returned to the prompt; in a Python program this happens just
before the program exits. The handling of such top-level exceptions can be
customized by assigning another three-argument function to `` sys.excepthook `` .
2019-11-28 12:46:11 -04:00
.. audit-event :: sys.excepthook hook,type,value,traceback sys.excepthook
Raise an auditing event `` sys.excepthook `` with arguments `` hook `` ,
`` type `` , `` value `` , `` traceback `` when an uncaught exception occurs.
If no hook has been set, `` hook `` may be `` None `` . If any hook raises
an exception derived from :class: `RuntimeError` the call to the hook will
be suppressed. Otherwise, the audit hook exception will be reported as
unraisable and `` sys.excepthook `` will be called.
2019-05-27 19:39:52 -03:00
.. seealso ::
The :func: `sys.unraisablehook` function handles unraisable exceptions
and the :func: `threading.excepthook` function handles exception raised
by :func: `threading.Thread.run` .
2019-05-22 06:28:22 -03:00
2007-08-15 11:28:22 -03:00
2017-10-05 13:11:18 -03:00
.. data :: __breakpointhook__
__displayhook__
2007-08-15 11:28:22 -03:00
__excepthook__
2019-05-22 06:28:22 -03:00
__unraisablehook__
2007-08-15 11:28:22 -03:00
2017-10-05 13:11:18 -03:00
These objects contain the original values of `` breakpointhook `` ,
2019-05-22 06:28:22 -03:00
`` displayhook `` , `` excepthook `` , and `` unraisablehook `` at the start of the
program. They are saved so that `` breakpointhook `` , `` displayhook `` and
`` excepthook `` , `` unraisablehook `` can be restored in case they happen to
get replaced with broken or alternative objects.
2007-08-15 11:28:22 -03:00
2017-10-05 13:11:18 -03:00
.. versionadded :: 3.7
__breakpointhook__
2020-02-07 20:48:06 -04:00
.. versionadded :: 3.8
__unraisablehook__
2007-08-15 11:28:22 -03:00
2022-01-13 08:35:58 -04:00
.. function :: exception()
2022-04-15 15:57:47 -03:00
This function, when called while an exception handler is executing (such as
an `` except `` or `` except* `` clause), returns the exception instance that
was caught by this handler. When exception handlers are nested within one
another, only the exception handled by the innermost handler is accessible.
If no exception handler is executing, this function returns `` None `` .
2022-01-13 08:35:58 -04:00
.. versionadded :: 3.11
2007-08-15 11:28:22 -03:00
.. function :: exc_info()
2022-01-13 08:35:58 -04:00
This function returns the old-style representation of the handled
exception. If an exception `` e `` is currently handled (so
:func: `exception` would return `` e `` ), :func: `exc_info` returns the
tuple `` (type(e), e, e.__traceback__) `` .
That is, a tuple containing the type of the exception (a subclass of
:exc: `BaseException` ), the exception itself, and a :ref:`traceback
object <traceback-objects>` which typically encapsulates the call
stack at the point where the exception last occurred.
2007-08-15 11:28:22 -03:00
2023-05-04 07:04:41 -03:00
.. index :: pair: object; traceback
2007-08-15 11:28:22 -03:00
2022-01-13 08:35:58 -04:00
If no exception is being handled anywhere on the stack, this function
return a tuple containing three `` None `` values.
2021-11-30 18:37:04 -04:00
.. versionchanged :: 3.11
The `` type `` and `` traceback `` fields are now derived from the `` value ``
(the exception instance), so when an exception is modified while it is
being handled, the changes are reflected in the results of subsequent
calls to :func: `exc_info` .
2007-08-15 11:28:22 -03:00
.. data :: exec_prefix
A string giving the site-specific directory prefix where the platform-dependent
Python files are installed; by default, this is also `` '/usr/local' `` . This can
2010-11-18 12:38:46 -04:00
be set at build time with the `` --exec-prefix `` argument to the
2007-08-15 11:28:22 -03:00
:program: `configure` script. Specifically, all configuration files (e.g. the
2011-10-04 20:28:24 -03:00
:file: `pyconfig.h` header file) are installed in the directory
2012-02-23 16:12:39 -04:00
:file: `{exec_prefix}/lib/python{X.Y}/config` , and shared library modules are
2011-10-04 20:28:24 -03:00
installed in :file: `{exec_prefix}/lib/python{X.Y}/lib-dynload` , where *X.Y*
is the version number of Python, for example `` 3.2 `` .
2007-08-15 11:28:22 -03:00
2014-03-16 01:13:56 -03:00
.. note ::
If a :ref: `virtual environment <venv-def>` is in effect, this
2012-07-09 06:37:01 -03:00
value will be changed in `` site.py `` to point to the virtual environment.
The value for the Python installation will still be available, via
:data: `base_exec_prefix` .
2012-05-25 23:45:29 -03:00
2007-08-15 11:28:22 -03:00
.. data :: executable
2012-02-02 14:59:48 -04:00
A string giving the absolute path of the executable binary for the Python
interpreter, on systems where this makes sense. If Python is unable to retrieve
the real path to its executable, :data: `sys.executable` will be an empty string
or `` None `` .
2007-08-15 11:28:22 -03:00
.. function :: exit([arg])
2022-03-03 10:23:47 -04:00
Raise a :exc: `SystemExit` exception, signaling an intention to exit the interpreter.
2010-10-17 07:51:45 -03:00
The optional argument *arg* can be an integer giving the exit status
(defaulting to zero), or another type of object. If it is an integer, zero
is considered "successful termination" and any nonzero value is considered
"abnormal termination" by shells and the like. Most systems require it to be
2015-11-29 23:18:29 -04:00
in the range 0--127, and produce undefined results otherwise. Some systems
2010-10-17 07:51:45 -03:00
have a convention for assigning specific meanings to specific exit codes, but
these are generally underdeveloped; Unix programs generally use 2 for command
line syntax errors and 1 for all other kind of errors. If another type of
object is passed, `` None `` is equivalent to passing zero, and any other
object is printed to :data: `stderr` and results in an exit code of 1. In
particular, `` sys.exit("some error message") `` is a quick way to exit a
program when an error occurs.
Since :func: `exit` ultimately "only" raises an exception, it will only exit
the process when called from the main thread, and the exception is not
2022-03-03 10:23:47 -04:00
intercepted. Cleanup actions specified by finally clauses of :keyword: `try` statements
are honored, and it is possible to intercept the exit attempt at an outer level.
2007-08-15 11:28:22 -03:00
2015-11-29 23:18:29 -04:00
.. versionchanged :: 3.6
If an error occurs in the cleanup after the Python interpreter
has caught :exc: `SystemExit` (such as an error flushing buffered data
in the standard streams), the exit status is changed to 120.
2007-08-15 11:28:22 -03:00
Merged revisions 59933-59951 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59935 | raymond.hettinger | 2008-01-13 07:15:15 +0100 (Sun, 13 Jan 2008) | 1 line
Named tuple is a concept, not a specific type.
........
r59936 | raymond.hettinger | 2008-01-13 07:18:07 +0100 (Sun, 13 Jan 2008) | 1 line
Fix spelling.
........
r59937 | georg.brandl | 2008-01-13 10:36:18 +0100 (Sun, 13 Jan 2008) | 2 lines
Clarify the effect of text mode.
........
r59938 | thomas.heller | 2008-01-13 12:19:43 +0100 (Sun, 13 Jan 2008) | 1 line
Make Modules/socketobject.c compile for Windows again.
........
r59939 | ka-ping.yee | 2008-01-13 12:25:13 +0100 (Sun, 13 Jan 2008) | 9 lines
Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries.
Tested with Python build: trunk:54235:59936M -- the reported error
occurs with Django installed (or with any __init__.py present on
the path that raises an exception), and such errors indeed go away
when this change is applied.
........
r59940 | georg.brandl | 2008-01-13 16:04:05 +0100 (Sun, 13 Jan 2008) | 2 lines
Back out r59931 - test_ctypes fails with it.
........
r59943 | amaury.forgeotdarc | 2008-01-14 01:22:44 +0100 (Mon, 14 Jan 2008) | 6 lines
As discussed in issue 1700288:
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods. And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
........
r59944 | amaury.forgeotdarc | 2008-01-14 01:29:41 +0100 (Mon, 14 Jan 2008) | 5 lines
Re-apply patch #1700288 (first applied in r59931, rolled back in r59940)
now that ctypes uses a more supported method to create types:
Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs.
........
r59946 | amaury.forgeotdarc | 2008-01-14 02:07:27 +0100 (Mon, 14 Jan 2008) | 4 lines
?Why did my tests not notice this before?
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
........
r59947 | christian.heimes | 2008-01-14 04:33:52 +0100 (Mon, 14 Jan 2008) | 1 line
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
........
r59948 | christian.heimes | 2008-01-14 04:35:38 +0100 (Mon, 14 Jan 2008) | 1 line
I missed the most important file
........
r59949 | christian.heimes | 2008-01-14 04:42:48 +0100 (Mon, 14 Jan 2008) | 1 line
Applied patch #1816: sys.flags patch
........
r59950 | christian.heimes | 2008-01-14 05:13:37 +0100 (Mon, 14 Jan 2008) | 2 lines
Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
........
r59951 | christian.heimes | 2008-01-14 07:06:19 +0100 (Mon, 14 Jan 2008) | 1 line
Added more comments to the new structseq repr code and implemented several of Neal's suggestions.
........
2008-01-14 14:49:24 -04:00
.. data :: flags
2019-09-11 11:17:32 -03:00
The :term: `named tuple` *flags* exposes the status of command line
2011-04-20 20:31:22 -03:00
flags. The attributes are read only.
Merged revisions 59933-59951 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59935 | raymond.hettinger | 2008-01-13 07:15:15 +0100 (Sun, 13 Jan 2008) | 1 line
Named tuple is a concept, not a specific type.
........
r59936 | raymond.hettinger | 2008-01-13 07:18:07 +0100 (Sun, 13 Jan 2008) | 1 line
Fix spelling.
........
r59937 | georg.brandl | 2008-01-13 10:36:18 +0100 (Sun, 13 Jan 2008) | 2 lines
Clarify the effect of text mode.
........
r59938 | thomas.heller | 2008-01-13 12:19:43 +0100 (Sun, 13 Jan 2008) | 1 line
Make Modules/socketobject.c compile for Windows again.
........
r59939 | ka-ping.yee | 2008-01-13 12:25:13 +0100 (Sun, 13 Jan 2008) | 9 lines
Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries.
Tested with Python build: trunk:54235:59936M -- the reported error
occurs with Django installed (or with any __init__.py present on
the path that raises an exception), and such errors indeed go away
when this change is applied.
........
r59940 | georg.brandl | 2008-01-13 16:04:05 +0100 (Sun, 13 Jan 2008) | 2 lines
Back out r59931 - test_ctypes fails with it.
........
r59943 | amaury.forgeotdarc | 2008-01-14 01:22:44 +0100 (Mon, 14 Jan 2008) | 6 lines
As discussed in issue 1700288:
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods. And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
........
r59944 | amaury.forgeotdarc | 2008-01-14 01:29:41 +0100 (Mon, 14 Jan 2008) | 5 lines
Re-apply patch #1700288 (first applied in r59931, rolled back in r59940)
now that ctypes uses a more supported method to create types:
Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs.
........
r59946 | amaury.forgeotdarc | 2008-01-14 02:07:27 +0100 (Mon, 14 Jan 2008) | 4 lines
?Why did my tests not notice this before?
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
........
r59947 | christian.heimes | 2008-01-14 04:33:52 +0100 (Mon, 14 Jan 2008) | 1 line
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
........
r59948 | christian.heimes | 2008-01-14 04:35:38 +0100 (Mon, 14 Jan 2008) | 1 line
I missed the most important file
........
r59949 | christian.heimes | 2008-01-14 04:42:48 +0100 (Mon, 14 Jan 2008) | 1 line
Applied patch #1816: sys.flags patch
........
r59950 | christian.heimes | 2008-01-14 05:13:37 +0100 (Mon, 14 Jan 2008) | 2 lines
Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
........
r59951 | christian.heimes | 2008-01-14 07:06:19 +0100 (Mon, 14 Jan 2008) | 1 line
Added more comments to the new structseq repr code and implemented several of Neal's suggestions.
........
2008-01-14 14:49:24 -04:00
2023-08-20 08:09:33 -03:00
.. list-table ::
* - .. attribute:: flags.debug
- :option: `-d`
* - .. attribute:: flags.inspect
- :option: `-i`
* - .. attribute:: flags.interactive
- :option: `-i`
* - .. attribute:: flags.isolated
- :option: `-I`
* - .. attribute:: flags.optimize
- :option: `-O` or :option: `-OO`
* - .. attribute:: flags.dont_write_bytecode
- :option: `-B`
* - .. attribute:: flags.no_user_site
- :option: `-s`
* - .. attribute:: flags.no_site
- :option: `-S`
* - .. attribute:: flags.ignore_environment
- :option: `-E`
* - .. attribute:: flags.verbose
- :option: `-v`
* - .. attribute:: flags.bytes_warning
- :option: `-b`
* - .. attribute:: flags.quiet
- :option: `-q`
* - .. attribute:: flags.hash_randomization
- :option: `-R`
* - .. attribute:: flags.dev_mode
- :option: `-X dev <-X>` (:ref: `Python Development Mode <devmode>` )
* - .. attribute:: flags.utf8_mode
- :option: `-X utf8 <-X>`
* - .. attribute:: flags.safe_path
- :option: `-P`
* - .. attribute:: flags.int_max_str_digits
- :option: `-X int_max_str_digits <-X>`
(:ref: `integer string conversion length limitation <int_max_str_digits>` )
* - .. attribute:: flags.warn_default_encoding
- :option: `-X warn_default_encoding <-X>`
2010-12-28 14:30:18 -04:00
.. versionchanged :: 3.2
Added `` quiet `` attribute for the new :option: `-q` flag.
Merged revisions 59933-59951 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59935 | raymond.hettinger | 2008-01-13 07:15:15 +0100 (Sun, 13 Jan 2008) | 1 line
Named tuple is a concept, not a specific type.
........
r59936 | raymond.hettinger | 2008-01-13 07:18:07 +0100 (Sun, 13 Jan 2008) | 1 line
Fix spelling.
........
r59937 | georg.brandl | 2008-01-13 10:36:18 +0100 (Sun, 13 Jan 2008) | 2 lines
Clarify the effect of text mode.
........
r59938 | thomas.heller | 2008-01-13 12:19:43 +0100 (Sun, 13 Jan 2008) | 1 line
Make Modules/socketobject.c compile for Windows again.
........
r59939 | ka-ping.yee | 2008-01-13 12:25:13 +0100 (Sun, 13 Jan 2008) | 9 lines
Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries.
Tested with Python build: trunk:54235:59936M -- the reported error
occurs with Django installed (or with any __init__.py present on
the path that raises an exception), and such errors indeed go away
when this change is applied.
........
r59940 | georg.brandl | 2008-01-13 16:04:05 +0100 (Sun, 13 Jan 2008) | 2 lines
Back out r59931 - test_ctypes fails with it.
........
r59943 | amaury.forgeotdarc | 2008-01-14 01:22:44 +0100 (Mon, 14 Jan 2008) | 6 lines
As discussed in issue 1700288:
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods. And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
........
r59944 | amaury.forgeotdarc | 2008-01-14 01:29:41 +0100 (Mon, 14 Jan 2008) | 5 lines
Re-apply patch #1700288 (first applied in r59931, rolled back in r59940)
now that ctypes uses a more supported method to create types:
Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs.
........
r59946 | amaury.forgeotdarc | 2008-01-14 02:07:27 +0100 (Mon, 14 Jan 2008) | 4 lines
?Why did my tests not notice this before?
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
........
r59947 | christian.heimes | 2008-01-14 04:33:52 +0100 (Mon, 14 Jan 2008) | 1 line
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
........
r59948 | christian.heimes | 2008-01-14 04:35:38 +0100 (Mon, 14 Jan 2008) | 1 line
I missed the most important file
........
r59949 | christian.heimes | 2008-01-14 04:42:48 +0100 (Mon, 14 Jan 2008) | 1 line
Applied patch #1816: sys.flags patch
........
r59950 | christian.heimes | 2008-01-14 05:13:37 +0100 (Mon, 14 Jan 2008) | 2 lines
Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
........
r59951 | christian.heimes | 2008-01-14 07:06:19 +0100 (Mon, 14 Jan 2008) | 1 line
Added more comments to the new structseq repr code and implemented several of Neal's suggestions.
........
2008-01-14 14:49:24 -04:00
2012-02-20 16:31:46 -04:00
.. versionadded :: 3.2.3
2012-02-20 14:54:16 -04:00
The `` hash_randomization `` attribute.
2011-04-23 23:37:00 -03:00
.. versionchanged :: 3.3
Removed obsolete `` division_warning `` attribute.
2018-10-07 13:12:31 -03:00
.. versionchanged :: 3.4
Added `` isolated `` attribute for :option: `-I` `` isolated `` flag.
2017-11-30 06:40:24 -04:00
.. versionchanged :: 3.7
2020-01-24 05:22:18 -04:00
Added the `` dev_mode `` attribute for the new :ref:`Python Development
Mode <devmode>` and the ` `utf8_mode` ` attribute for the new :option:` -X`
`` utf8 `` flag.
2017-11-30 06:40:24 -04:00
2023-07-21 07:17:58 -03:00
.. versionchanged :: 3.10
Added `` warn_default_encoding `` attribute for :option: `-X` `` warn_default_encoding `` flag.
2022-05-05 20:34:11 -03:00
.. versionchanged :: 3.11
Added the `` safe_path `` attribute for :option: `-P` option.
2022-09-19 20:43:11 -03:00
.. versionchanged :: 3.11
2022-09-02 13:35:08 -03:00
Added the `` int_max_str_digits `` attribute.
Merged revisions 59933-59951 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59935 | raymond.hettinger | 2008-01-13 07:15:15 +0100 (Sun, 13 Jan 2008) | 1 line
Named tuple is a concept, not a specific type.
........
r59936 | raymond.hettinger | 2008-01-13 07:18:07 +0100 (Sun, 13 Jan 2008) | 1 line
Fix spelling.
........
r59937 | georg.brandl | 2008-01-13 10:36:18 +0100 (Sun, 13 Jan 2008) | 2 lines
Clarify the effect of text mode.
........
r59938 | thomas.heller | 2008-01-13 12:19:43 +0100 (Sun, 13 Jan 2008) | 1 line
Make Modules/socketobject.c compile for Windows again.
........
r59939 | ka-ping.yee | 2008-01-13 12:25:13 +0100 (Sun, 13 Jan 2008) | 9 lines
Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries.
Tested with Python build: trunk:54235:59936M -- the reported error
occurs with Django installed (or with any __init__.py present on
the path that raises an exception), and such errors indeed go away
when this change is applied.
........
r59940 | georg.brandl | 2008-01-13 16:04:05 +0100 (Sun, 13 Jan 2008) | 2 lines
Back out r59931 - test_ctypes fails with it.
........
r59943 | amaury.forgeotdarc | 2008-01-14 01:22:44 +0100 (Mon, 14 Jan 2008) | 6 lines
As discussed in issue 1700288:
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods. And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
........
r59944 | amaury.forgeotdarc | 2008-01-14 01:29:41 +0100 (Mon, 14 Jan 2008) | 5 lines
Re-apply patch #1700288 (first applied in r59931, rolled back in r59940)
now that ctypes uses a more supported method to create types:
Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs.
........
r59946 | amaury.forgeotdarc | 2008-01-14 02:07:27 +0100 (Mon, 14 Jan 2008) | 4 lines
?Why did my tests not notice this before?
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
........
r59947 | christian.heimes | 2008-01-14 04:33:52 +0100 (Mon, 14 Jan 2008) | 1 line
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
........
r59948 | christian.heimes | 2008-01-14 04:35:38 +0100 (Mon, 14 Jan 2008) | 1 line
I missed the most important file
........
r59949 | christian.heimes | 2008-01-14 04:42:48 +0100 (Mon, 14 Jan 2008) | 1 line
Applied patch #1816: sys.flags patch
........
r59950 | christian.heimes | 2008-01-14 05:13:37 +0100 (Mon, 14 Jan 2008) | 2 lines
Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
........
r59951 | christian.heimes | 2008-01-14 07:06:19 +0100 (Mon, 14 Jan 2008) | 1 line
Added more comments to the new structseq repr code and implemented several of Neal's suggestions.
........
2008-01-14 14:49:24 -04:00
2007-12-01 08:22:32 -04:00
.. data :: float_info
2019-09-11 11:17:32 -03:00
A :term: `named tuple` holding information about the float type. It
2011-04-20 20:31:22 -03:00
contains low level information about the precision and internal
representation. The values correspond to the various floating-point
constants defined in the standard header file :file: `float.h` for the 'C'
programming language; see section 5.2.4.2.2 of the 1999 ISO/IEC C standard
[C99]_ , 'Characteristics of floating types', for details.
2010-07-02 17:26:07 -03:00
2023-08-19 05:34:34 -03:00
.. list-table :: Attributes of the :data: `!float_info` :term: `named tuple`
:header-rows: 1
* - attribute
- float.h macro
- explanation
* - .. attribute:: float_info.epsilon
- :c:macro: `!DBL_EPSILON`
- difference between 1.0 and the least value greater than 1.0 that is
representable as a float.
See also :func: `math.ulp` .
* - .. attribute:: float_info.dig
- :c:macro: `!DBL_DIG`
- The maximum number of decimal digits that can be faithfully
represented in a float; see below.
* - .. attribute:: float_info.mant_dig
- :c:macro: `!DBL_MANT_DIG`
- Float precision: the number of base-`` radix `` digits in the
significand of a float.
* - .. attribute:: float_info.max
- :c:macro: `!DBL_MAX`
- The maximum representable positive finite float.
* - .. attribute:: float_info.max_exp
- :c:macro: `!DBL_MAX_EXP`
- The maximum integer *e* such that `` radix**(e-1) `` is a representable
finite float.
* - .. attribute:: float_info.max_10_exp
- :c:macro: `!DBL_MAX_10_EXP`
- The maximum integer *e* such that `` 10**e `` is in the range of
representable finite floats.
* - .. attribute:: float_info.min
- :c:macro: `!DBL_MIN`
- The minimum representable positive *normalized* float.
Use :func: `math.ulp(0.0) <math.ulp>` to get the smallest positive
*denormalized* representable float.
* - .. attribute:: float_info.min_exp
- :c:macro: `!DBL_MIN_EXP`
- The minimum integer *e* such that `` radix**(e-1) `` is a normalized
float.
* - .. attribute:: float_info.min_10_exp
- :c:macro: `!DBL_MIN_10_EXP`
- The minimum integer *e* such that `` 10**e `` is a normalized float.
* - .. attribute:: float_info.radix
- :c:macro: `!FLT_RADIX`
- The radix of exponent representation.
* - .. attribute:: float_info.rounds
- :c:macro: `!FLT_ROUNDS`
- An integer representing the rounding mode for floating-point arithmetic.
This reflects the value of the system :c:macro: `!FLT_ROUNDS` macro
at interpreter startup time:
* `` -1 `` : indeterminable
* `` 0 `` : toward zero
* `` 1 `` : to nearest
* `` 2 `` : toward positive infinity
* `` 3 `` : toward negative infinity
All other values for :c:macro: `!FLT_ROUNDS` characterize
implementation-defined rounding behavior.
2010-07-02 17:26:07 -03:00
The attribute :attr: `sys.float_info.dig` needs further explanation. If
`` s `` is any string representing a decimal number with at most
2023-08-19 05:34:34 -03:00
:attr: `!sys.float_info.dig` significant digits, then converting `` s `` to a
2010-07-02 17:26:07 -03:00
float and back again will recover a string representing the same decimal
value::
2007-12-01 08:22:32 -04:00
2010-07-02 17:26:07 -03:00
>>> import sys
>>> sys.float_info.dig
15
>>> s = '3.14159265358979' # decimal string with 15 significant digits
>>> format(float(s), '.15g') # convert to float and back -> same value
'3.14159265358979'
2007-12-01 08:22:32 -04:00
2010-07-02 17:26:07 -03:00
But for strings with more than :attr: `sys.float_info.dig` significant digits,
this isn't always true::
2007-12-01 08:22:32 -04:00
2010-07-02 17:26:07 -03:00
>>> s = '9876543211234567' # 16 significant digits is too many!
>>> format(float(s), '.16g') # conversion changes value
'9876543211234568'
2007-12-01 08:22:32 -04:00
2009-04-16 16:52:09 -03:00
.. data :: float_repr_style
A string indicating how the :func: `repr` function behaves for
floats. If the string has value `` 'short' `` then for a finite
float `` x `` , `` repr(x) `` aims to produce a short string with the
property that `` float(repr(x)) == x `` . This is the usual behaviour
in Python 3.1 and later. Otherwise, `` float_repr_style `` has value
`` 'legacy' `` and `` repr(x) `` behaves in the same way as it did in
versions of Python prior to 3.1.
.. versionadded :: 3.1
2012-12-09 09:28:26 -04:00
.. function :: getallocatedblocks()
Return the number of memory blocks currently allocated by the interpreter,
2012-12-17 18:05:59 -04:00
regardless of their size. This function is mainly useful for tracking
and debugging memory leaks. Because of the interpreter's internal
caches, the result can vary from call to call; you may have to call
2024-02-12 05:04:36 -04:00
:func: `_clear_internal_caches()` and :func: `gc.collect()` to get more
2012-12-17 18:05:59 -04:00
predictable results.
2012-12-09 09:28:26 -04:00
2012-12-17 18:05:59 -04:00
If a Python build or implementation cannot reasonably compute this
information, :func: `getallocatedblocks()` is allowed to return 0 instead.
2012-12-09 09:28:26 -04:00
2012-12-17 18:05:59 -04:00
.. versionadded :: 3.4
2012-12-09 09:28:26 -04:00
2023-04-22 16:39:37 -03:00
.. function :: getunicodeinternedsize()
Return the number of unicode objects that have been interned.
.. versionadded :: 3.12
2016-12-01 20:13:46 -04:00
.. function :: getandroidapilevel()
Return the build time API version of Android as an integer.
2018-10-12 11:55:20 -03:00
.. availability :: Android.
2016-12-01 20:13:46 -04:00
.. versionadded :: 3.7
2007-08-15 11:28:22 -03:00
.. function :: getdefaultencoding()
Return the name of the current default string encoding used by the Unicode
implementation.
.. function :: getdlopenflags()
2013-06-21 11:58:41 -03:00
Return the current value of the flags that are used for
:c:func: `dlopen` calls. Symbolic names for the flag values can be
2023-09-23 03:31:20 -03:00
found in the :mod: `os` module (:samp: `RTLD_{xxx}` constants, e.g.
2023-07-21 06:40:37 -03:00
:const: `os.RTLD_LAZY` ).
2018-10-12 11:55:20 -03:00
.. availability :: Unix.
2007-08-15 11:28:22 -03:00
.. function :: getfilesystemencoding()
2020-11-02 11:49:54 -04:00
Get the :term: `filesystem encoding <filesystem encoding and error handler>` :
the encoding used with the :term:`filesystem error handler <filesystem
encoding and error handler>` to convert between Unicode filenames and bytes
filenames. The filesystem error handler is returned from
2023-04-05 11:54:43 -03:00
:func: `getfilesystemencodeerrors` .
2020-11-01 18:07:23 -04:00
For best compatibility, str should be used for filenames in all cases,
although representing filenames as bytes is also supported. Functions
accepting or returning filenames should support either str or bytes and
internally convert to the system's preferred representation.
2007-08-15 11:28:22 -03:00
2016-09-08 14:35:16 -03:00
:func: `os.fsencode` and :func: `os.fsdecode` should be used to ensure that
the correct encoding and errors mode are used.
2007-08-15 11:28:22 -03:00
2020-11-02 11:49:54 -04:00
The :term: `filesystem encoding and error handler` are configured at Python
startup by the :c:func: `PyConfig_Read` function: see
:c:member: `~PyConfig.filesystem_encoding` and
:c:member: `~PyConfig.filesystem_errors` members of :c:type: `PyConfig` .
2019-03-04 05:02:06 -04:00
2010-05-15 09:27:16 -03:00
.. versionchanged :: 3.2
2013-12-02 07:16:46 -04:00
:func: `getfilesystemencoding` result cannot be `` None `` anymore.
2010-05-15 09:27:16 -03:00
2016-09-08 14:35:16 -03:00
.. versionchanged :: 3.6
Windows is no longer guaranteed to return `` 'mbcs' `` . See :pep: `529`
and :func: `_enablelegacywindowsfsencoding` for more information.
2017-12-13 07:29:09 -04:00
.. versionchanged :: 3.7
2020-11-02 11:49:54 -04:00
Return `` 'utf-8' `` if the :ref: `Python UTF-8 Mode <utf8-mode>` is
enabled.
2017-12-13 07:29:09 -04:00
2016-09-08 14:35:16 -03:00
.. function :: getfilesystemencodeerrors()
2020-11-02 11:49:54 -04:00
Get the :term:`filesystem error handler <filesystem encoding and error
handler>`: the error handler used with the :term:` filesystem encoding
<filesystem encoding and error handler>` to convert between Unicode
filenames and bytes filenames. The filesystem encoding is returned from
2016-09-08 14:35:16 -03:00
:func: `getfilesystemencoding` .
:func: `os.fsencode` and :func: `os.fsdecode` should be used to ensure that
the correct encoding and errors mode are used.
2020-11-02 11:49:54 -04:00
The :term: `filesystem encoding and error handler` are configured at Python
startup by the :c:func: `PyConfig_Read` function: see
:c:member: `~PyConfig.filesystem_encoding` and
:c:member: `~PyConfig.filesystem_errors` members of :c:type: `PyConfig` .
2020-11-01 18:07:23 -04:00
2016-09-08 14:35:16 -03:00
.. versionadded :: 3.6
2007-08-15 11:28:22 -03:00
2022-09-02 13:35:08 -03:00
.. function :: get_int_max_str_digits()
Returns the current value for the :ref:`integer string conversion length
limitation <int_max_str_digits>`. See also :func:` set_int_max_str_digits`.
2022-09-19 20:43:11 -03:00
.. versionadded :: 3.11
2022-09-02 13:35:08 -03:00
2007-08-15 11:28:22 -03:00
.. function :: getrefcount(object)
Return the reference count of the *object* . The count returned is generally one
higher than you might expect, because it includes the (temporary) reference as
an argument to :func: `getrefcount` .
2023-08-07 18:40:59 -03:00
Note that the returned value may not actually reflect how many
references to the object are actually held. For example, some
2023-11-17 10:09:19 -04:00
objects are :term: `immortal` and have a very high refcount that does not
2023-08-07 18:40:59 -03:00
reflect the actual number of references. Consequently, do not rely
on the returned value to be accurate, other than a value of 0 or 1.
.. versionchanged :: 3.12
Immortal objects have very large refcounts that do not match
the actual number of references to the object.
2007-08-15 11:28:22 -03:00
.. function :: getrecursionlimit()
Return the current value of the recursion limit, the maximum depth of the Python
interpreter stack. This limit prevents infinite recursion from causing an
overflow of the C stack and crashing Python. It can be set by
:func: `setrecursionlimit` .
2008-07-14 07:13:31 -03:00
.. function :: getsizeof(object[, default])
2008-06-04 11:18:43 -03:00
Return the size of an object in bytes. The object can be any type of
object. All built-in objects will return correct results, but this
2008-07-14 07:13:31 -03:00
does not have to hold true for third-party extensions as it is implementation
2008-06-04 11:18:43 -03:00
specific.
2012-06-17 05:40:16 -03:00
Only the memory consumption directly attributed to the object is
accounted for, not the memory consumption of objects it refers to.
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
If given, *default* will be returned if the object does not provide means to
2010-03-12 06:06:40 -04:00
retrieve the size. Otherwise a :exc: `TypeError` will be raised.
2008-07-14 07:13:31 -03:00
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
:func: `getsizeof` calls the object's `` __sizeof__ `` method and adds an
additional garbage collector overhead if the object is managed by the garbage
collector.
2008-07-14 07:13:31 -03:00
2023-05-02 03:34:44 -03:00
See `recursive sizeof recipe <https://code.activestate.com/recipes/577504/> `_
2010-12-17 19:31:30 -04:00
for an example of using :func: `getsizeof` recursively to find the size of
containers and all their contents.
2008-06-04 11:18:43 -03:00
2009-11-10 19:18:31 -04:00
.. function :: getswitchinterval()
Return the interpreter's "thread switch interval"; see
:func: `setswitchinterval` .
2009-11-11 18:03:32 -04:00
.. versionadded :: 3.2
2009-11-10 19:18:31 -04:00
2007-08-15 11:28:22 -03:00
.. function :: _getframe([depth])
Return a frame object from the call stack. If optional integer *depth* is
given, return the frame object that many calls below the top of the stack. If
that is deeper than the call stack, :exc: `ValueError` is raised. The default
for *depth* is zero, returning the frame at the top of the call stack.
2022-07-17 12:11:24 -03:00
.. audit-event :: sys._getframe frame sys._getframe
2019-05-23 12:45: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 ::
This function should be used for internal and specialized purposes only.
It is not guaranteed to exist in all implementations of Python.
2007-08-15 11:28:22 -03:00
2023-01-13 07:31:06 -04:00
.. function :: _getframemodulename([depth])
Return the name of a module from the call stack. If optional integer *depth*
is given, return the module that many calls below the top of the stack. If
that is deeper than the call stack, or if the module is unidentifiable,
`` None `` is returned. The default for *depth* is zero, returning the
module at the top of the call stack.
.. audit-event :: sys._getframemodulename depth sys._getframemodulename
.. impl-detail ::
This function should be used for internal and specialized purposes only.
It is not guaranteed to exist in all implementations of Python.
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
.. function :: getprofile()
.. index ::
single: profile function
single: profiler
Get the profiler function as set by :func: `setprofile` .
.. function :: gettrace()
.. index ::
single: trace function
single: debugger
Get the trace function as set by :func: `settrace` .
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 ::
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
The :func: `gettrace` function is intended only for implementing debuggers,
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
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition, and
thus may not be available in all Python implementations.
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
2007-08-15 11:28:22 -03:00
.. function :: getwindowsversion()
2010-01-26 20:56:30 -04:00
Return a named tuple describing the Windows version
2010-01-26 20:44:57 -04:00
currently running. The named elements are *major* , *minor* ,
*build* , *platform* , *service_pack* , *service_pack_minor* ,
2016-09-17 21:27:48 -03:00
*service_pack_major* , *suite_mask* , *product_type* and
*platform_version* . *service_pack* contains a string,
*platform_version* a 3-tuple and all other values are
2010-01-26 20:44:57 -04:00
integers. The components can also be accessed by name, so
`` sys.getwindowsversion()[0] `` is equivalent to
`` sys.getwindowsversion().major `` . For compatibility with prior
versions, only the first 5 elements are retrievable by indexing.
2007-08-15 11:28:22 -03:00
2023-07-28 07:26:28 -03:00
*platform* will be `` 2 `` (VER_PLATFORM_WIN32_NT).
2007-08-15 11:28:22 -03:00
2010-01-26 20:44:57 -04:00
*product_type* may be one of the following values:
+---------------------------------------+---------------------------------+
| Constant | Meaning |
+=======================================+=================================+
2023-07-28 07:26:28 -03:00
| `` 1 `` (VER_NT_WORKSTATION) | The system is a workstation. |
2010-01-26 20:44:57 -04:00
+---------------------------------------+---------------------------------+
2023-07-28 07:26:28 -03:00
| `` 2 `` (VER_NT_DOMAIN_CONTROLLER) | The system is a domain |
2010-01-26 20:44:57 -04:00
| | controller. |
+---------------------------------------+---------------------------------+
2023-07-28 07:26:28 -03:00
| `` 3 `` (VER_NT_SERVER) | The system is a server, but not |
2010-01-26 20:44:57 -04:00
| | a domain controller. |
+---------------------------------------+---------------------------------+
2023-08-20 08:09:33 -03:00
This function wraps the Win32 :c:func: `!GetVersionEx` function; see the
Microsoft documentation on :c:func: `!OSVERSIONINFOEX` for more information
2010-01-26 20:44:57 -04:00
about these fields.
2007-08-15 11:28:22 -03:00
2021-04-22 13:43:37 -03:00
*platform_version* returns the major version, minor version and
2016-09-17 21:27:48 -03:00
build number of the current operating system, rather than the version that
is being emulated for the process. It is intended for use in logging rather
than for feature detection.
2021-04-22 13:43:37 -03:00
.. note ::
*platform_version* derives the version from kernel32.dll which can be of a different
version than the OS version. Please use :mod: `platform` module for achieving accurate
OS version.
2018-10-12 11:55:20 -03:00
.. availability :: Windows.
2007-08-15 11:28:22 -03:00
2010-01-27 18:44:03 -04:00
.. versionchanged :: 3.2
2010-01-26 20:44:57 -04:00
Changed to a named tuple and added *service_pack_minor* ,
*service_pack_major* , *suite_mask* , and *product_type* .
2007-08-15 11:28:22 -03:00
2016-09-17 21:27:48 -03:00
.. versionchanged :: 3.6
Added *platform_version*
2010-05-23 10:33:13 -03:00
2016-12-15 18:36:05 -04:00
.. function :: get_asyncgen_hooks()
Returns an *asyncgen_hooks* object, which is similar to a
2022-10-06 22:01:30 -03:00
:class: `~collections.namedtuple` of the form `` (firstiter, finalizer) `` ,
2016-12-15 18:36:05 -04:00
where *firstiter* and *finalizer* are expected to be either `` None `` or
functions which take an :term: `asynchronous generator iterator` as an
2017-08-03 03:00:59 -03:00
argument, and are used to schedule finalization of an asynchronous
2016-12-15 18:36:05 -04:00
generator by an event loop.
.. versionadded :: 3.6
See :pep: `525` for more details.
.. note ::
This function has been added on a provisional basis (see :pep: `411`
for details.)
2018-01-21 10:44:07 -04:00
.. function :: get_coroutine_origin_tracking_depth()
Get the current coroutine origin tracking depth, as set by
2018-12-14 07:28:44 -04:00
:func: `set_coroutine_origin_tracking_depth` .
2018-01-21 10:44:07 -04:00
.. versionadded :: 3.7
.. note ::
This function has been added on a provisional basis (see :pep: `411`
for details.) Use it only for debugging purposes.
2010-05-23 10:33:13 -03:00
.. data :: hash_info
2019-09-11 11:17:32 -03:00
A :term: `named tuple` giving parameters of the numeric hash
2011-04-20 20:31:22 -03:00
implementation. For more details about hashing of numeric types, see
:ref: `numeric-hash` .
2010-05-23 10:33:13 -03:00
2023-08-20 08:09:33 -03:00
.. attribute :: hash_info.width
The width in bits used for hash values
.. attribute :: hash_info.modulus
2013-11-20 06:46:18 -04:00
2023-08-20 08:09:33 -03:00
The prime modulus P used for numeric hash scheme
.. attribute :: hash_info.inf
The hash value returned for a positive infinity
.. attribute :: hash_info.nan
(This attribute is no longer used)
.. attribute :: hash_info.imag
The multiplier used for the imaginary part of a complex number
.. attribute :: hash_info.algorithm
The name of the algorithm for hashing of str, bytes, and memoryview
.. attribute :: hash_info.hash_bits
The internal output size of the hash algorithm
.. attribute :: hash_info.seed_bits
The size of the seed key of the hash algorithm
2010-05-23 10:33:13 -03:00
.. versionadded :: 3.2
2014-03-17 12:20:29 -03:00
.. versionchanged :: 3.4
2013-11-20 06:46:18 -04:00
Added *algorithm* , *hash_bits* and *seed_bits*
2010-05-23 10:33:13 -03:00
2007-08-15 11:28:22 -03:00
.. data :: hexversion
The version number encoded as a single integer. This is guaranteed to increase
with each version, including proper support for non-production releases. For
example, to test that the Python interpreter is at least version 1.5.2, use::
if sys.hexversion >= 0x010502F0:
# use some advanced feature
...
else:
# use an alternative implementation or warn the user
...
This is called `` hexversion `` since it only really looks meaningful when viewed
as the result of passing it to the built-in :func: `hex` function. The
2019-09-11 11:17:32 -03:00
:term: `named tuple` :data: `sys.version_info` may be used for a more
2011-04-27 11:32:36 -03:00
human-friendly encoding of the same information.
2007-08-15 11:28:22 -03:00
2015-10-10 07:36:22 -03:00
More details of `` hexversion `` can be found at :ref: `apiabiversion` .
2007-08-15 11:28:22 -03:00
2012-06-03 17:18:47 -03:00
.. data :: implementation
2012-06-04 12:06:45 -03:00
An object containing information about the implementation of the
currently running Python interpreter. The following attributes are
required to exist in all Python implementations.
2012-06-03 17:18:47 -03:00
2012-06-04 12:06:45 -03:00
*name* is the implementation's identifier, e.g. `` 'cpython' `` . The actual
string is defined by the Python implementation, but it is guaranteed to be
lower case.
2012-06-03 17:18:47 -03:00
*version* is a named tuple, in the same format as
:data: `sys.version_info` . It represents the version of the Python
*implementation* . This has a distinct meaning from the specific
version of the Python *language* to which the currently running
interpreter conforms, which `` sys.version_info `` represents. For
example, for PyPy 1.8 `` sys.implementation.version `` might be
`` sys.version_info(1, 8, 0, 'final', 0) `` , whereas `` sys.version_info ``
2012-06-04 12:06:45 -03:00
would be `` sys.version_info(2, 7, 2, 'final', 0) `` . For CPython they
2012-06-03 17:18:47 -03:00
are the same value, since it is the reference implementation.
*hexversion* is the implementation version in hexadecimal format, like
:data: `sys.hexversion` .
*cache_tag* is the tag used by the import machinery in the filenames of
cached modules. By convention, it would be a composite of the
implementation's name and version, like `` 'cpython-33' `` . However, a
Python implementation may use some other value if appropriate. If
`` cache_tag `` is set to `` None `` , it indicates that module caching should
be disabled.
2012-06-04 12:06:45 -03:00
:data: `sys.implementation` may contain additional attributes specific to
the Python implementation. These non-standard attributes must start with
an underscore, and are not described here. Regardless of its contents,
:data: `sys.implementation` will not change during a run of the interpreter,
nor between implementation versions. (It may change between Python
2014-10-30 18:25:41 -03:00
language versions, however.) See :pep: `421` for more information.
2012-06-03 17:18:47 -03:00
.. versionadded :: 3.3
2019-07-15 11:37:09 -03:00
.. note ::
The addition of new required attributes must go through the normal PEP
process. See :pep: `421` for more information.
2012-06-03 17:18:47 -03:00
2009-03-18 17:06:12 -03:00
.. data :: int_info
2019-09-11 11:17:32 -03:00
A :term: `named tuple` that holds information about Python's internal
2011-04-20 20:31:22 -03:00
representation of integers. The attributes are read only.
2009-03-18 17:06:12 -03:00
2023-08-20 08:09:33 -03:00
.. attribute :: int_info.bits_per_digit
The number of bits held in each digit.
Python integers are stored internally in base `` 2**int_info.bits_per_digit `` .
.. attribute :: int_info.sizeof_digit
The size in bytes of the C type used to represent a digit.
.. attribute :: int_info.default_max_str_digits
The default value for :func: `sys.get_int_max_str_digits`
when it is not otherwise explicitly configured.
.. attribute :: int_info.str_digits_check_threshold
The minimum non-zero value for :func: `sys.set_int_max_str_digits` ,
:envvar: `PYTHONINTMAXSTRDIGITS` , or :option: `-X int_max_str_digits <-X>` .
2009-03-18 17:06:12 -03:00
2009-03-20 13:00:49 -03:00
.. versionadded :: 3.1
2022-09-19 20:43:11 -03:00
.. versionchanged :: 3.11
2023-08-20 08:09:33 -03:00
Added :attr: `~int_info.default_max_str_digits` and
:attr: `~int_info.str_digits_check_threshold` .
2022-09-02 13:35:08 -03:00
2009-03-18 17:06:12 -03:00
2013-05-04 15:08:35 -03:00
.. data :: __interactivehook__
2014-03-16 01:13:56 -03:00
When this attribute exists, its value is automatically called (with no
arguments) when the interpreter is launched in :ref:`interactive mode
<tut-interactive>`. This is done after the :envvar:` PYTHONSTARTUP` file is
read, so that you can set this hook there. The :mod: `site` module
:ref: `sets this <rlcompleter-config>` .
2013-05-04 15:08:35 -03:00
2019-07-01 20:03:53 -03:00
.. audit-event :: cpython.run_interactivehook hook sys.__interactivehook__
Raises an :ref: `auditing event <auditing>`
`` cpython.run_interactivehook `` with the hook object as the argument when
the hook is called on startup.
2013-05-04 15:08:35 -03:00
.. versionadded :: 3.4
2007-08-15 11:28:22 -03:00
.. function :: intern(string)
Enter *string* in the table of "interned" strings and return the interned string
-- which is *string* itself or a copy. Interning strings is useful to gain a
little performance on dictionary lookup -- if the keys in a dictionary are
interned, and the lookup key is interned, the key comparisons (after hashing)
can be done by a pointer compare instead of a string compare. Normally, the
names used in Python programs are automatically interned, and the dictionaries
used to hold module, class or instance attributes have interned keys.
2023-11-17 10:09:19 -04:00
Interned strings are not :term: `immortal` ; you must keep a reference to the
return value of :func: `intern` around to benefit from it.
2007-08-15 11:28:22 -03:00
2014-12-06 20:28:27 -04:00
.. function :: is_finalizing()
2023-08-18 07:34:41 -03:00
Return :const: `True` if the main Python interpreter is
:term: `shutting down <interpreter shutdown>` . Return :const: `False` otherwise.
2014-12-06 20:28:27 -04:00
.. versionadded :: 3.5
2023-03-18 08:47:11 -03:00
.. data :: last_exc
This variable is not always defined; it is set to the exception instance
when an exception is not handled and the interpreter prints an error message
and a stack traceback. Its intended use is to allow an interactive user to
import a debugger module and engage in post-mortem debugging without having
to re-execute the command that caused the error. (Typical use is
`` import pdb; pdb.pm() `` to enter the post-mortem debugger; see :mod: `pdb`
module for more information.)
.. versionadded :: 3.12
2014-12-06 20:28:27 -04:00
2023-12-04 05:09:06 -04:00
.. function :: _is_interned(string)
Return :const: `True` if the given string is "interned", :const: `False`
otherwise.
.. versionadded :: 3.13
.. impl-detail ::
It is not guaranteed to exist in all implementations of Python.
2007-08-15 11:28:22 -03:00
.. data :: last_type
last_value
last_traceback
2023-03-18 08:47:11 -03:00
These three variables are deprecated; use :data: `sys.last_exc` instead.
They hold the legacy representation of `` sys.last_exc `` , as returned
from :func: `exc_info` above.
2007-08-15 11:28:22 -03:00
2007-12-04 19:02:19 -04:00
.. data :: maxsize
2007-08-15 11:28:22 -03:00
2010-10-06 07:11:56 -03:00
An integer giving the maximum value a variable of type :c:type: `Py_ssize_t` can
2007-12-15 05:55:35 -04:00
take. It's usually `` 2**31 - 1 `` on a 32-bit platform and `` 2**63 - 1 `` on a
64-bit platform.
2007-12-04 19:02:19 -04:00
2007-08-15 11:28:22 -03:00
.. data :: maxunicode
2011-09-28 18:18:19 -03:00
An integer giving the value of the largest Unicode code point,
i.e. `` 1114111 `` (`` 0x10FFFF `` in hexadecimal).
.. versionchanged :: 3.3
2011-10-04 20:06:31 -03:00
Before :pep: `393` , `` sys.maxunicode `` used to be either `` 0xFFFF ``
2011-09-28 18:18:19 -03:00
or `` 0x10FFFF `` , depending on the configuration option that specified
whether Unicode characters were stored as UCS-2 or UCS-4.
2007-08-15 11:28:22 -03:00
2009-03-21 00:11:16 -03:00
.. data :: meta_path
2015-12-04 19:46:21 -04:00
A list of :term: `meta path finder` objects that have their
:meth: `~importlib.abc.MetaPathFinder.find_spec` methods called to see if one
2022-06-21 19:03:08 -03:00
of the objects can find the module to be imported. By default, it holds entries
that implement Python's default import semantics. The
2015-12-04 19:46:21 -04:00
:meth: `~importlib.abc.MetaPathFinder.find_spec` method is called with at
least the absolute name of the module being imported. If the module to be
imported is contained in a package, then the parent package's :attr: `__path__`
attribute is passed in as a second argument. The method returns a
:term: `module spec` , or `` None `` if the module cannot be found.
.. seealso ::
:class: `importlib.abc.MetaPathFinder`
The abstract base class defining the interface of finder objects on
:data: `meta_path` .
:class: `importlib.machinery.ModuleSpec`
The concrete class which
:meth: `~importlib.abc.MetaPathFinder.find_spec` should return
instances of.
.. versionchanged :: 3.4
:term: `Module specs <module spec>` were introduced in Python 3.4, by
2024-01-11 05:43:35 -04:00
:pep: `451` .
.. versionchanged :: 3.12
Removed the fallback that looked for a :meth: `!find_module` method
if a :data: `meta_path` entry didn't have a
:meth: `~importlib.abc.MetaPathFinder.find_spec` method.
2009-03-21 00:11:16 -03:00
2007-08-15 11:28:22 -03:00
.. data :: modules
This is a dictionary that maps module names to modules which have already been
loaded. This can be manipulated to force reloading of modules and other tricks.
2013-05-24 09:05:07 -03:00
However, replacing the dictionary will not necessarily work as expected and
2021-10-09 16:34:13 -03:00
deleting essential items from the dictionary may cause Python to fail. If
you want to iterate over this global dictionary always use
`` sys.modules.copy() `` or `` tuple(sys.modules) `` to avoid exceptions as its
size may change during iteration as a side effect of code or activity in
other threads.
2007-08-15 11:28:22 -03:00
2020-06-29 19:49:03 -03:00
.. data :: orig_argv
The list of the original command line arguments passed to the Python
executable.
2024-01-31 17:33:28 -04:00
The elements of :data: `sys.orig_argv` are the arguments to the Python interpreter,
while the elements of :data: `sys.argv` are the arguments to the user's program.
Arguments consumed by the interpreter itself will be present in :data: `sys.orig_argv`
and missing from :data: `sys.argv` .
2020-06-29 19:49:03 -03:00
.. versionadded :: 3.10
2007-08-15 11:28:22 -03:00
.. data :: path
.. index :: triple: module; search; path
A list of strings that specifies the search path for modules. Initialized from
the environment variable :envvar: `PYTHONPATH` , plus an installation-dependent
default.
2022-05-05 20:34:11 -03:00
By default, as initialized upon program startup, a potentially unsafe path
is prepended to :data: `sys.path` (*before* the entries inserted as a result
of :envvar: `PYTHONPATH` ):
* `` python -m module `` command line: prepend the current working
directory.
* `` python script.py `` command line: prepend the script's directory.
If it's a symbolic link, resolve symbolic links.
* `` python -c code `` and `` python `` (REPL) command lines: prepend an empty
string, which means the current working directory.
2007-08-15 11:28:22 -03:00
2022-05-05 20:34:11 -03:00
To not prepend this potentially unsafe path, use the :option: `-P` command
2022-10-29 17:44:06 -03:00
line option or the :envvar: `PYTHONSAFEPATH` environment variable.
2022-03-23 14:29:40 -03:00
2012-11-20 16:22:51 -04:00
A program is free to modify this list for its own purposes. Only strings
2022-07-16 22:07:53 -03:00
should be added to :data: `sys.path` ; all other data types are
2012-11-20 16:22:51 -04:00
ignored during import.
2007-08-15 11:28:22 -03:00
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
.. seealso ::
2022-03-23 14:29:40 -03:00
* Module :mod: `site` This describes how to use .pth files to
extend :data: `sys.path` .
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
2009-03-21 00:11:16 -03:00
.. data :: path_hooks
A list of callables that take a path argument to try to create a
:term: `finder` for the path. If a finder can be created, it is to be
returned by the callable, else raise :exc: `ImportError` .
Originally specified in :pep: `302` .
.. data :: path_importer_cache
A dictionary acting as a cache for :term: `finder` objects. The keys are
paths that have been passed to :data: `sys.path_hooks` and the values are
the finders that are found. If a path is a valid file system path but no
2013-03-13 14:46:22 -03:00
finder is found on :data: `sys.path_hooks` then `` None `` is
stored.
2009-03-21 00:11:16 -03:00
Originally specified in :pep: `302` .
2007-08-15 11:28:22 -03:00
.. data :: platform
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
This string contains a platform identifier that can be used to append
platform-specific components to :data: `sys.path` , for instance.
2019-04-12 11:15:32 -03:00
For Unix systems, except on Linux and AIX, this is the lowercased OS name as
2011-08-21 07:08:11 -03:00
returned by `` uname -s `` with the first part of the version as returned by
`` uname -r `` appended, e.g. `` 'sunos5' `` or `` 'freebsd8' `` , *at the time
when Python was built*. Unless you want to test for a specific system
version, it is therefore recommended to use the following idiom::
2011-07-09 10:54:23 -03:00
2011-08-21 07:08:11 -03:00
if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...
2011-09-03 04:26:09 -03:00
elif sys.platform.startswith('linux'):
2011-07-09 10:54:23 -03:00
# Linux-specific code here...
2019-04-12 11:15:32 -03:00
elif sys.platform.startswith('aix'):
# AIX-specific code here...
2011-07-09 10:54:23 -03:00
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
For other systems, the values are:
================ ===========================
2012-12-08 23:53:43 -04:00
System `` platform `` value
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
================ ===========================
2019-04-12 11:15:32 -03:00
AIX `` 'aix' ``
2022-04-10 04:29:51 -03:00
Emscripten `` 'emscripten' ``
2011-08-21 07:08:11 -03:00
Linux `` 'linux' ``
2022-04-10 04:29:51 -03:00
WASI `` 'wasi' ``
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
Windows `` 'win32' ``
Windows/Cygwin `` 'cygwin' ``
2019-03-04 05:02:06 -04:00
macOS `` 'darwin' ``
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
#1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
........
r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
#1178141: add addinfourl.code to get http status code from urllib.
........
r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
#856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
........
r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
#1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
........
r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
#799369: document possible sys.platform values.
........
r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
#652749: document the constants added to the builtins by site.py.
........
r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
#1648: add sys.gettrace() and sys.getprofile().
........
r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
#1669: don't allow shutil.rmtree() to be called on a symlink.
........
r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
Fix test_pyclbr after urllib change.
........
r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
........
r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
#1876: fix typos in test_operator.
........
2008-01-20 11:14:11 -04:00
================ ===========================
2007-08-15 11:28:22 -03:00
2011-08-21 07:08:11 -03:00
.. versionchanged :: 3.3
2023-07-21 06:34:30 -03:00
On Linux, :data: `sys.platform` doesn't contain the major version anymore.
2011-09-04 03:42:26 -03:00
It is always `` 'linux' `` , instead of `` 'linux2' `` or `` 'linux3' `` . Since
older Python versions include the version number, it is recommended to
2019-04-12 11:15:32 -03:00
always use the `` startswith `` idiom presented above.
.. versionchanged :: 3.8
2023-07-21 06:34:30 -03:00
On AIX, :data: `sys.platform` doesn't contain the major version anymore.
2019-04-12 11:15:32 -03:00
It is always `` 'aix' `` , instead of `` 'aix5' `` or `` 'aix7' `` . Since
older Python versions include the version number, it is recommended to
2011-09-04 03:42:26 -03:00
always use the `` startswith `` idiom presented above.
2011-08-21 07:08:11 -03:00
2011-07-09 10:54:23 -03:00
.. seealso ::
2012-02-23 16:12:39 -04:00
2023-07-21 06:34:30 -03:00
:data: `os.name` has a coarser granularity. :func: `os.uname` gives
2011-07-09 10:54:23 -03:00
system-dependent version information.
The :mod: `platform` module provides detailed checks for the
system's identity.
2007-08-15 11:28:22 -03:00
2011-09-04 03:42:26 -03:00
2020-03-10 05:53:09 -03:00
.. data :: platlibdir
Name of the platform-specific library directory. It is used to build the
2020-05-28 13:33:04 -03:00
path of standard library and the paths of installed extension modules.
2020-03-10 05:53:09 -03:00
It is equal to `` "lib" `` on most platforms. On Fedora and SuSE, it is equal
to `` "lib64" `` on 64-bit platforms which gives the following `` sys.path ``
paths (where `` X.Y `` is the Python `` major.minor `` version):
* `` /usr/lib64/pythonX.Y/ `` :
Standard library (like `` os.py `` of the :mod: `os` module)
* `` /usr/lib64/pythonX.Y/lib-dynload/ `` :
C extension modules of the standard library (like the :mod: `errno` module,
the exact filename is platform specific)
2020-05-28 13:33:04 -03:00
* `` /usr/lib/pythonX.Y/site-packages/ `` (always use `` lib `` , not
2020-03-10 05:53:09 -03:00
:data:`sys.platlibdir`): Third-party modules
2020-05-28 13:33:04 -03:00
* `` /usr/lib64/pythonX.Y/site-packages/ `` :
C extension modules of third-party packages
2020-03-10 05:53:09 -03:00
.. versionadded :: 3.9
2007-08-15 11:28:22 -03:00
.. data :: prefix
A string giving the site-specific directory prefix where the platform
2021-11-18 16:08:24 -04:00
independent Python files are installed; on Unix, the default is
2023-03-15 12:10:03 -03:00
:file: `/usr/local` . This can be set at build time with the :option: `--prefix`
2021-11-18 16:08:24 -04:00
argument to the :program: `configure` script. See
:ref: `installation_paths` for derived paths.
2007-08-15 11:28:22 -03:00
2012-07-09 06:37:01 -03:00
.. note :: If a :ref: `virtual environment <venv-def>` is in effect, this
value will be changed in `` site.py `` to point to the virtual
environment. The value for the Python installation will still be
available, via :data: `base_prefix` .
2012-05-25 23:45:29 -03:00
2007-08-15 11:28:22 -03:00
.. data :: ps1
ps2
.. index ::
single: interpreter prompts
single: prompts, interpreter
2018-10-26 03:00:49 -03:00
single: >>>; interpreter prompt
single: ...; interpreter prompt
2007-08-15 11:28:22 -03:00
Strings specifying the primary and secondary prompt of the interpreter. These
are only defined if the interpreter is in interactive mode. Their initial
values in this case are `` '>>> ' `` and `` '... ' `` . If a non-string object is
assigned to either variable, its :func: `str` is re-evaluated each time the
interpreter prepares to read a new interactive command; this can be used to
implement a dynamic prompt.
.. function :: setdlopenflags(n)
2010-10-06 07:11:56 -03:00
Set the flags used by the interpreter for :c:func: `dlopen` calls, such as when
2007-08-15 11:28:22 -03:00
the interpreter loads extension modules. Among other things, this will enable a
lazy resolving of symbols when importing a module, if called as
`` sys.setdlopenflags(0) `` . To share symbols across extension modules, call as
2013-06-21 11:58:41 -03:00
`` sys.setdlopenflags(os.RTLD_GLOBAL) `` . Symbolic names for the flag values
2023-09-23 03:31:20 -03:00
can be found in the :mod: `os` module (:samp: `RTLD_{xxx}` constants, e.g.
2023-07-21 06:40:37 -03:00
:const: `os.RTLD_LAZY` ).
2011-10-25 08:34:04 -03:00
2018-10-12 11:55:20 -03:00
.. availability :: Unix.
2007-08-15 11:28:22 -03:00
2022-09-13 12:22:50 -03:00
.. function :: set_int_max_str_digits(maxdigits)
2022-09-02 13:35:08 -03:00
Set the :ref:`integer string conversion length limitation
<int_max_str_digits>` used by this interpreter. See also
:func: `get_int_max_str_digits` .
2022-09-19 20:43:11 -03:00
.. versionadded :: 3.11
2022-09-02 13:35:08 -03:00
2007-08-15 11:28:22 -03:00
.. function :: setprofile(profilefunc)
.. index ::
single: profile function
single: profiler
Set the system's profile function, which allows you to implement a Python source
code profiler in Python. See chapter :ref: `profile` for more information on the
Python profiler. The system's profile function is called similarly to the
2018-01-24 08:57:49 -04:00
system's trace function (see :func: `settrace` ), but it is called with different events,
for example it isn't called for each executed line of code (only on call and return,
but the return event is reported even when an exception has been set). The function is
thread-specific, but there is no way for the profiler to know about context switches between
threads, so it does not make sense to use this in the presence of multiple threads. Also,
2018-01-27 11:04:47 -04:00
its return value is not used, so it can simply return `` None `` . Error in the profile
function will cause itself unset.
2007-08-15 11:28:22 -03:00
2023-10-31 13:24:54 -03:00
.. note ::
The same tracing mechanism is used for :func: `!setprofile` as :func: `settrace` .
To trace calls with :func: `!setprofile` inside a tracing function
(e.g. in a debugger breakpoint), see :func: `call_tracing` .
2018-01-24 08:57:49 -04:00
Profile functions should have three arguments: *frame* , *event* , and
*arg* . *frame* is the current stack frame. *event* is a string: `` 'call' `` ,
`` 'return' `` , `` 'c_call' `` , `` 'c_return' `` , or `` 'c_exception' `` . *arg* depends
on the event type.
The events have the following meaning:
`` 'call' ``
A function is called (or some other code block entered). The
profile function is called; *arg* is `` None `` .
`` 'return' ``
A function (or other code block) is about to return. The profile
function is called; *arg* is the value that will be returned, or `` None ``
if the event is caused by an exception being raised.
`` 'c_call' ``
A C function is about to be called. This may be an extension function or
a built-in. *arg* is the C function object.
`` 'c_return' ``
A C function has returned. *arg* is the C function object.
`` 'c_exception' ``
A C function has raised an exception. *arg* is the C function object.
2007-08-15 11:28:22 -03:00
2023-10-31 13:24:54 -03:00
.. audit-event :: sys.setprofile "" sys.setprofile
2007-08-15 11:28:22 -03:00
.. function :: setrecursionlimit(limit)
Set the maximum depth of the Python interpreter stack to *limit* . This limit
prevents infinite recursion from causing an overflow of the C stack and crashing
Python.
The highest possible limit is platform-dependent. A user may need to set the
2011-05-13 01:55:28 -03:00
limit higher when they have a program that requires deep recursion and a platform
2007-08-15 11:28:22 -03:00
that supports a higher limit. This should be done with care, because a too-high
limit can lead to a crash.
2015-10-12 19:11:21 -03:00
If the new limit is too low at the current recursion depth, a
:exc: `RecursionError` exception is raised.
.. versionchanged :: 3.5.1
A :exc: `RecursionError` exception is now raised if the new limit is too
low at the current recursion depth.
2007-08-15 11:28:22 -03:00
2009-11-10 19:18:31 -04:00
.. function :: setswitchinterval(interval)
Set the interpreter's thread switch interval (in seconds). This floating-point
value determines the ideal duration of the "timeslices" allocated to
concurrently running Python threads. Please note that the actual value
can be higher, especially if long-running internal functions or methods
are used. Also, which thread becomes scheduled at the end of the interval
is the operating system's decision. The interpreter doesn't have its
own scheduler.
2009-11-11 18:03:32 -04:00
.. versionadded :: 3.2
2009-11-10 19:18:31 -04:00
2007-08-15 11:28:22 -03:00
.. function :: settrace(tracefunc)
.. index ::
single: trace function
single: debugger
Set the system's trace function, which allows you to implement a Python
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
source code debugger in Python. The function is thread-specific; for a
2019-05-17 05:50:03 -03:00
debugger to support multiple threads, it must register a trace function using
:func: `settrace` for each thread being debugged or use :func: `threading.settrace` .
2007-08-15 11:28:22 -03:00
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
Trace functions should have three arguments: *frame* , *event* , and
*arg* . *frame* is the current stack frame. *event* is a string: `` 'call' `` ,
2018-01-24 08:57:49 -04:00
`` 'line' `` , `` 'return' `` , `` 'exception' `` or `` 'opcode' `` . *arg* depends on
the event type.
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
The trace function is invoked (with *event* set to `` 'call' `` ) whenever a new
local scope is entered; it should return a reference to a local trace
2019-09-05 08:10:37 -03:00
function to be used for the new scope, or `` None `` if the scope shouldn't be
traced.
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
2023-10-18 17:24:00 -03:00
The local trace function should return a reference to itself, or to another
function which would then be used as the local trace function for the scope.
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
2018-01-27 11:04:47 -04:00
If there is any error occurred in the trace function, it will be unset, just
like `` settrace(None) `` is called.
2023-10-31 13:24:54 -03:00
.. note ::
Tracing is disabled while calling the trace function (e.g. a function set by
:func: `!settrace` ). For recursive tracing see :func: `call_tracing` .
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
The events have the following meaning:
2009-01-03 17:18:54 -04:00
`` 'call' ``
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
A function is called (or some other code block entered). The
global trace function is called; *arg* is `` None `` ; the return value
specifies the local trace function.
`` 'line' ``
Merged revisions 72487-72488,72879 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72487 | jeffrey.yasskin | 2009-05-08 17:51:06 -0400 (Fri, 08 May 2009) | 7 lines
PyCode_NewEmpty:
Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New
are trying to build an empty code object, usually to put it in a dummy frame
object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify
just the filename, function name, and first line number, instead of also
requiring lots of code internals.
........
r72488 | jeffrey.yasskin | 2009-05-08 18:23:21 -0400 (Fri, 08 May 2009) | 13 lines
Issue 5954, PyFrame_GetLineNumber:
Most uses of PyCode_Addr2Line
(http://www.google.com/codesearch?q=PyCode_Addr2Line) are just trying to get
the line number of a specified frame, but there's no way to do that directly.
Forcing people to go through the code object makes them know more about the
guts of the interpreter than they should need.
The remaining uses of PyCode_Addr2Line seem to be getting the line from a
traceback (for example,
http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line),
which is replaced by the tb_lineno field. So we may be able to deprecate
PyCode_Addr2Line entirely for external use.
........
r72879 | jeffrey.yasskin | 2009-05-23 19:23:01 -0400 (Sat, 23 May 2009) | 14 lines
Issue #6042:
lnotab-based tracing is very complicated and isn't documented very well. There
were at least 3 comment blocks purporting to document co_lnotab, and none did a
very good job. This patch unifies them into Objects/lnotab_notes.txt which
tries to completely capture the current state of affairs.
I also discovered that we've attached 2 layers of patches to the basic tracing
scheme. The first layer avoids jumping to instructions that don't start a line,
to avoid problems in if statements and while loops. The second layer
discovered that jumps backward do need to trace at instructions that don't
start a line, so it added extra lnotab entries for 'while' and 'for' loops, and
added a special case for backward jumps within the same line. I replaced these
patches by just treating forward and backward jumps differently.
........
2009-07-21 01:30:03 -03:00
The interpreter is about to execute a new line of code or re-execute the
condition of a loop. The local trace function is called; *arg* is
`` None `` ; the return value specifies the new local trace function. See
:file: `Objects/lnotab_notes.txt` for a detailed explanation of how this
works.
2017-09-07 21:14:16 -03:00
Per-line events may be disabled for a frame by setting
2023-12-05 15:27:59 -04:00
:attr: `~frame.f_trace_lines` to :const: `False` on that
:ref: `frame <frame-objects>` .
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
`` 'return' ``
A function (or other code block) is about to return. The local trace
2010-10-15 13:42:37 -03:00
function is called; *arg* is the value that will be returned, or `` None ``
if the event is caused by an exception being raised. The trace function's
return value is ignored.
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
`` 'exception' ``
An exception has occurred. The local trace function is called; *arg* is a
tuple `` (exception, value, traceback) `` ; the return value specifies the
new local trace function.
2017-09-07 21:14:16 -03:00
`` 'opcode' ``
The interpreter is about to execute a new opcode (see :mod: `dis` for
opcode details). The local trace function is called; *arg* is
`` None `` ; the return value specifies the new local trace function.
Per-opcode events are not emitted by default: they must be explicitly
2023-12-05 15:27:59 -04:00
requested by setting :attr: `~frame.f_trace_opcodes` to :const: `True` on the
2023-08-20 08:09:33 -03:00
:ref: `frame <frame-objects>` .
2017-09-07 21:14:16 -03:00
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
Note that as an exception is propagated down the chain of callers, an
`` 'exception' `` event is generated at each level.
2019-09-20 12:19:02 -03:00
For more fine-grained usage, it's possible to set a trace function by
assigning `` frame.f_trace = tracefunc `` explicitly, rather than relying on
it being set indirectly via the return value from an already installed
trace function. This is also required for activating the trace function on
the current frame, which :func: `settrace` doesn't do. Note that in order
for this to work, a global tracing function must have been installed
with :func: `settrace` in order to enable the runtime tracing machinery,
but it doesn't need to be the same tracing function (e.g. it could be a
low overhead tracing function that simply returns `` None `` to disable
itself immediately on each frame).
Merged revisions 67295,67301-67302,67318,67330,67342-67343 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (jeu., 20 nov. 2008) | 1 line
move useful sys.settrace information to the function's documentation from the debugger
........
r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (jeu., 20 nov. 2008) | 1 line
fix indentation and a sphinx warning
........
r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (jeu., 20 nov. 2008) | 1 line
oops! didn't mean to disable that test
........
r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines
#4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present.
Will backport to 2.6
........
r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (sam., 22 nov. 2008) | 2 lines
#4364: fix attribute name on ctypes object.
........
r67342 | amaury.forgeotdarc | 2008-11-22 20:39:38 +0100 (sam., 22 nov. 2008) | 3 lines
yuvconvert.c is a part of the "sv" module, an old IRIX thing
and certainly not useful for any Windows build.
........
r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
........
2008-11-22 18:18:04 -04:00
For more information on code and frame objects, refer to :ref: `types` .
2019-06-27 14:47:59 -03:00
.. audit-event :: sys.settrace "" sys.settrace
2019-05-23 12:45: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 ::
2007-08-15 11:28:22 -03:00
The :func: `settrace` function is intended only for implementing debuggers,
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
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition, and
thus may not be available in all Python implementations.
2007-08-15 11:28:22 -03:00
2017-09-07 21:14:16 -03:00
.. versionchanged :: 3.7
2023-12-05 15:27:59 -04:00
`` 'opcode' `` event type added; :attr: `~frame.f_trace_lines` and
:attr: `~frame.f_trace_opcodes` attributes added to frames
2017-09-07 21:14:16 -03:00
2024-01-21 08:49:49 -04:00
.. function :: set_asyncgen_hooks([firstiter] [, finalizer])
2016-12-15 18:36:05 -04:00
Accepts two optional keyword arguments which are callables that accept an
:term: `asynchronous generator iterator` as an argument. The *firstiter*
callable will be called when an asynchronous generator is iterated for the
first time. The *finalizer* will be called when an asynchronous generator
is about to be garbage collected.
2019-06-27 14:47:59 -03:00
.. audit-event :: sys.set_asyncgen_hooks_firstiter "" sys.set_asyncgen_hooks
2019-05-23 12:45:22 -03:00
2019-06-27 14:47:59 -03:00
.. audit-event :: sys.set_asyncgen_hooks_finalizer "" sys.set_asyncgen_hooks
2019-05-23 12:45:22 -03:00
Two auditing events are raised because the underlying API consists of two
calls, each of which must raise its own event.
2016-12-15 18:36:05 -04:00
.. versionadded :: 3.6
See :pep: `525` for more details, and for a reference example of a
*finalizer* method see the implementation of
`` asyncio.Loop.shutdown_asyncgens `` in
:source: `Lib/asyncio/base_events.py`
.. note ::
This function has been added on a provisional basis (see :pep: `411`
for details.)
2018-01-21 10:44:07 -04:00
.. function :: set_coroutine_origin_tracking_depth(depth)
Allows enabling or disabling coroutine origin tracking. When
enabled, the `` cr_origin `` attribute on coroutine objects will
contain a tuple of (filename, line number, function name) tuples
describing the traceback where the coroutine object was created,
with the most recent call first. When disabled, `` cr_origin `` will
be None.
To enable, pass a *depth* value greater than zero; this sets the
number of frames whose information will be captured. To disable,
pass set *depth* to zero.
This setting is thread-specific.
.. versionadded :: 3.7
.. note ::
This function has been added on a provisional basis (see :pep: `411`
for details.) Use it only for debugging purposes.
2007-08-15 11:28:22 -03:00
2022-10-27 10:06:48 -03:00
.. function :: activate_stack_trampoline(backend, /)
Activate the stack profiler trampoline *backend* .
The only supported backend is `` "perf" `` .
.. availability :: Linux.
.. versionadded :: 3.12
.. seealso ::
* :ref: `perf_profiling`
* https://perf.wiki.kernel.org
.. function :: deactivate_stack_trampoline()
Deactivate the current stack profiler trampoline backend.
If no stack profiler is activated, this function has no effect.
.. availability :: Linux.
.. versionadded :: 3.12
.. function :: is_stack_trampoline_active()
Return `` True `` if a stack profiler trampoline is active.
.. availability :: Linux.
.. versionadded :: 3.12
2016-09-08 14:35:16 -03:00
.. function :: _enablelegacywindowsfsencoding()
2020-11-02 11:49:54 -04:00
Changes the :term: `filesystem encoding and error handler` to 'mbcs' and
'replace' respectively, for consistency with versions of Python prior to
3.6.
2016-09-08 14:35:16 -03:00
This is equivalent to defining the :envvar: `PYTHONLEGACYWINDOWSFSENCODING`
environment variable before launching Python.
2020-11-01 18:07:23 -04:00
See also :func: `sys.getfilesystemencoding` and
:func: `sys.getfilesystemencodeerrors` .
2018-10-12 11:55:20 -03:00
.. availability :: Windows.
2016-09-08 14:35:16 -03:00
2023-12-28 04:31:19 -04:00
.. note ::
Changing the filesystem encoding after Python startup is risky because
the old fsencoding or paths encoded by the old fsencoding may be cached
somewhere. Use :envvar: `PYTHONLEGACYWINDOWSFSENCODING` instead.
2016-09-08 14:35:16 -03:00
.. versionadded :: 3.6
See :pep: `529` for more details.
2015-05-31 18:13:08 -03:00
2023-12-28 04:31:19 -04:00
.. deprecated-removed :: 3.13 3.16
Use :envvar: `PYTHONLEGACYWINDOWSFSENCODING` instead.
2007-08-15 11:28:22 -03:00
.. data :: stdin
stdout
stderr
2011-12-15 11:25:34 -04:00
:term: `File objects <file object>` used by the interpreter for standard
input, output and errors:
* `` stdin `` is used for all interactive input (including calls to
:func: `input` );
* `` stdout `` is used for the output of :func: `print` and :term: `expression`
statements and for the prompts of :func: `input` ;
* The interpreter's own prompts and its error messages go to `` stderr `` .
2014-05-15 17:38:56 -03:00
These streams are regular :term: `text files <text file>` like those
returned by the :func: `open` function. Their parameters are chosen as
follows:
2011-12-15 11:25:34 -04:00
2020-11-02 11:49:54 -04:00
* The encoding and error handling are is initialized from
:c:member: `PyConfig.stdio_encoding` and :c:member: `PyConfig.stdio_errors` .
2019-02-14 19:35:25 -04:00
On Windows, UTF-8 is used for the console device. Non-character
devices such as disk files and pipes use the system locale
encoding (i.e. the ANSI codepage). Non-console character
2019-11-12 10:57:03 -04:00
devices such as NUL (i.e. where `` isatty() `` returns `` True `` ) use the
2019-02-14 19:35:25 -04:00
value of the console input and output codepages at startup,
respectively for stdin and stdout/stderr. This defaults to the
2020-11-02 11:49:54 -04:00
system :term: `locale encoding` if the process is not initially attached
2019-02-14 19:35:25 -04:00
to a console.
The special behaviour of the console can be overridden
by setting the environment variable PYTHONLEGACYWINDOWSSTDIO
before starting Python. In that case, the console codepages are
used as for any other character device.
Under all platforms, you can override the character encoding by
setting the :envvar: `PYTHONIOENCODING` environment variable before
starting Python or by using the new :option: `-X` `` utf8 `` command
line option and :envvar: `PYTHONUTF8` environment variable. However,
for the Windows console, this only applies when
:envvar: `PYTHONLEGACYWINDOWSSTDIO` is also set.
2011-12-15 11:25:34 -04:00
2020-01-01 18:21:43 -04:00
* When interactive, the `` stdout `` stream is line-buffered. Otherwise,
it is block-buffered like regular text files. The `` stderr `` stream
is line-buffered in both cases. You can make both streams unbuffered
by passing the :option: `-u` command-line option or setting the
:envvar: `PYTHONUNBUFFERED` environment variable.
.. versionchanged :: 3.9
Non-interactive `` stderr `` is now line-buffered instead of fully
buffered.
2011-12-15 11:25:34 -04:00
2014-05-15 17:38:56 -03:00
.. note ::
2009-05-12 17:47:57 -03:00
2014-05-15 17:38:56 -03:00
To write or read binary data from/to the standard streams, use the
underlying binary :data: `~io.TextIOBase.buffer` object. For example, to
write bytes to :data: `stdout` , use `` sys.stdout.buffer.write(b'abc') `` .
2009-06-14 15:41:18 -03:00
2014-05-15 17:38:56 -03:00
However, if you are writing a library (and do not control in which
context its code will be executed), be aware that the standard streams
may be replaced with file-like objects like :class: `io.StringIO` which
2023-10-24 05:03:35 -03:00
do not support the :attr: `!buffer` attribute.
2008-12-07 10:58:03 -04:00
2007-08-15 11:28:22 -03:00
.. data :: __stdin__
__stdout__
__stderr__
These objects contain the original values of `` stdin `` , `` stderr `` and
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
`` stdout `` at the start of the program. They are used during finalization,
and could be useful to print to the actual standard stream no matter if the
`` sys.std* `` object has been redirected.
2007-08-15 11:28:22 -03:00
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
It can also be used to restore the actual files to known working file objects
in case they have been overwritten with a broken object. However, the
preferred way to do this is to explicitly save the previous stream before
replacing it, and restore the saved object.
2007-11-12 22:19:40 -04:00
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
.. note ::
Under some conditions `` stdin `` , `` stdout `` and `` stderr `` as well as the
original values `` __stdin__ `` , `` __stdout__ `` and `` __stderr__ `` can be
2016-10-19 10:29:26 -03:00
`` None `` . It is usually the case for Windows GUI apps that aren't connected
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
to a console and Python apps started with :program: `pythonw` .
2007-11-12 22:19:40 -04:00
2007-08-15 11:28:22 -03:00
2021-01-25 18:12:50 -04:00
.. data :: stdlib_module_names
A frozenset of strings containing the names of standard library modules.
It is the same on all platforms. Modules which are not available on
some platforms and modules disabled at Python build are also listed.
All module kinds are listed: pure Python, built-in, frozen and extension
modules. Test modules are excluded.
2021-01-27 19:03:23 -04:00
For packages, only the main package is listed: sub-packages and sub-modules
are not listed. For example, the `` email `` package is listed, but the
`` email.mime `` sub-package and the `` email.message `` sub-module are not
listed.
2021-01-25 18:12:50 -04:00
2023-07-21 06:34:30 -03:00
See also the :data: `sys.builtin_module_names` list.
2021-01-25 18:12:50 -04:00
.. versionadded :: 3.10
2011-04-30 09:53:09 -03:00
.. data :: thread_info
2019-09-11 11:17:32 -03:00
A :term: `named tuple` holding information about the thread
2011-04-30 09:53:09 -03:00
implementation.
2023-08-20 08:09:33 -03:00
.. attribute :: thread_info.name
The name of the thread implementation:
* `` "nt" `` : Windows threads
* `` "pthread" `` : POSIX threads
* `` "pthread-stubs" `` : stub POSIX threads
(on WebAssembly platforms without threading support)
* `` "solaris" `` : Solaris threads
.. attribute :: thread_info.lock
The name of the lock implementation:
* `` "semaphore" `` : a lock uses a semaphore
* `` "mutex+cond" `` : a lock uses a mutex and a condition variable
* `` None `` if this information is unknown
.. attribute :: thread_info.version
The name and version of the thread library.
It is a string, or `` None `` if this information is unknown.
2011-04-30 09:53:09 -03:00
.. versionadded :: 3.3
2007-08-15 11:28:22 -03:00
.. data :: tracebacklimit
When this variable is set to an integer value, it determines the maximum number
of levels of traceback information printed when an unhandled exception occurs.
The default is `` 1000 `` . When set to `` 0 `` or less, all traceback information
is suppressed and only the exception type and value are printed.
2019-05-22 06:28:22 -03:00
.. function :: unraisablehook(unraisable, /)
Handle an unraisable exception.
Called when an exception has occurred but there is no way for Python to
handle it. For example, when a destructor raises an exception or during
garbage collection (:func: `gc.collect` ).
The *unraisable* argument has the following attributes:
2023-08-18 07:16:22 -03:00
* :attr: `!exc_type` : Exception type.
* :attr: `!exc_value` : Exception value, can be `` None `` .
* :attr: `!exc_traceback` : Exception traceback, can be `` None `` .
* :attr: `!err_msg` : Error message, can be `` None `` .
* :attr: `!object` : Object causing the exception, can be `` None `` .
2019-05-22 06:28:22 -03:00
2023-08-18 07:16:22 -03:00
The default hook formats :attr: `!err_msg` and :attr: `!object` as:
2019-05-27 03:57:14 -03:00
`` f'{err_msg}: {object!r}' `` ; use "Exception ignored in" error message
2023-08-18 07:16:22 -03:00
if :attr: `!err_msg` is `` None `` .
2019-05-27 03:57:14 -03:00
2019-06-14 13:03:22 -03:00
:func: `sys.unraisablehook` can be overridden to control how unraisable
exceptions are handled.
2023-08-18 07:16:22 -03:00
.. seealso ::
:func: `excepthook` which handles uncaught exceptions.
.. warning ::
2019-06-14 13:03:22 -03:00
2023-08-18 07:16:22 -03:00
Storing :attr: `!exc_value` using a custom hook can create a reference cycle.
It should be cleared explicitly to break the reference cycle when the
exception is no longer needed.
2019-06-14 13:03:22 -03:00
2023-08-18 07:16:22 -03:00
Storing :attr: `!object` using a custom hook can resurrect it if it is set to an
object which is being finalized. Avoid storing :attr: `!object` after the custom
hook completes to avoid resurrecting objects.
2019-05-22 06:28:22 -03:00
2019-11-28 12:46:11 -04:00
.. audit-event :: sys.unraisablehook hook,unraisable sys.unraisablehook
Raise an auditing event `` sys.unraisablehook `` with arguments
2023-08-18 07:16:22 -03:00
*hook* , *unraisable* when an exception that cannot be handled occurs.
The *unraisable* object is the same as what will be passed to the hook.
If no hook has been set, *hook* may be `` None `` .
2019-11-28 12:46:11 -04:00
2019-05-22 06:28:22 -03:00
.. versionadded :: 3.8
2007-08-15 11:28:22 -03:00
.. data :: version
A string containing the version number of the Python interpreter plus additional
2010-07-31 17:05:31 -03:00
information on the build number and compiler used. This string is displayed
when the interactive interpreter is started. Do not extract version information
out of it, rather, use :data: `version_info` and the functions provided by the
:mod: `platform` module.
2007-08-15 11:28:22 -03:00
.. data :: api_version
The C API version for this interpreter. Programmers may find this useful when
debugging version conflicts between Python and extension modules.
.. data :: version_info
A tuple containing the five components of the version number: *major* , *minor* ,
*micro* , *releaselevel* , and *serial* . All values except *releaselevel* are
integers; the release level is `` 'alpha' `` , `` 'beta' `` , `` 'candidate' `` , or
`` 'final' `` . The `` version_info `` value corresponding to the Python version 2.0
2009-02-05 21:32:42 -04:00
is `` (2, 0, 0, 'final', 0) `` . The components can also be accessed by name,
so `` sys.version_info[0] `` is equivalent to `` sys.version_info.major ``
and so on.
2007-08-15 11:28:22 -03:00
2009-04-08 21:08:24 -03:00
.. versionchanged :: 3.1
2010-08-17 12:07:14 -03:00
Added named component attributes.
2007-08-15 11:28:22 -03:00
.. data :: warnoptions
This is an implementation detail of the warnings framework; do not modify this
value. Refer to the :mod: `warnings` module for more information on the warnings
framework.
.. data :: winver
The version number used to form registry keys on Windows platforms. This is
stored as string resource 1000 in the Python DLL. The value is normally the
2023-01-11 20:11:12 -04:00
major and minor versions of the running Python interpreter. It is provided in the :mod: `sys`
2007-08-15 11:28:22 -03:00
module for informational purposes; modifying this value has no effect on the
2018-10-12 11:55:20 -03:00
registry keys used by Python.
.. availability :: Windows.
2010-07-02 17:26:07 -03:00
2010-10-21 10:42:28 -03:00
2023-09-05 08:35:52 -03:00
.. data :: monitoring
:noindex:
Namespace containing functions and constants for register callbacks
and controlling monitoring events.
See :mod: `sys.monitoring` for details.
2010-10-21 10:42:28 -03:00
.. data :: _xoptions
A dictionary of the various implementation-specific flags passed through
the :option: `-X` command-line option. Option names are either mapped to
2016-07-26 06:18:21 -03:00
their values, if given explicitly, or to :const: `True` . Example:
.. code-block :: shell-session
2010-10-21 10:42:28 -03:00
2022-07-31 12:33:56 -03:00
$ ./python -Xa=b -Xc
2010-10-21 10:42:28 -03:00
Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys._xoptions
2022-07-31 12:33:56 -03:00
{'a': 'b', 'c': True}
2010-10-21 10:42:28 -03:00
.. impl-detail ::
This is a CPython-specific way of accessing options passed through
:option: `-X` . Other implementations may export them through other
means, or not at all.
.. versionadded :: 3.2
2010-07-02 17:26:07 -03:00
.. rubric :: Citations
2022-08-04 04:13:49 -03:00
.. [C99] ISO/IEC 9899:1999. "Programming languages -- C." A public draft of this standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf\ .