-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
site.py is no longer read at startup time (as it is a deep-frozen module) #107344
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you elaborate on why |
Mostly
To be clear, my biggest concern is that |
I unfortunately come across this issue. massive outage when some service accounts got a the site.py was edited to set I went through the bug tracker and I haven't seen any mention of a fix or any workaround to address the issue. However it is not equivalent to the previous solution of editing
You can run the interpreter with
|
The original change came from #28398. Perhaps @ericsnowcurrently could help us determine if there is something we can do to conditionally run site.py (not the frozen version) during startup only if it is changed? |
Bug report
Before https://github.com/python/cpython/pull/29118/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767cR873 it was possible to modify
site.py
and control the behaviour of Python at a site level. Indeed, the comments insite.py
reflect this (e.g.set it to False to disable the feature or True to force the feature
) (also in the docs https://docs.python.org/3/library/site.html#site.ENABLE_USER_SITE, esp "None
means it was disabled for security reasons ... or by an administrator.").The change was introduced in order to optimise the startup time. It would be retrograde to stop doing that, but at the same time, having
.py
files in the shipped distribution (stdlib) which are not used is confusing and wasteful. At a minimum we could no longer ship frozen.py
files (since they aren't used), thereby saving disk space and avoiding confusion for people who might edit those files.If the startup time optimisation is a result of avoiding stat-ing files, then it would be great if there was a convenient way to re-compile the
site.py
frozen module (so that we can still customize the site). If it isn't such a concern to stat, the alternative would be to look to see if there is asite.py
file, and if so, use that instead of the frozen one (assuming that thesite.py
is removed from the distribution as suggested above).Above all, the desire is to be able to configure the
site
of a distribution after compilation, without using tricks such assitecustomize
, activations scripts, or.pth
files.Your environment
I have reproduced this on Python 3.11.4 and main (6e850c3), on Linux.
Relates to #89824.
The text was updated successfully, but these errors were encountered: