Skip to content

Commit 10f1a26

Browse files
gh-115664: Reorganize versionadded directives for -X options (GH-116304)
Add the versionadded directives just under the description of the corresponding option.
1 parent 7d9d6b5 commit 10f1a26

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

Doc/using/cmdline.rst

+45-34
Original file line numberDiff line numberDiff line change
@@ -500,43 +500,73 @@ Miscellaneous options
500500

501501
* ``-X faulthandler`` to enable :mod:`faulthandler`.
502502
See also :envvar:`PYTHONFAULTHANDLER`.
503+
504+
.. versionadded:: 3.3
505+
503506
* ``-X showrefcount`` to output the total reference count and number of used
504507
memory blocks when the program finishes or after each statement in the
505508
interactive interpreter. This only works on :ref:`debug builds
506509
<debug-build>`.
510+
511+
.. versionadded:: 3.4
512+
507513
* ``-X tracemalloc`` to start tracing Python memory allocations using the
508514
:mod:`tracemalloc` module. By default, only the most recent frame is
509515
stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start
510516
tracing with a traceback limit of *NFRAME* frames.
511517
See :func:`tracemalloc.start` and :envvar:`PYTHONTRACEMALLOC`
512518
for more information.
519+
520+
.. versionadded:: 3.4
521+
513522
* ``-X int_max_str_digits`` configures the :ref:`integer string conversion
514523
length limitation <int_max_str_digits>`. See also
515524
:envvar:`PYTHONINTMAXSTRDIGITS`.
525+
526+
.. versionadded:: 3.11
527+
516528
* ``-X importtime`` to show how long each import takes. It shows module
517529
name, cumulative time (including nested imports) and self time (excluding
518530
nested imports). Note that its output may be broken in multi-threaded
519531
application. Typical usage is ``python3 -X importtime -c 'import
520532
asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`.
533+
534+
.. versionadded:: 3.7
535+
521536
* ``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing
522537
additional runtime checks that are too expensive to be enabled by
523538
default. See also :envvar:`PYTHONDEVMODE`.
539+
540+
.. versionadded:: 3.7
541+
524542
* ``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`.
525543
``-X utf8=0`` explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>`
526544
(even when it would otherwise activate automatically).
527545
See also :envvar:`PYTHONUTF8`.
546+
547+
.. versionadded:: 3.7
548+
528549
* ``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel
529550
tree rooted at the given directory instead of to the code tree. See also
530551
:envvar:`PYTHONPYCACHEPREFIX`.
552+
553+
.. versionadded:: 3.8
554+
531555
* ``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the
532556
locale-specific default encoding is used for opening files.
533557
See also :envvar:`PYTHONWARNDEFAULTENCODING`.
558+
559+
.. versionadded:: 3.10
560+
534561
* ``-X no_debug_ranges`` disables the inclusion of the tables mapping extra
535562
location information (end line, start column offset and end column offset)
536563
to every instruction in code objects. This is useful when smaller code
537564
objects and pyc files are desired as well as suppressing the extra visual
538565
location indicators when the interpreter displays tracebacks. See also
539566
:envvar:`PYTHONNODEBUGRANGES`.
567+
568+
.. versionadded:: 3.11
569+
540570
* ``-X frozen_modules`` determines whether or not frozen modules are
541571
ignored by the import machinery. A value of ``on`` means they get
542572
imported and ``off`` means they are ignored. The default is ``on``
@@ -545,71 +575,52 @@ Miscellaneous options
545575
Note that the :mod:`!importlib_bootstrap` and
546576
:mod:`!importlib_bootstrap_external` frozen modules are always used, even
547577
if this flag is set to ``off``. See also :envvar:`PYTHON_FROZEN_MODULES`.
578+
579+
.. versionadded:: 3.11
580+
548581
* ``-X perf`` enables support for the Linux ``perf`` profiler.
549582
When this option is provided, the ``perf`` profiler will be able to
550583
report Python calls. This option is only available on some platforms and
551584
will do nothing if is not supported on the current system. The default value
552585
is "off". See also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`.
586+
587+
.. versionadded:: 3.12
588+
553589
* :samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`,
554590
:func:`os.process_cpu_count`, and :func:`multiprocessing.cpu_count`.
555591
*n* must be greater than or equal to 1.
556592
This option may be useful for users who need to limit CPU resources of a
557593
container system. See also :envvar:`PYTHON_CPU_COUNT`.
558594
If *n* is ``default``, nothing is overridden.
595+
596+
.. versionadded:: 3.13
597+
559598
* :samp:`-X presite={package.module}` specifies a module that should be
560599
imported before the :mod:`site` module is executed and before the
561600
:mod:`__main__` module exists. Therefore, the imported module isn't
562601
:mod:`__main__`. This can be used to execute code early during Python
563602
initialization. Python needs to be :ref:`built in debug mode <debug-build>`
564603
for this option to exist. See also :envvar:`PYTHON_PRESITE`.
604+
605+
.. versionadded:: 3.13
606+
565607
* :samp:`-X gil={0,1}` forces the GIL to be disabled or enabled,
566608
respectively. Only available in builds configured with
567609
:option:`--disable-gil`. See also :envvar:`PYTHON_GIL`.
568610

611+
.. versionadded:: 3.13
612+
569613
It also allows passing arbitrary values and retrieving them through the
570614
:data:`sys._xoptions` dictionary.
571615

572616
.. versionadded:: 3.2
573617

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-
590618
.. 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.
595620

596621
.. versionchanged:: 3.10
597-
Added the ``-X warn_default_encoding`` option.
598622
Removed the ``-X oldparser`` option.
599623

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-
613624
.. _using-on-controlling-color:
614625

615626
Controlling color

0 commit comments

Comments
 (0)