• Home
  • Raw
  • Download

Lines Matching +full:post +full:- +full:require +full:- +full:hook

1 :mod:`sys` --- System-specific parameters and functions
5 :synopsis: Access system-specific parameters and functions.
7 --------------
26 .. function:: addaudithook(hook)
28 Append the callable *hook* to the list of active auditing hooks for the
32 hook will be called in the order it was added with the event name and the
38 .. audit-event:: sys.addaudithook "" sys.addaudithook
43 new hook will not be added and the exception suppressed. As a result,
44 callers cannot assume that their hook has been added unless they control
47 See the :ref:`audit events table <audit-events>` for all events raised by
57 .. impl-detail::
61 true value. Otherwise, trace functions will skip the hook.
68 not). If the command was executed using the :option:`-c` command line option to
69 the interpreter, ``argv[0]`` is set to the string ``'-c'``. If no script name
101 the event name and arguments, and will re-raise the first exception
102 from any hook. In general, if an exception is raised, it should not
104 possible. This allows hook implementations to decide how to respond
114 See the :ref:`audit events table <audit-events>` for all events raised by
124 :ref:`virtual environment <venv-def>`, the values will stay the same; if
137 :data:`prefix`. If not running in a :ref:`virtual environment <venv-def>`, the values
150 big-endian (most-significant byte first) platforms, and ``'little'`` on
151 little-endian (least-significant byte first) platforms.
157 Python interpreter. (This information is not available in any other way ---
191 This is most useful for debugging deadlock: this function does not require the
193 long as they remain deadlocked. The frame returned for a non-deadlocked thread
199 .. audit-event:: sys._current_frames "" sys._current_frames
212 .. audit-event:: sys._current_exceptions "" sys._current_exceptions
216 This hook function is called by built-in :func:`breakpoint`. By default,
223 (positional and/or keyword). The built-in ``breakpoint()`` function passes
229 returns immediately; i.e. it is a no-op. If the environment variable is
232 dotted-import nomenclature, e.g. ``package.subpackage.module.function``.
236 ``sys.breakpointhook()`` returns to the built-in :func:`breakpoint`
250 Print low-level information to stderr about the state of CPython's memory
253 If Python is `built in debug mode <debug-build>` (:option:`configure
254 --with-pydebug option <--with-pydebug>`), it also performs some expensive
259 .. impl-detail::
282 customized by assigning another one-argument function to ``sys.displayhook``.
284 Pseudo-code::
312 ``False`` depending on the :option:`-B` command line option and the
319 If this is set (not ``None``), Python will write bytecode-cache ``.pyc``
324 :mod:`compileall` as a pre-build step, you must ensure you run it with the
329 This value is initially set based on the value of the :option:`-X`
330 ``pycache_prefix=PATH`` command-line option or the
331 :envvar:`PYTHONPYCACHEPREFIX` environment variable (command-line takes
345 before the program exits. The handling of such top-level exceptions can be
346 customized by assigning another three-argument function to ``sys.excepthook``.
348 .. audit-event:: sys.excepthook hook,type,value,traceback sys.excepthook
350 Raise an auditing event ``sys.excepthook`` with arguments ``hook``,
352 If no hook has been set, ``hook`` may be ``None``. If any hook raises
353 an exception derived from :class:`RuntimeError` the call to the hook will
354 be suppressed. Otherwise, the audit hook exception will be reported as
399 a :ref:`traceback object <traceback-objects>` which encapsulates the call
405 A string giving the site-specific directory prefix where the platform-dependent
407 be set at build time with the ``--exec-prefix`` argument to the
411 installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
416 If a :ref:`virtual environment <venv-def>` is in effect, this
440 "abnormal termination" by shells and the like. Most systems require it to be
441 in the range 0--127, and produce undefined results otherwise. Some systems
468 :const:`debug` :option:`-d`
469 :const:`inspect` :option:`-i`
470 :const:`interactive` :option:`-i`
471 :const:`isolated` :option:`-I`
472 :const:`optimize` :option:`-O` or :option:`-OO`
473 :const:`dont_write_bytecode` :option:`-B`
474 :const:`no_user_site` :option:`-s`
475 :const:`no_site` :option:`-S`
476 :const:`ignore_environment` :option:`-E`
477 :const:`verbose` :option:`-v`
478 :const:`bytes_warning` :option:`-b`
479 :const:`quiet` :option:`-q`
480 :const:`hash_randomization` :option:`-R`
481 :const:`dev_mode` :option:`-X dev <-X>` (:ref:`Python Development Mode <devmode>`)
482 :const:`utf8_mode` :option:`-X utf8 <-X>`
486 Added ``quiet`` attribute for the new :option:`-q` flag.
495 Added ``isolated`` attribute for :option:`-I` ``isolated`` flag.
499 Mode <devmode>` and the ``utf8_mode`` attribute for the new :option:`-X`
507 representation. The values correspond to the various floating-point
514 +---------------------+----------------+--------------------------------------------------+
521 +---------------------+----------------+--------------------------------------------------+
524 +---------------------+----------------+--------------------------------------------------+
525 | :const:`mant_dig` | DBL_MANT_DIG | float precision: the number of base-``radix`` |
527 +---------------------+----------------+--------------------------------------------------+
529 +---------------------+----------------+--------------------------------------------------+
530 | :const:`max_exp` | DBL_MAX_EXP | maximum integer *e* such that ``radix**(e-1)`` is|
532 +---------------------+----------------+--------------------------------------------------+
535 +---------------------+----------------+--------------------------------------------------+
541 +---------------------+----------------+--------------------------------------------------+
542 | :const:`min_exp` | DBL_MIN_EXP | minimum integer *e* such that ``radix**(e-1)`` is|
544 +---------------------+----------------+--------------------------------------------------+
547 +---------------------+----------------+--------------------------------------------------+
549 +---------------------+----------------+--------------------------------------------------+
556 +---------------------+----------------+--------------------------------------------------+
568 >>> format(float(s), '.15g') # convert to float and back -> same value
660 Return ``'utf-8'`` if the :ref:`Python UTF-8 Mode <utf8-mode>` is
700 object. All built-in objects will return correct results, but this
701 does not have to hold true for third-party extensions as it is implementation
733 .. audit-event:: sys._getframe "" sys._getframe
735 .. impl-detail::
758 .. impl-detail::
773 *platform_version* a 3-tuple and all other values are
783 +---------------------------------------+---------------------------------+
787 +---------------------------------------+---------------------------------+
790 +---------------------------------------+---------------------------------+
793 +---------------------------------------+---------------------------------+
852 :ref:`numeric-hash`.
854 +---------------------+--------------------------------------------------+
858 +---------------------+--------------------------------------------------+
860 +---------------------+--------------------------------------------------+
862 +---------------------+--------------------------------------------------+
864 +---------------------+--------------------------------------------------+
867 +---------------------+--------------------------------------------------+
870 +---------------------+--------------------------------------------------+
872 +---------------------+--------------------------------------------------+
874 +---------------------+--------------------------------------------------+
886 with each version, including proper support for non-production releases. For
897 as the result of passing it to the built-in :func:`hex` function. The
899 human-friendly encoding of the same information.
929 implementation's name and version, like ``'cpython-33'``. However, a
935 the Python implementation. These non-standard attributes must start with
955 +-------------------------+----------------------------------------------+
961 +-------------------------+----------------------------------------------+
964 +-------------------------+----------------------------------------------+
973 <tut-interactive>`. This is done after the :envvar:`PYTHONSTARTUP` file is
974 read, so that you can set this hook there. The :mod:`site` module
975 :ref:`sets this <rlcompleter-config>`.
977 .. audit-event:: cpython.run_interactivehook hook sys.__interactivehook__
980 ``cpython.run_interactivehook`` with the hook object as the argument when
981 the hook is called on startup.
989 -- which is *string* itself or a copy. Interning strings is useful to gain a
990 little performance on dictionary lookup -- if the keys in a dictionary are
1015 and engage in post-mortem debugging without having to re-execute the command
1017 post-mortem debugger; see :mod:`pdb` module for
1027 take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` on a
1028 64-bit platform.
1039 whether Unicode characters were stored as UCS-2 or UCS-4.
1098 the environment variable :envvar:`PYTHONPATH`, plus an installation-dependent
1146 platform-specific components to :data:`sys.path`, for instance.
1149 returned by ``uname -s`` with the first part of the version as returned by
1150 ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
1155 # FreeBSD-specific code here...
1157 # Linux-specific code here...
1159 # AIX-specific code here...
1188 system-dependent version information.
1196 Name of the platform-specific library directory. It is used to build the
1200 to ``"lib64"`` on 64-bit platforms which gives the following ``sys.path``
1205 * ``/usr/lib64/pythonX.Y/lib-dynload/``:
1208 * ``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not
1209 :data:`sys.platlibdir`): Third-party modules
1210 * ``/usr/lib64/pythonX.Y/site-packages/``:
1211 C extension modules of third-party packages
1218 A string giving the site-specific directory prefix where the platform
1220 ``'/usr/local'``. This can be set at build time with the ``--prefix``
1224 .. note:: If a :ref:`virtual environment <venv-def>` is in effect, this
1241 values in this case are ``'>>> '`` and ``'... '``. If a non-string object is
1242 assigned to either variable, its :func:`str` is re-evaluated each time the
1271 thread-specific, but there is no way for the profiler to know about context switches between
1281 .. audit-event:: sys.setprofile "" sys.setprofile
1296 a built-in. *arg* is the C function object.
1310 The highest possible limit is platform-dependent. A user may need to set the
1312 that supports a higher limit. This should be done with care, because a too-high
1325 Set the interpreter's thread switch interval (in seconds). This floating-point
1328 can be higher, especially if long-running internal functions or methods
1343 source code debugger in Python. The function is thread-specific; for a
1372 The interpreter is about to execute a new line of code or re-execute the
1377 Per-line events may be disabled for a frame by setting
1395 Per-opcode events are not emitted by default: they must be explicitly
1402 For more fine-grained usage, it's possible to set a trace function by
1415 .. audit-event:: sys.settrace "" sys.settrace
1417 .. impl-detail::
1437 .. audit-event:: sys.set_asyncgen_hooks_firstiter "" sys.set_asyncgen_hooks
1439 .. audit-event:: sys.set_asyncgen_hooks_finalizer "" sys.set_asyncgen_hooks
1467 This setting is thread-specific.
1512 On Windows, UTF-8 is used for the console device. Non-character
1514 encoding (i.e. the ANSI codepage). Non-console character
1528 starting Python or by using the new :option:`-X` ``utf8`` command
1533 * When interactive, the ``stdout`` stream is line-buffered. Otherwise,
1534 it is block-buffered like regular text files. The ``stderr`` stream
1535 is line-buffered in both cases. You can make both streams unbuffered
1536 by passing the :option:`-u` command-line option or setting the
1540 Non-interactive ``stderr`` is now line-buffered instead of fully
1551 may be replaced with file-like objects like :class:`io.StringIO` which
1582 All module kinds are listed: pure Python, built-in, frozen and extension
1585 For packages, only the main package is listed: sub-packages and sub-modules
1587 ``email.mime`` sub-package and the ``email.message`` sub-module are not
1602 +------------------+---------------------------------------------------------+
1610 +------------------+---------------------------------------------------------+
1617 +------------------+---------------------------------------------------------+
1620 +------------------+---------------------------------------------------------+
1649 The default hook formats *err_msg* and *object* as:
1656 Storing *exc_value* using a custom hook can create a reference cycle. It
1660 Storing *object* using a custom hook can resurrect it if it is set to an
1662 hook completes to avoid resurrecting objects.
1666 .. audit-event:: sys.unraisablehook hook,unraisable sys.unraisablehook
1669 ``hook``, ``unraisable`` when an exception that cannot be handled occurs.
1670 The ``unraisable`` object is the same as what will be passed to the hook.
1671 If no hook has been set, ``hook`` may be ``None``.
1723 A dictionary of the various implementation-specific flags passed through
1724 the :option:`-X` command-line option. Option names are either mapped to
1727 .. code-block:: shell-session
1729 $ ./python -Xa=b -Xc
1737 .. impl-detail::
1739 This is a CPython-specific way of accessing options passed through
1740 :option:`-X`. Other implementations may export them through other
1748 …/IEC 9899:1999. "Programming languages -- C." A public draft of this standard is available at ht…