• 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
36 .. audit-event:: sys.addaudithook "" sys.addaudithook
40 new hook will not be added and the exception suppressed. As a result,
41 callers cannot assume that their hook has been added unless they control
51 .. impl-detail::
55 true value. Otherwise, trace functions will skip the hook.
62 not). If the command was executed using the :option:`-c` command line option to
63 the interpreter, ``argv[0]`` is set to the string ``'-c'``. If no script name
87 This function will raise the first exception raised by any hook. In general,
97 See the :ref:`audit events table <audit-events>` for all events raised by
107 :ref:`virtual environment <venv-def>`, the values will stay the same; if
120 :data:`prefix`. If not running in a :ref:`virtual environment <venv-def>`, the values
133 big-endian (most-significant byte first) platforms, and ``'little'`` on
134 little-endian (least-significant byte first) platforms.
140 Python interpreter. (This information is not available in any other way ---
172 This is most useful for debugging deadlock: this function does not require the
174 long as they remain deadlocked. The frame returned for a non-deadlocked thread
180 .. audit-event:: sys._current_frames "" sys._current_frames
185 This hook function is called by built-in :func:`breakpoint`. By default,
192 (positional and/or keyword). The built-in ``breakpoint()`` function passes
198 returns immediately; i.e. it is a no-op. If the environment variable is
201 dotted-import nomenclature, e.g. ``package.subpackage.module.function``.
205 ``sys.breakpointhook()`` returns to the built-in :func:`breakpoint`
219 Print low-level information to stderr about the state of CPython's memory
222 If Python is configured --with-pydebug, it also performs some expensive
227 .. impl-detail::
250 customized by assigning another one-argument function to ``sys.displayhook``.
252 Pseudo-code::
280 ``False`` depending on the :option:`-B` command line option and the
287 If this is set (not ``None``), Python will write bytecode-cache ``.pyc``
292 :mod:`compileall` as a pre-build step, you must ensure you run it with the
297 This value is initially set based on the value of the :option:`-X`
298 ``pycache_prefix=PATH`` command-line option or the
299 :envvar:`PYTHONPYCACHEPREFIX` environment variable (command-line takes
313 before the program exits. The handling of such top-level exceptions can be
314 customized by assigning another three-argument function to ``sys.excepthook``.
316 .. audit-event:: sys.excepthook hook,type,value,traceback sys.excepthook
318 Raise an auditing event ``sys.excepthook`` with arguments ``hook``,
320 If no hook has been set, ``hook`` may be ``None``. If any hook raises
321 an exception derived from :class:`RuntimeError` the call to the hook will
322 be suppressed. Otherwise, the audit hook exception will be reported as
367 a :ref:`traceback object <traceback-objects>` which encapsulates the call
373 A string giving the site-specific directory prefix where the platform-dependent
375 be set at build time with the ``--exec-prefix`` argument to the
379 installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
384 If a :ref:`virtual environment <venv-def>` is in effect, this
408 "abnormal termination" by shells and the like. Most systems require it to be
409 in the range 0--127, and produce undefined results otherwise. Some systems
436 :const:`debug` :option:`-d`
437 :const:`inspect` :option:`-i`
438 :const:`interactive` :option:`-i`
439 :const:`isolated` :option:`-I`
440 :const:`optimize` :option:`-O` or :option:`-OO`
441 :const:`dont_write_bytecode` :option:`-B`
442 :const:`no_user_site` :option:`-s`
443 :const:`no_site` :option:`-S`
444 :const:`ignore_environment` :option:`-E`
445 :const:`verbose` :option:`-v`
446 :const:`bytes_warning` :option:`-b`
447 :const:`quiet` :option:`-q`
448 :const:`hash_randomization` :option:`-R`
449 :const:`dev_mode` :option:`-X` ``dev``
450 :const:`utf8_mode` :option:`-X` ``utf8``
451 …:const:`int_max_str_digits` :option:`-X int_max_str_digits <-X>` (:ref:`integer string conversio…
455 Added ``quiet`` attribute for the new :option:`-q` flag.
464 Added ``isolated`` attribute for :option:`-I` ``isolated`` flag.
467 Added ``dev_mode`` attribute for the new :option:`-X` ``dev`` flag
468 and ``utf8_mode`` attribute for the new :option:`-X` ``utf8`` flag.
478 representation. The values correspond to the various floating-point
485 +---------------------+----------------+--------------------------------------------------+
490 +---------------------+----------------+--------------------------------------------------+
493 +---------------------+----------------+--------------------------------------------------+
494 | :const:`mant_dig` | DBL_MANT_DIG | float precision: the number of base-``radix`` |
496 +---------------------+----------------+--------------------------------------------------+
498 +---------------------+----------------+--------------------------------------------------+
499 | :const:`max_exp` | DBL_MAX_EXP | maximum integer *e* such that ``radix**(e-1)`` is|
501 +---------------------+----------------+--------------------------------------------------+
504 +---------------------+----------------+--------------------------------------------------+
506 +---------------------+----------------+--------------------------------------------------+
507 | :const:`min_exp` | DBL_MIN_EXP | minimum integer *e* such that ``radix**(e-1)`` is|
509 +---------------------+----------------+--------------------------------------------------+
512 +---------------------+----------------+--------------------------------------------------+
514 +---------------------+----------------+--------------------------------------------------+
521 +---------------------+----------------+--------------------------------------------------+
533 >>> format(float(s), '.15g') # convert to float and back -> same value
613 This encoding is always ASCII-compatible.
618 * In the UTF-8 mode, the encoding is ``utf-8`` on any platform.
620 * On macOS, the encoding is ``'utf-8'``.
624 * On Windows, the encoding may be ``'utf-8'`` or ``'mbcs'``, depending
627 * On Android, the encoding is ``'utf-8'``.
629 * On VxWorks, the encoding is ``'utf-8'``.
639 Return 'utf-8' in the UTF-8 mode.
680 object. All built-in objects will return correct results, but this
681 does not have to hold true for third-party extensions as it is implementation
713 .. audit-event:: sys._getframe "" sys._getframe
715 .. impl-detail::
738 .. impl-detail::
753 *platform_version* a 3-tuple and all other values are
763 +---------------------------------------+---------------------------------+
767 +---------------------------------------+---------------------------------+
770 +---------------------------------------+---------------------------------+
773 +---------------------------------------+---------------------------------+
827 :ref:`numeric-hash`.
829 +---------------------+--------------------------------------------------+
833 +---------------------+--------------------------------------------------+
835 +---------------------+--------------------------------------------------+
837 +---------------------+--------------------------------------------------+
839 +---------------------+--------------------------------------------------+
842 +---------------------+--------------------------------------------------+
845 +---------------------+--------------------------------------------------+
847 +---------------------+--------------------------------------------------+
849 +---------------------+--------------------------------------------------+
861 with each version, including proper support for non-production releases. For
872 as the result of passing it to the built-in :func:`hex` function. The
874 human-friendly encoding of the same information.
904 implementation's name and version, like ``'cpython-33'``. However, a
910 the Python implementation. These non-standard attributes must start with
930 +----------------------------------------+-----------------------------------------------+
936 +----------------------------------------+-----------------------------------------------+
939 +----------------------------------------+-----------------------------------------------+
943 +----------------------------------------+-----------------------------------------------+
944 | :const:`str_digits_check_threshold` | minimum non-zero value for |
947 | | :option:`-X int_max_str_digits <-X>`. |
948 +----------------------------------------+-----------------------------------------------+
960 <tut-interactive>`. This is done after the :envvar:`PYTHONSTARTUP` file is
961 read, so that you can set this hook there. The :mod:`site` module
962 :ref:`sets this <rlcompleter-config>`.
964 .. audit-event:: cpython.run_interactivehook hook sys.__interactivehook__
967 ``cpython.run_interactivehook`` with the hook object as the argument when
968 the hook is called on startup.
976 -- which is *string* itself or a copy. Interning strings is useful to gain a
977 little performance on dictionary lookup -- if the keys in a dictionary are
1002 and engage in post-mortem debugging without having to re-execute the command
1004 post-mortem debugger; see :mod:`pdb` module for
1014 take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` on a
1015 64-bit platform.
1026 whether Unicode characters were stored as UCS-2 or UCS-4.
1071 the environment variable :envvar:`PYTHONPATH`, plus an installation-dependent
1119 platform-specific components to :data:`sys.path`, for instance.
1122 returned by ``uname -s`` with the first part of the version as returned by
1123 ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
1128 # FreeBSD-specific code here...
1130 # Linux-specific code here...
1132 # AIX-specific code here...
1161 system-dependent version information.
1169 A string giving the site-specific directory prefix where the platform
1171 ``'/usr/local'``. This can be set at build time with the ``--prefix``
1178 .. note:: If a :ref:`virtual environment <venv-def>` is in effect, this
1195 values in this case are ``'>>> '`` and ``'... '``. If a non-string object is
1196 assigned to either variable, its :func:`str` is re-evaluated each time the
1248 thread-specific, but there is no way for the profiler to know about context switches between
1258 .. audit-event:: sys.setprofile "" sys.setprofile
1273 a built-in. *arg* is the C function object.
1287 The highest possible limit is platform-dependent. A user may need to set the
1289 that supports a higher limit. This should be done with care, because a too-high
1302 Set the interpreter's thread switch interval (in seconds). This floating-point
1305 can be higher, especially if long-running internal functions or methods
1320 source code debugger in Python. The function is thread-specific; for a
1349 The interpreter is about to execute a new line of code or re-execute the
1354 Per-line events may be disabled for a frame by setting
1372 Per-opcode events are not emitted by default: they must be explicitly
1379 For more fine-grained usage, it's possible to set a trace function by
1392 .. audit-event:: sys.settrace "" sys.settrace
1394 .. impl-detail::
1414 .. audit-event:: sys.set_asyncgen_hooks_firstiter "" sys.set_asyncgen_hooks
1416 .. audit-event:: sys.set_asyncgen_hooks_finalizer "" sys.set_asyncgen_hooks
1444 This setting is thread-specific.
1482 * The character encoding is platform-dependent. Non-Windows
1486 On Windows, UTF-8 is used for the console device. Non-character
1488 encoding (i.e. the ANSI codepage). Non-console character
1502 starting Python or by using the new :option:`-X` ``utf8`` command
1507 * When interactive, ``stdout`` and ``stderr`` streams are line-buffered.
1508 Otherwise, they are block-buffered like regular text files. You can
1509 override this value with the :option:`-u` command-line option.
1519 may be replaced with file-like objects like :class:`io.StringIO` which
1551 +------------------+---------------------------------------------------------+
1559 +------------------+---------------------------------------------------------+
1566 +------------------+---------------------------------------------------------+
1569 +------------------+---------------------------------------------------------+
1598 The default hook formats *err_msg* and *object* as:
1605 Storing *exc_value* using a custom hook can create a reference cycle. It
1609 Storing *object* using a custom hook can resurrect it if it is set to an
1611 hook completes to avoid resurrecting objects.
1615 .. audit-event:: sys.unraisablehook hook,unraisable sys.unraisablehook
1618 ``hook``, ``unraisable`` when an exception that cannot be handled occurs.
1619 The ``unraisable`` object is the same as what will be passed to the hook.
1620 If no hook has been set, ``hook`` may be ``None``.
1672 A dictionary of the various implementation-specific flags passed through
1673 the :option:`-X` command-line option. Option names are either mapped to
1676 .. code-block:: shell-session
1678 $ ./python -Xa=b -Xc
1686 .. impl-detail::
1688 This is a CPython-specific way of accessing options passed through
1689 :option:`-X`. Other implementations may export them through other
1697 …/IEC 9899:1999. "Programming languages -- C." A public draft of this standard is available at ht…