Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-110722: Add PYTHON_PRESITE to import a module before site.py is run#110769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
10 commits Select commitHold shift + click to select a range
3daa65a gh-110722: Add PYTHON_PRESITE=package.module to import a module befor…
ambv1ef282b Add Blurb and fix a refleak before anybody notices
ambv8a201b4 Fix versionadded
ambvf192e38 Merge branch 'main' into gh-110722-presite
ambvb89548d Add test, refine docs, add whatsnew, separate run_presite in pylifecy…
ambvebcc373 PEP 7
ambvbebb594 Only define the static function --with-pydebug
ambv08679d8 Fix visual indentation
ambv3d3f5d3 Mention PYTHON_PRESITE needs a pydebug build
ambv2e1d180 Address Victor's nits
ambvFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Add Blurb and fix a refleak before anybody notices
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit1ef282b75e78dce1cc035a24746a49c5c2eaae04
There are no files selected for viewing
16 changes: 16 additions & 0 deletionsDoc/using/cmdline.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -552,6 +552,10 @@ Miscellaneous options | ||
| This option may be useful for users who need to limit CPU resources of a | ||
| container system. See also :envvar:`PYTHON_CPU_COUNT`. | ||
| If *n* is ``default``, nothing is overridden. | ||
| * :samp:`-X presite={package.module}` specifies a module that should be | ||
| imported before ``site.py`` is executed. Python needs to be | ||
| :ref:`built in debug mode <debug-build>` for this option to exist. | ||
| See also :envvar:`PYTHON_PRESITE <PYTHON_PRESITE=package.module>`. | ||
| It also allows passing arbitrary values and retrieving them through the | ||
| :data:`sys._xoptions` dictionary. | ||
| @@ -602,6 +606,8 @@ Miscellaneous options | ||
| .. versionadded:: 3.13 | ||
| The ``-X cpu_count`` option. | ||
| The ``-X presite`` option. | ||
| Options you shouldn't use | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| @@ -1100,3 +1106,13 @@ Debug-mode variables | ||
| Need Python configured with the :option:`--with-trace-refs` build option. | ||
| .. versionadded:: 3.11 | ||
| .. envvar:: PYTHON_PRESITE=package.module | ||
ambv marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| If this variable is set to a module, that module will be imported | ||
| early in the interpreter lifecycle, before ``site.py`` is executed. | ||
| See also the :option:`-X presite <-X>` command-line option, | ||
| which takes precedence over this variable. | ||
| .. versionadded:: 3.13 | ||
3 changes: 3 additions & 0 deletionsMisc/NEWS.d/next/Core and Builtins/2023-10-12-17-15-23.gh-issue-110722.sjMwQe.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Add :envvar:`PYTHON_PRESITE=package.module` to import a module early in the | ||
| interpreter lifecycle before ``site.py`` is executed. Python needs to be | ||
| :ref:`built in debug mode <debug-build>` for this option to exist. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.