• Home
  • Raw
  • Download

Lines Matching +full:debug +full:- +full:mode

6 .. _using-on-general:
14 .. impl-detail::
20 .. _using-on-cmdline:
23 ------------
27 python [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args]
34 .. _using-on-interface-options:
43 commands and executes them until an EOF (an end-of-file character, you can
44 produce that with :kbd:`Ctrl-D` on UNIX or :kbd:`Ctrl-Z, Enter` on Windows) is read.
49 * When called with ``-c command``, it executes the Python statement(s) given as
52 * When called with ``-m module-name``, the given module is located on the
55 In non-interactive mode, the entire input is parsed before it is executed.
58 all consecutive arguments will end up in :data:`sys.argv` -- note that the first
62 .. cmdoption:: -c <command>
69 ``"-c"`` and the current directory will be added to the start of
73 .. audit-event:: cpython.run_command command cmdoption-c
75 .. cmdoption:: -m <module-name>
94 This option cannot be used with built-in modules and extension modules
101 first element will be set to ``"-m"``). As with the :option:`-c` option,
104 :option:`-I` option can be used to run the script in isolated mode where
106 site-packages directory. All :envvar:`PYTHON*` environment variables are
112 python -m timeit -s 'setup here' 'benchmarked code here'
113 python -m timeit -h # for details
115 .. audit-event:: cpython.run_module module-name cmdoption-m
121 :pep:`338` -- Executing modules as scripts
129 .. _cmdarg-dash:
131 .. describe:: -
134 a terminal, :option:`-i` is implied.
137 ``"-"`` and the current directory will be added to the start of
140 .. audit-event:: cpython.run_stdin "" ""
142 .. _cmdarg-script:
162 :option:`-I` option can be used to run the script in isolated mode where
164 site-packages directory. All :envvar:`PYTHON*` environment variables are
167 .. audit-event:: cpython.run_file filename
174 If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is
176 start of :data:`sys.path`. Also, tab-completion and history editing is
178 :ref:`rlcompleter-config`).
180 .. seealso:: :ref:`tut-invoking`
183 Automatic enabling of tab-completion and history editing.
189 .. cmdoption:: -?
190 -h
191 --help
196 .. cmdoption:: -V
197 --version
201 .. code-block:: none
207 .. code-block:: none
213 The ``-VV`` option.
215 .. _using-on-misc-options:
220 .. cmdoption:: -b
224 option is given twice (:option:`!-bb`).
229 .. cmdoption:: -B
235 .. cmdoption:: --check-hash-based-pycs default|always|never
237 Control the validation behavior of hash-based ``.pyc`` files. See
238 :ref:`pyc-invalidation`. When set to ``default``, checked and unchecked
239 hash-based bytecode cache files are validated according to their default
240 semantics. When set to ``always``, all hash-based ``.pyc`` files, whether
242 file. When set to ``never``, hash-based ``.pyc`` files are not validated
245 The semantics of timestamp-based ``.pyc`` files are unaffected by this
249 .. cmdoption:: -d
255 .. cmdoption:: -E
261 .. cmdoption:: -i
263 When a script is passed as first argument or the :option:`-c` option is used,
264 enter interactive mode after executing the script or the command, even when
272 .. cmdoption:: -I
274 Run Python in isolated mode. This also implies -E and -s.
275 In isolated mode :data:`sys.path` contains neither the script's directory nor
276 the user's site-packages directory. All :envvar:`PYTHON*` environment
283 .. cmdoption:: -O
287 (:term:`bytecode`) files by adding ``.opt-1`` before the ``.pyc``
294 .. cmdoption:: -OO
296 Do :option:`-O` and also discard docstrings. Augment the filename
297 for compiled (:term:`bytecode`) files by adding ``.opt-2`` before the
304 .. cmdoption:: -q
306 Don't display the copyright and version messages even in interactive mode.
311 .. cmdoption:: -R
324 denial-of-service caused by carefully-chosen inputs that exploit the worst
326 http://www.ocert.org/advisories/ocert-2011-003.html for details.
337 .. cmdoption:: -s
339 Don't add the :data:`user site-packages directory <site.USER_SITE>` to
344 :pep:`370` -- Per user site-packages directory
347 .. cmdoption:: -S
349 Disable the import of the module :mod:`site` and the site-dependent
355 .. cmdoption:: -u
366 .. cmdoption:: -v
369 (filename or built-in module) from which it is loaded. When given twice
370 (:option:`!-vv`), print a message for each file that is checked for when
375 .. _using-on-warnings:
376 .. cmdoption:: -W arg
382 .. code-block:: none
389 Multiple :option:`-W` options may be given; when a warning matches more than
391 :option:`-W` options are ignored (though, a warning message is printed about
402 -Wdefault # Warn once per call location
403 -Werror # Convert to exceptions
404 -Walways # Warn every time
405 -Wmodule # Warn once per calling module
406 -Wonce # Warn once per Python process
407 -Wignore # Never warn
409 The action names can be abbreviated as desired (e.g. ``-Wi``, ``-Wd``,
410 ``-Wa``, ``-We``) and the interpreter will resolve them to the appropriate
413 See :ref:`warning-filter` and :ref:`describing-warning-filters` for more
417 .. cmdoption:: -x
419 Skip the first line of the source, allowing use of non-Unix forms of
423 .. cmdoption:: -X
425 Reserved for various implementation-specific options. CPython currently
428 * ``-X faulthandler`` to enable :mod:`faulthandler`;
429 * ``-X showrefcount`` to output the total reference count and number of used
431 interactive interpreter. This only works on debug builds.
432 * ``-X tracemalloc`` to start tracing Python memory allocations using the
434 stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start
437 * ``-X showalloccount`` to output the total count of allocated objects for
440 * ``-X int_max_str_digits`` configures the :ref:`integer string conversion
443 * ``-X importtime`` to show how long each import takes. It shows module
445 nested imports). Note that its output may be broken in multi-threaded
446 application. Typical usage is ``python3 -X importtime -c 'import
448 * ``-X dev``: enable CPython's "development mode", introducing additional
451 are only emitted when an issue is detected. Effect of the developer mode:
453 * Add ``default`` warning filter, as :option:`-W` ``default``.
454 * Install debug hooks on memory allocators: see the
458 * Enable :ref:`asyncio debug mode <asyncio-debug-mode>`.
463 * ``-X utf8`` enables UTF-8 mode for operating system interfaces, overriding
464 the default locale-aware mode. ``-X utf8=0`` explicitly disables UTF-8
465 mode (even when it would otherwise activate automatically).
467 * ``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel
475 The :option:`-X` option was added.
478 The ``-X faulthandler`` option.
481 The ``-X showrefcount`` and ``-X tracemalloc`` options.
484 The ``-X showalloccount`` option.
487 The ``-X importtime``, ``-X dev`` and ``-X utf8`` options.
490 The ``-X pycache_prefix`` option. The ``-X dev`` option now logs
494 The ``-X int_max_str_digits`` option.
500 .. cmdoption:: -J
507 .. _using-on-envvars:
510 ---------------------
513 before the command-line switches other than -E or -I. It is customary that
514 command-line switches override environmental variables where there is a
522 :file:`{exec_prefix}` are installation-dependent directories, both defaulting
535 Non-existent directories are silently ignored.
547 :ref:`using-on-interface-options`. The search path can be manipulated from
554 executed before the first prompt is displayed in interactive mode. The file
560 .. audit-event:: cpython.run_startup filename PYTHONSTARTUP
568 If this is set to a non-empty string it is equivalent to specifying the
569 :option:`-O` option. If set to an integer, it is equivalent to specifying
570 :option:`-O` multiple times.
575 If this is set, it names a callable using dotted-path notation. The module
578 called by built-in :func:`breakpoint`. If not set, or set to the empty
587 If this is set to a non-empty string it is equivalent to specifying the
588 :option:`-d` option. If set to an integer, it is equivalent to specifying
589 :option:`-d` multiple times.
594 If this is set to a non-empty string it is equivalent to specifying the
595 :option:`-i` option.
598 to force inspect mode on program termination.
603 If this is set to a non-empty string it is equivalent to specifying the
604 :option:`-u` option.
609 If this is set to a non-empty string it is equivalent to specifying the
610 :option:`-v` option. If set to an integer, it is equivalent to specifying
611 :option:`-v` multiple times.
622 If this is set to a non-empty string, Python won't try to write ``.pyc``
624 specifying the :option:`-B` option.
631 tree. This is equivalent to specifying the :option:`-X`
683 If this is set, Python won't add the :data:`user site-packages directory
688 :pep:`370` -- Per user site-packages directory
694 compute the path of the :data:`user site-packages directory <site.USER_SITE>`
695 and :ref:`Distutils installation paths <inst-alt-install-user>` for
696 ``python setup.py install --user``.
700 :pep:`370` -- Per user site-packages directory
711 This is equivalent to the :option:`-W` option. If set to a comma
712 separated string, it is equivalent to specifying :option:`-W` multiple
727 See :ref:`warning-filter` and :ref:`describing-warning-filters` for more
733 If this environment variable is set to a non-empty string,
737 :option:`-X` ``faulthandler`` option.
744 If this environment variable is set to a non-empty string, start tracing
755 If this environment variable is set to a non-empty string, Python will
757 ``-X importtime`` on the command line.
764 If this environment variable is set to a non-empty string, enable the
765 :ref:`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module.
772 Set the Python memory allocators and/or install debug hooks.
777 <default-memory-allocators>`.
785 Install debug hooks:
787 * ``debug``: install debug hooks on top of the :ref:`default memory
788 allocators <default-memory-allocators>`.
789 * ``malloc_debug``: same as ``malloc`` but also install debug hooks.
790 * ``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks.
792 See the :ref:`default memory allocators <default-memory-allocators>` and the
793 :c:func:`PyMem_SetupDebugHooks` function (install debug hooks on Python
804 If set to a non-empty string, Python will print statistics of the
813 This variable can now also be used on Python compiled in release mode.
819 If set to a non-empty string, the default filesystem encoding and errors mode
820 will revert to their pre-3.6 values of 'mbcs' and 'replace', respectively.
821 Otherwise, the new defaults 'utf-8' and 'surrogatepass' are used.
833 If set to a non-empty string, does not use the new console reader and
835 the active console code page, rather than using utf-8.
848 to skip coercing the legacy ASCII-based C and POSIX locales to a more
849 capable UTF-8 based alternative.
854 ``C`` locale, or else the explicitly ASCII-based ``POSIX`` locale, then the
859 * ``C.UTF-8``
861 * ``UTF-8``
866 addition to being seen by both the interpreter itself and other locale-aware
875 :ref:`error handler <error-handlers>` for :data:`sys.stdin` and
887 default in legacy ASCII-based locales. Both features must be disabled in
888 order to force the interpreter to use ``ASCII`` instead of ``UTF-8`` for
899 If this environment variable is set to a non-empty string, enable the
900 CPython "development mode". See the :option:`-X` ``dev`` option.
906 If set to ``1``, enables the interpreter's UTF-8 mode, where ``UTF-8`` is
912 * :func:`sys.getfilesystemencoding()` returns ``'UTF-8'`` (the locale
914 * :func:`locale.getpreferredencoding()` returns ``'UTF-8'`` (the locale
918 UTF-8 as their text encoding, with the ``surrogateescape``
919 :ref:`error handler <error-handlers>` being enabled for :data:`sys.stdin`
921 ``backslashreplace`` as it does in the default locale-aware mode)
927 to text using the UTF-8 encoding.
928 * :func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding.
929 * :func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8
931 default so that attempting to open a binary file in text mode is likely
934 Note that the standard stream settings in UTF-8 mode can be overridden by
935 :envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware
936 mode).
938 If set to ``0``, the interpreter runs in its default locale-aware mode.
940 Setting any other non-empty string causes an error during interpreter
945 identified as a legacy ASCII-based locale
948 default to enabling UTF-8 mode unless explicitly instructed not to do so.
950 Also available as the :option:`-X` ``utf8`` option.
956 Debug-mode variables
959 Setting these variables only has an effect in a debug build of Python.
963 If set, Python will print threading debug info.
965 Need Python configured with the ``--with-pydebug`` build option.
973 Need Python configured with the ``--with-trace-refs`` build option.