@@ -241,6 +241,7 @@ PyPreConfig
241
241
locale to decide if it should be coerced.
242
242
243
243
.. c :member :: int coerce_c_locale_warn
244
+
244
245
If non-zero, emit a warning if the C locale is coerced.
245
246
246
247
.. c :member :: int dev_mode
@@ -300,7 +301,7 @@ For :ref:`Python Configuration <init-python-config>`
300
301
(:c:func: `PyPreConfig_InitPythonConfig `), if Python is initialized with
301
302
command line arguments, the command line arguments must also be passed to
302
303
preinitialize Python, since they have an effect on the pre-configuration
303
- like encodings. For example, the :option:`-X` `` utf8` ` command line option
304
+ like encodings. For example, the :option:`-X utf8 <-X> ` command line option
304
305
enables the UTF-8 Mode.
305
306
306
307
``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and
@@ -464,7 +465,7 @@ PyConfig
464
465
465
466
.. c:member:: int dev_mode
466
467
467
- Development mode: see :option:`-X` `` dev` `.
468
+ Development mode: see :option:`-X dev <-X> `.
468
469
469
470
.. c:member:: int dump_refs
470
471
@@ -482,7 +483,7 @@ PyConfig
482
483
483
484
.. c:member:: int faulthandler
484
485
485
- If non-zero, call :func:`faulthandler.enable`.
486
+ If non-zero, call :func:`faulthandler.enable` at startup .
486
487
487
488
.. c:member:: wchar_t* filesystem_encoding
488
489
@@ -504,6 +505,9 @@ PyConfig
504
505
505
506
Python home directory.
506
507
508
+ Initialized from :envvar:`PYTHONHOME` environment variable value by
509
+ default.
510
+
507
511
.. c:member:: int import_time
508
512
509
513
If non-zero, profile import time.
@@ -561,7 +565,7 @@ PyConfig
561
565
562
566
:data:`sys.path`. If :c:member:`~PyConfig.module_search_paths_set` is
563
567
equal to 0, the :c:member:`~PyConfig.module_search_paths` is overridden
564
- by the function computing the :ref:`Path Configuration
568
+ by the function calculating the :ref:`Path Configuration
565
569
<init-path-config>`.
566
570
567
571
.. c:member:: int optimization_level
@@ -586,49 +590,56 @@ PyConfig
586
590
587
591
.. c:member:: int pathconfig_warnings
588
592
589
- If equal to 0, suppress warnings when computing the path configuration
590
- (Unix only, Windows does not log any warning). Otherwise, warnings are
591
- written into ``stderr``.
593
+ If equal to 0, suppress warnings when calculating the :ref:`Path
594
+ Configuration <init-path-config>` (Unix only, Windows does not log any
595
+ warning). Otherwise, warnings are written into ``stderr``.
592
596
593
597
.. c:member:: wchar_t* prefix
594
598
595
599
:data:`sys.prefix`.
596
600
597
601
.. c:member:: wchar_t* program_name
598
602
599
- Program name.
603
+ Program name. Used to initialize :c:member:`~PyConfig.executable`, and in
604
+ early error messages.
600
605
601
606
.. c:member:: wchar_t* pycache_prefix
602
607
603
- ``.pyc`` cache prefix.
608
+ :data:`sys.pycache_prefix`: ``.pyc`` cache prefix.
609
+
610
+ If NULL, :data:`sys.pycache_prefix` is set to ``None``.
604
611
605
612
.. c:member:: int quiet
606
613
607
614
Quiet mode. For example, don't display the copyright and version messages
608
- even in interactive mode.
615
+ in interactive mode.
609
616
610
617
.. c:member:: wchar_t* run_command
611
618
612
- ``python3 -c COMMAND`` argument.
619
+ ``python3 -c COMMAND`` argument. Used by :c:func:`Py_RunMain`.
613
620
614
621
.. c:member:: wchar_t* run_filename
615
622
616
- ``python3 FILENAME`` argument.
623
+ ``python3 FILENAME`` argument. Used by :c:func:`Py_RunMain`.
617
624
618
625
.. c:member:: wchar_t* run_module
619
626
620
- ``python3 -m MODULE`` argument.
627
+ ``python3 -m MODULE`` argument. Used by :c:func:`Py_RunMain`.
621
628
622
629
.. c:member:: int show_alloc_count
623
630
624
631
Show allocation counts at exit?
625
632
633
+ Set to 1 by :option:`-X showalloccount <-X>` command line option.
634
+
626
635
Need a special Python build with ``COUNT_ALLOCS`` macro defined.
627
636
628
637
.. c:member:: int show_ref_count
629
638
630
639
Show total reference count at exit?
631
640
641
+ Set to 1 by :option:`-X showrefcount <-X>` command line option.
642
+
632
643
Need a debug build of Python (``Py_REF_DEBUG `` macro must be defined).
633
644
634
645
.. c:member:: int site_import
@@ -647,7 +658,7 @@ PyConfig
647
658
648
659
.. c:member:: int tracemalloc
649
660
650
- If non-zero, call :func:`tracemalloc.start`.
661
+ If non-zero, call :func:`tracemalloc.start` at startup .
651
662
652
663
.. c:member:: int use_environment
653
664
@@ -669,6 +680,9 @@ PyConfig
669
680
670
681
If non-zero, write ``.pyc`` files.
671
682
683
+ :data:`sys.dont_write_bytecode` is initialized to the inverted value of
684
+ :c:member:`~PyConfig.write_bytecode`.
685
+
672
686
.. c:member:: PyWideStringList xoptions
673
687
674
688
:data:`sys._xoptions`.
@@ -694,8 +708,8 @@ Function to initialize Python:
694
708
The caller is responsible to handle exceptions (error or exit) using
695
709
:c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`.
696
710
697
- ``PyImport_FrozenModules``, ``PyImport_AppendInittab()`` or
698
- ``PyImport_ExtendInittab()`` is used: they must be set or called after Python
711
+ If ``PyImport_FrozenModules``, ``PyImport_AppendInittab()`` or
712
+ ``PyImport_ExtendInittab()`` are used, they must be set or called after Python
699
713
preinitialization and before the Python initialization.
700
714
701
715
Example setting the program name::
@@ -760,7 +774,7 @@ configuration, and then override some parameters::
760
774
761
775
/* Append our custom search path to sys.path */
762
776
status = PyWideStringList_Append(&config.module_search_paths,
763
- L"/path/to/more/modules");
777
+ L"/path/to/more/modules");
764
778
if (PyStatus_Exception(status)) {
765
779
goto done;
766
780
}
@@ -791,9 +805,9 @@ isolate Python from the system. For example, to embed Python into an
791
805
application.
792
806
793
807
This configuration ignores global configuration variables, environments
794
- variables and command line arguments (:c:member: `PyConfig.argv ` is not parsed).
795
- The C standard streams (ex: ``stdout ``) and the LC_CTYPE locale are left
796
- unchanged by default .
808
+ variables, command line arguments (:c:member: `PyConfig.argv ` is not parsed)
809
+ and user site directory. The C standard streams (ex: ``stdout ``) and the
810
+ LC_CTYPE locale are left unchanged. Signal handlers are not installed .
797
811
798
812
Configuration files are still used with this configuration. Set the
799
813
:ref:`Path Configuration <init-path-config>` ("output fields") to ignore these
@@ -970,7 +984,7 @@ initialization, the core feature of the :pep:`432`:
970
984
* Builtin exceptions;
971
985
* Builtin and frozen modules;
972
986
* The :mod: `sys ` module is only partially initialized
973
- (ex: :data: `sys.path ` doesn't exist yet);
987
+ (ex: :data: `sys.path ` doesn't exist yet).
974
988
975
989
* "Main" initialization phase, Python is fully initialized:
976
990
@@ -996,9 +1010,9 @@ No module is imported during the "Core" phase and the ``importlib`` module is
996
1010
not configured: the :ref:`Path Configuration <init-path-config>` is only
997
1011
applied during the "Main" phase. It may allow to customize Python in Python to
998
1012
override or tune the :ref:`Path Configuration <init-path-config>`, maybe
999
- install a custom sys.meta_path importer or an import hook, etc.
1013
+ install a custom :data:` sys.meta_path` importer or an import hook, etc.
1000
1014
1001
- It may become possible to compute the :ref:`Path Configuration
1015
+ It may become possible to calculatin the :ref:`Path Configuration
1002
1016
<init-path-config>` in Python, after the Core phase and before the Main phase,
1003
1017
which is one of the :pep:`432` motivation.
1004
1018
0 commit comments