@@ -552,6 +552,12 @@ Miscellaneous options
552552     This option may be useful for users who need to limit CPU resources of a
553553     container system. See also :envvar: `PYTHON_CPU_COUNT `.
554554     If *n * is ``default ``, nothing is overridden.
555+    * :samp: `-X presite={ package.module }  ` specifies a module that should be
556+      imported before the :mod: `site ` module is executed and before the
557+      :mod: `__main__ ` module exists.  Therefore, the imported module isn't
558+      :mod: `__main__ `. This can be used to execute code early during Python
559+      initialization. Python needs to be :ref: `built in debug mode  <debug-build >`
560+      for this option to exist.  See also :envvar: `PYTHON_PRESITE `.
555561
556562   It also allows passing arbitrary values and retrieving them through the
557563   :data: `sys._xoptions ` dictionary.
@@ -602,6 +608,9 @@ Miscellaneous options
602608   .. versionadded :: 3.13 
603609      The ``-X cpu_count `` option.
604610
611+    .. versionadded :: 3.13 
612+       The ``-X presite `` option.
613+ 
605614
606615Options you shouldn't use
607616~~~~~~~~~~~~~~~~~~~~~~~~~ 
@@ -1091,13 +1100,33 @@ Debug-mode variables
10911100   If set, Python will dump objects and reference counts still alive after
10921101   shutting down the interpreter.
10931102
1094-    Need  Python configured with the :option: `--with-trace-refs ` build option.
1103+    Needs  Python configured with the :option: `--with-trace-refs ` build option.
10951104
1096- .. envvar :: PYTHONDUMPREFSFILE=FILENAME  
1105+ .. envvar :: PYTHONDUMPREFSFILE 
10971106
10981107   If set, Python will dump objects and reference counts still alive
1099-    after shutting down the interpreter into a file called *FILENAME *.
1108+    after shutting down the interpreter into a file under the path given
1109+    as the value to this environment variable.
11001110
1101-    Need  Python configured with the :option: `--with-trace-refs ` build option.
1111+    Needs  Python configured with the :option: `--with-trace-refs ` build option.
11021112
11031113   .. versionadded :: 3.11 
1114+ 
1115+ .. envvar :: PYTHON_PRESITE 
1116+ 
1117+    If this variable is set to a module, that module will be imported
1118+    early in the interpreter lifecycle, before the :mod: `site ` module is
1119+    executed, and before the :mod: `__main__ ` module is created.
1120+    Therefore, the imported module is not treated as :mod: `__main__ `.
1121+ 
1122+    This can be used to execute code early during Python initialization.
1123+ 
1124+    To import a submodule, use ``package.module `` as the value, like in
1125+    an import statement.
1126+ 
1127+    See also the :option: `-X presite <-X> ` command-line option,
1128+    which takes precedence over this variable.
1129+ 
1130+    Needs Python configured with the :option: `--with-pydebug ` build option.
1131+ 
1132+    .. versionadded :: 3.13 
0 commit comments