Skip to content

Commit 3e51096

Browse files
[3.12] gh-115664: Reorganize versionadded directives for -X options (GH-116304) (GH-117900)
Add the versionadded directives just under the description of the corresponding option. (cherry picked from commit 10f1a26)
1 parent 2dcb267 commit 3e51096

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

Doc/using/cmdline.rst

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -500,94 +500,102 @@ 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"
543573
if this is an installed Python (the normal case). If it's under
544574
development (running from the source tree) then the default is "off".
545575
Note that the "importlib_bootstrap" and "importlib_bootstrap_external"
546576
frozen modules are always used, even if this flag is set to "off".
577+
578+
.. versionadded:: 3.11
579+
547580
* ``-X perf`` enables support for the Linux ``perf`` profiler.
548581
When this option is provided, the ``perf`` profiler will be able to
549582
report Python calls. This option is only available on some platforms and
550583
will do nothing if is not supported on the current system. The default value
551584
is "off". See also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`.
552585

586+
.. versionadded:: 3.12
587+
553588
It also allows passing arbitrary values and retrieving them through the
554589
:data:`sys._xoptions` dictionary.
555590

556591
.. versionadded:: 3.2
557592

558-
.. versionchanged:: 3.3
559-
Added the ``-X faulthandler`` option.
560-
561-
.. versionchanged:: 3.4
562-
Added the ``-X showrefcount`` and ``-X tracemalloc`` options.
563-
564-
.. versionchanged:: 3.6
565-
Added the ``-X showalloccount`` option.
566-
567-
.. versionchanged:: 3.7
568-
Added the ``-X importtime``, ``-X dev`` and ``-X utf8`` options.
569-
570-
.. versionchanged:: 3.8
571-
Added the ``-X pycache_prefix`` option. The ``-X dev`` option now logs
572-
``close()`` exceptions in :class:`io.IOBase` destructor.
573-
574593
.. versionchanged:: 3.9
575-
Using ``-X dev`` option, check *encoding* and *errors* arguments on
576-
string encoding and decoding operations.
577-
578-
The ``-X showalloccount`` option has been removed.
594+
Removed the ``-X showalloccount`` option.
579595

580596
.. versionchanged:: 3.10
581-
Added the ``-X warn_default_encoding`` option.
582597
Removed the ``-X oldparser`` option.
583598

584-
.. versionchanged:: 3.11
585-
Added the ``-X no_debug_ranges``, ``-X frozen_modules`` and
586-
``-X int_max_str_digits`` options.
587-
588-
.. versionchanged:: 3.12
589-
Added the ``-X perf`` option.
590-
591599

592600
Options you shouldn't use
593601
~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)