@@ -500,43 +500,73 @@ Miscellaneous options
500
500
501
501
* ``-X faulthandler `` to enable :mod: `faulthandler `.
502
502
See also :envvar: `PYTHONFAULTHANDLER `.
503
+
504
+ .. versionadded :: 3.3
505
+
503
506
* ``-X showrefcount `` to output the total reference count and number of used
504
507
memory blocks when the program finishes or after each statement in the
505
508
interactive interpreter. This only works on :ref: `debug builds
506
509
<debug-build>`.
510
+
511
+ .. versionadded :: 3.4
512
+
507
513
* ``-X tracemalloc `` to start tracing Python memory allocations using the
508
514
:mod: `tracemalloc ` module. By default, only the most recent frame is
509
515
stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME `` to start
510
516
tracing with a traceback limit of *NFRAME * frames.
511
517
See :func: `tracemalloc.start ` and :envvar: `PYTHONTRACEMALLOC `
512
518
for more information.
519
+
520
+ .. versionadded :: 3.4
521
+
513
522
* ``-X int_max_str_digits `` configures the :ref: `integer string conversion
514
523
length limitation <int_max_str_digits>`. See also
515
524
:envvar: `PYTHONINTMAXSTRDIGITS `.
525
+
526
+ .. versionadded :: 3.11
527
+
516
528
* ``-X importtime `` to show how long each import takes. It shows module
517
529
name, cumulative time (including nested imports) and self time (excluding
518
530
nested imports). Note that its output may be broken in multi-threaded
519
531
application. Typical usage is ``python3 -X importtime -c 'import
520
532
asyncio' ``. See also :envvar: `PYTHONPROFILEIMPORTTIME `.
533
+
534
+ .. versionadded :: 3.7
535
+
521
536
* ``-X dev ``: enable :ref: `Python Development Mode <devmode >`, introducing
522
537
additional runtime checks that are too expensive to be enabled by
523
538
default. See also :envvar: `PYTHONDEVMODE `.
539
+
540
+ .. versionadded :: 3.7
541
+
524
542
* ``-X utf8 `` enables the :ref: `Python UTF-8 Mode <utf8-mode >`.
525
543
``-X utf8=0 `` explicitly disables :ref: `Python UTF-8 Mode <utf8-mode >`
526
544
(even when it would otherwise activate automatically).
527
545
See also :envvar: `PYTHONUTF8 `.
546
+
547
+ .. versionadded :: 3.7
548
+
528
549
* ``-X pycache_prefix=PATH `` enables writing ``.pyc `` files to a parallel
529
550
tree rooted at the given directory instead of to the code tree. See also
530
551
:envvar: `PYTHONPYCACHEPREFIX `.
552
+
553
+ .. versionadded :: 3.8
554
+
531
555
* ``-X warn_default_encoding `` issues a :class: `EncodingWarning ` when the
532
556
locale-specific default encoding is used for opening files.
533
557
See also :envvar: `PYTHONWARNDEFAULTENCODING `.
558
+
559
+ .. versionadded :: 3.10
560
+
534
561
* ``-X no_debug_ranges `` disables the inclusion of the tables mapping extra
535
562
location information (end line, start column offset and end column offset)
536
563
to every instruction in code objects. This is useful when smaller code
537
564
objects and pyc files are desired as well as suppressing the extra visual
538
565
location indicators when the interpreter displays tracebacks. See also
539
566
:envvar: `PYTHONNODEBUGRANGES `.
567
+
568
+ .. versionadded :: 3.11
569
+
540
570
* ``-X frozen_modules `` determines whether or not frozen modules are
541
571
ignored by the import machinery. A value of ``on `` means they get
542
572
imported and ``off `` means they are ignored. The default is ``on ``
@@ -545,71 +575,52 @@ Miscellaneous options
545
575
Note that the :mod: `!importlib_bootstrap ` and
546
576
:mod: `!importlib_bootstrap_external ` frozen modules are always used, even
547
577
if this flag is set to ``off ``. See also :envvar: `PYTHON_FROZEN_MODULES `.
578
+
579
+ .. versionadded :: 3.11
580
+
548
581
* ``-X perf `` enables support for the Linux ``perf `` profiler.
549
582
When this option is provided, the ``perf `` profiler will be able to
550
583
report Python calls. This option is only available on some platforms and
551
584
will do nothing if is not supported on the current system. The default value
552
585
is "off". See also :envvar: `PYTHONPERFSUPPORT ` and :ref: `perf_profiling `.
586
+
587
+ .. versionadded :: 3.12
588
+
553
589
* :samp: `-X cpu_count={ n } ` overrides :func: `os.cpu_count `,
554
590
:func: `os.process_cpu_count `, and :func: `multiprocessing.cpu_count `.
555
591
*n * must be greater than or equal to 1.
556
592
This option may be useful for users who need to limit CPU resources of a
557
593
container system. See also :envvar: `PYTHON_CPU_COUNT `.
558
594
If *n * is ``default ``, nothing is overridden.
595
+
596
+ .. versionadded :: 3.13
597
+
559
598
* :samp: `-X presite={ package.module } ` specifies a module that should be
560
599
imported before the :mod: `site ` module is executed and before the
561
600
:mod: `__main__ ` module exists. Therefore, the imported module isn't
562
601
:mod: `__main__ `. This can be used to execute code early during Python
563
602
initialization. Python needs to be :ref: `built in debug mode <debug-build >`
564
603
for this option to exist. See also :envvar: `PYTHON_PRESITE `.
604
+
605
+ .. versionadded :: 3.13
606
+
565
607
* :samp: `-X gil={ 0,1 } ` forces the GIL to be disabled or enabled,
566
608
respectively. Only available in builds configured with
567
609
:option: `--disable-gil `. See also :envvar: `PYTHON_GIL `.
568
610
611
+ .. versionadded :: 3.13
612
+
569
613
It also allows passing arbitrary values and retrieving them through the
570
614
:data: `sys._xoptions ` dictionary.
571
615
572
616
.. versionadded :: 3.2
573
617
574
- .. versionchanged :: 3.3
575
- Added the ``-X faulthandler `` option.
576
-
577
- .. versionchanged :: 3.4
578
- Added the ``-X showrefcount `` and ``-X tracemalloc `` options.
579
-
580
- .. versionchanged :: 3.6
581
- Added the ``-X showalloccount `` option.
582
-
583
- .. versionchanged :: 3.7
584
- Added the ``-X importtime ``, ``-X dev `` and ``-X utf8 `` options.
585
-
586
- .. versionchanged :: 3.8
587
- Added the ``-X pycache_prefix `` option. The ``-X dev `` option now logs
588
- ``close() `` exceptions in :class: `io.IOBase ` destructor.
589
-
590
618
.. versionchanged :: 3.9
591
- Using ``-X dev `` option, check *encoding * and *errors * arguments on
592
- string encoding and decoding operations.
593
-
594
- The ``-X showalloccount `` option has been removed.
619
+ Removed the ``-X showalloccount `` option.
595
620
596
621
.. versionchanged :: 3.10
597
- Added the ``-X warn_default_encoding `` option.
598
622
Removed the ``-X oldparser `` option.
599
623
600
- .. versionchanged :: 3.11
601
- Added the ``-X no_debug_ranges ``, ``-X frozen_modules `` and
602
- ``-X int_max_str_digits `` options.
603
-
604
- .. versionchanged :: 3.12
605
- Added the ``-X perf `` option.
606
-
607
- .. versionchanged :: 3.13
608
- Added the ``-X cpu_count `` and ``-X presite `` options.
609
-
610
- .. versionchanged :: 3.13
611
- Added the ``-X gil `` option.
612
-
613
624
.. _using-on-controlling-color :
614
625
615
626
Controlling color
0 commit comments