Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8af41ce

Browse files
author
Thomas Heller
committed
Don't look for modules in the registry any longer.
Mark writes in private email: "Modules listed in the registry was a dumb idea. This whole scheme can die. AFAIK, no one in the world uses it (including win32all since the last build)." (See also SF #643711)
1 parent cef3288 commit 8af41ce

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

Tools/freeze/modulefinder.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,6 @@ def __repr__(self):
5959
s = s + ")"
6060
return s
6161

62-
_warned = 0
63-
64-
def _try_registry(name):
65-
# Emulate the Registered Module support on Windows.
66-
try:
67-
import _winreg
68-
RegQueryValue = _winreg.QueryValue
69-
HKLM = _winreg.HKEY_LOCAL_MACHINE
70-
exception = _winreg.error
71-
except ImportError:
72-
try:
73-
import win32api
74-
RegQueryValue = win32api.RegQueryValue
75-
HKLM = 0x80000002 # HKEY_LOCAL_MACHINE
76-
exception = win32api.error
77-
except ImportError:
78-
global _warned
79-
if not _warned:
80-
_warned = 1
81-
print "Warning: Neither _winreg nor win32api is available - modules"
82-
print "listed in the registry will not be found"
83-
return None
84-
try:
85-
pathname = RegQueryValue(HKLM, \
86-
r"Software\Python\PythonCore\%s\Modules\%s" % (sys.winver, name))
87-
fp = open(pathname, "rb")
88-
except exception:
89-
return None
90-
else:
91-
# XXX - To do - remove the hard code of C_EXTENSION.
92-
stuff = "", "rb", imp.C_EXTENSION
93-
return fp, pathname, stuff
94-
9562
class ModuleFinder:
9663

9764
def __init__(self, path=None, debug=0, excludes = [], replace_paths = []):
@@ -389,11 +356,6 @@ def find_module(self, name, path):
389356
if name in sys.builtin_module_names:
390357
return (None, None, ("", "", imp.C_BUILTIN))
391358

392-
if sys.platform=="win32":
393-
result = _try_registry(name)
394-
if result:
395-
return result
396-
397359
path = self.path
398360
return imp.find_module(name, path)
399361

0 commit comments

Comments
 (0)