classification
Title: Windows registry path not ignored with -E option
Type: behavior Stage: commit review
Components: Interpreter Core Versions: Python 3.9
process
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, benjamin.peterson, eric.araujo, eric.snow, flashk, jpe, ncoghlan, pitrou, steve.dower
Priority: normal Keywords: needs review, patch

Created on 2010-06-05 02:39 by flashk, last changed 2020-03-30 16:06 by steve.dower.

Files
File name Uploaded Description Edit
IgnoreWindowsRegistry_27.patch flashk, 2010-06-05 02:39 Patch for 2.7 review
IgnoreWindowsRegistry_32.patch flashk, 2010-06-05 02:39 Patch for 3.2 review
Pull Requests
URL Status Linked Edit
PR 18169 merged ZackerySpytz, 2020-01-24 16:25
Messages (8)
msg107121 - (view) Author: (flashk) Date: 2010-06-05 02:39
Hi,

I noticed that Python still uses the Windows registry to initialize sys.path, when the -E option is used.

From my understanding, this option is mostly used by programs that are running an embedded version of python, and don't want it to be affected by global installations. Ignoring the registry, along with environment variables, seems to be the correct behavior in this case.

I asked about this on the python-dev list (http://mail.python.org/pipermail/python-dev/2010-June/100492.html) and was told to submit a patch for this if I wanted it fixed before the 2.7 release.

I've included a patch for 2.7 and 3.2
msg107244 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2010-06-06 22:23
Looks good to me. Adding the release manager to the nosy list.
msg108468 - (view) Author: (flashk) Date: 2010-06-23 18:19
Any chance of getting this into 2.7 final? This fix is important for embedding Python in Windows applications.
msg216183 - (view) Author: John Ehresman (jpe) * Date: 2014-04-14 19:18
Is still an issue with importlib?  At this point, I don't think this change can be made on 2.7 or 3.2.
msg216189 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-14 19:53
I don't think importlib changed anything in that regard (since one of the goals was too keep compatibility with all the old behaviours).
Indeed the patch probably needs to be retargetted for 3.5.
msg365212 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2020-03-28 14:12
Steve, I've updated the pull request with the requested change.  Please take a look.
msg365328 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-03-30 16:04
New changeset 676b105111e2399ed400cd13ab113f9aa891760d by Zackery Spytz in branch 'master':
bpo-8901: Windows registry path is now ignored with the -E option (GH-18169)
https://github.com/python/cpython/commit/676b105111e2399ed400cd13ab113f9aa891760d
msg365329 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-03-30 16:06
I'm 99% satisfied that this change is the right approach (rather than adding a new option), but we'll have to wait to hear from beta feedback I think.

My main concern is users who pass -E on the command line to avoid environment variables, but are relying on a Python install and not an embedded version. But for a regular install it should still find all the (site) libraries, so I think it'll be fine in basically every case.
History
Date User Action Args
2020-03-30 16:06:33steve.dowersetresolution: fixed
messages: + msg365329
stage: patch review -> commit review
2020-03-30 16:04:51steve.dowersetmessages: + msg365328
2020-03-28 14:12:28ZackerySpytzsetnosy: + ZackerySpytz

messages: + msg365212
versions: + Python 3.9, - Python 3.5
2020-02-05 00:00:03steve.dowersetnosy: + steve.dower
2020-01-24 23:28:07brett.cannonsetnosy: - brett.cannon
2020-01-24 16:25:07ZackerySpytzsetpull_requests: + pull_request17555
2014-04-14 19:53:32pitrousetversions: + Python 3.5, - Python 2.7, Python 3.2
nosy: + eric.snow, brett.cannon, ncoghlan, pitrou

messages: + msg216189

stage: patch review
2014-04-14 19:18:47jpesetnosy: + jpe
messages: + msg216183
2010-06-23 18:19:35flashksetmessages: + msg108468
2010-06-06 22:23:42eric.araujosetkeywords: + needs review
nosy: + eric.araujo, benjamin.peterson
messages: + msg107244

2010-06-05 02:39:45flashksetfiles: + IgnoreWindowsRegistry_32.patch
2010-06-05 02:39:23flashkcreate