diff --git a/Doc/library/windows.rst b/Doc/library/windows.rst index b09dd8b3f2e..b60d4e4ccf5 100644 --- a/Doc/library/windows.rst +++ b/Doc/library/windows.rst @@ -11,5 +11,5 @@ This chapter describes modules that are only available on MS Windows platforms. msilib.rst msvcrt.rst - _winreg.rst + winreg.rst winsound.rst diff --git a/Doc/library/_winreg.rst b/Doc/library/winreg.rst similarity index 99% rename from Doc/library/_winreg.rst rename to Doc/library/winreg.rst index ba2994df87a..f349fdf1814 100644 --- a/Doc/library/_winreg.rst +++ b/Doc/library/winreg.rst @@ -1,8 +1,7 @@ - -:mod:`_winreg` -- Windows registry access +:mod:`winreg` -- Windows registry access ========================================= -.. module:: _winreg +.. module:: winreg :platform: Windows :synopsis: Routines and objects for manipulating the Windows registry. .. sectionauthor:: Mark Hammond diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index c8d52c42375..fdb74aeabfa 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -24,17 +24,17 @@ from distutils.ccompiler import (CCompiler, gen_preprocess_options, from distutils import log from distutils.util import get_platform -import _winreg +import winreg -RegOpenKeyEx = _winreg.OpenKeyEx -RegEnumKey = _winreg.EnumKey -RegEnumValue = _winreg.EnumValue -RegError = _winreg.error +RegOpenKeyEx = winreg.OpenKeyEx +RegEnumKey = winreg.EnumKey +RegEnumValue = winreg.EnumValue +RegError = winreg.error -HKEYS = (_winreg.HKEY_USERS, - _winreg.HKEY_CURRENT_USER, - _winreg.HKEY_LOCAL_MACHINE, - _winreg.HKEY_CLASSES_ROOT) +HKEYS = (winreg.HKEY_USERS, + winreg.HKEY_CURRENT_USER, + winreg.HKEY_LOCAL_MACHINE, + winreg.HKEY_CLASSES_ROOT) VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f" WINSDK_BASE = r"Software\Microsoft\Microsoft SDKs\Windows" diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 71146dcfe39..1cd0f91d5f9 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -20,15 +20,15 @@ from distutils import log _can_read_reg = False try: - import _winreg + import winreg _can_read_reg = True - hkey_mod = _winreg + hkey_mod = winreg - RegOpenKeyEx = _winreg.OpenKeyEx - RegEnumKey = _winreg.EnumKey - RegEnumValue = _winreg.EnumValue - RegError = _winreg.error + RegOpenKeyEx = winreg.OpenKeyEx + RegEnumKey = winreg.EnumKey + RegEnumValue = winreg.EnumValue + RegError = winreg.error except ImportError: try: @@ -44,7 +44,7 @@ except ImportError: except ImportError: log.info("Warning: Can't read registry to find the " "necessary compiler setting\n" - "Make sure that Python modules _winreg, " + "Make sure that Python modules winreg, " "win32api or win32con are installed.") pass diff --git a/Lib/platform.py b/Lib/platform.py index d5cf62305bb..415d83f8dde 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -529,9 +529,9 @@ def _win32_getvalue(key,name,default=''): # Use win32api if available from win32api import RegQueryValueEx except ImportError: - # On Python 2.0 and later, emulate using _winreg - import _winreg - RegQueryValueEx = _winreg.QueryValueEx + # On Python 2.0 and later, emulate using winreg + import winreg + RegQueryValueEx = winreg.QueryValueEx try: return RegQueryValueEx(key,name) except: @@ -579,14 +579,14 @@ def win32_ver(release='',version='',csd='',ptype=''): # No emulation possible, so return the defaults... return release,version,csd,ptype else: - # Emulation using _winreg (added in Python 2.0) and + # Emulation using winreg (added in Python 2.0) and # sys.getwindowsversion() (added in Python 2.3) - import _winreg + import winreg GetVersionEx = sys.getwindowsversion - RegQueryValueEx = _winreg.QueryValueEx - RegOpenKeyEx = _winreg.OpenKeyEx - RegCloseKey = _winreg.CloseKey - HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE + RegQueryValueEx = winreg.QueryValueEx + RegOpenKeyEx = winreg.OpenKeyEx + RegCloseKey = winreg.CloseKey + HKEY_LOCAL_MACHINE = winreg.HKEY_LOCAL_MACHINE VER_PLATFORM_WIN32_WINDOWS = 1 VER_PLATFORM_WIN32_NT = 2 VER_NT_WORKSTATION = 1 diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index e852c69684c..3dbabc591f4 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -2,7 +2,7 @@ # Test the windows specific win32reg module. # Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey -from _winreg import * +from winreg import * import os, sys import unittest diff --git a/Lib/urllib.py b/Lib/urllib.py index 5cdfb46c475..a5171ef4782 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -1489,19 +1489,19 @@ elif os.name == 'nt': """ proxies = {} try: - import _winreg + import winreg except ImportError: # Std module, so should be around - but you never know! return proxies try: - internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, + internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Internet Settings') - proxyEnable = _winreg.QueryValueEx(internetSettings, - 'ProxyEnable')[0] + proxyEnable = winreg.QueryValueEx(internetSettings, + 'ProxyEnable')[0] if proxyEnable: # Returned as Unicode but problems if not converted to ASCII - proxyServer = str(_winreg.QueryValueEx(internetSettings, - 'ProxyServer')[0]) + proxyServer = str(winreg.QueryValueEx(internetSettings, + 'ProxyServer')[0]) if '=' in proxyServer: # Per-protocol settings for p in proxyServer.split(';'): @@ -1537,18 +1537,18 @@ elif os.name == 'nt': def proxy_bypass_registry(host): try: - import _winreg + import winreg import re except ImportError: # Std modules, so should be around - but you never know! return 0 try: - internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, + internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Internet Settings') - proxyEnable = _winreg.QueryValueEx(internetSettings, - 'ProxyEnable')[0] - proxyOverride = str(_winreg.QueryValueEx(internetSettings, - 'ProxyOverride')[0]) + proxyEnable = winreg.QueryValueEx(internetSettings, + 'ProxyEnable')[0] + proxyOverride = str(winreg.QueryValueEx(internetSettings, + 'ProxyOverride')[0]) # ^^^^ Returned as Unicode but problems if not converted to ASCII except WindowsError: return 0 diff --git a/Misc/NEWS b/Misc/NEWS index 161485fda99..f385560202c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -39,11 +39,13 @@ Core and Builtins Extension Modules ----------------- +- Renamed ``_winreg`` module to ``winreg``. + - Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the platform. - Support for Windows 9x has been removed from the winsound module. -- Fixed #2870: cmathmodule.c compile error +- Fixed #2870: cmathmodule.c compile error. Library ------- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 33bcbd5e7b7..7020d8eb8b7 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -476,7 +476,7 @@ static PyObject * win32_error(char* function, char* filename) { /* XXX We should pass the function name along in the future. - (_winreg.c also wants to pass the function name.) + (winreg.c also wants to pass the function name.) This would however require an additional param to the Windows error object, which is non-trivial. */ diff --git a/PC/VC6/pythoncore.dsp b/PC/VC6/pythoncore.dsp index 9a369f2c58e..84a5bb5586f 100644 --- a/PC/VC6/pythoncore.dsp +++ b/PC/VC6/pythoncore.dsp @@ -177,7 +177,7 @@ SOURCE=..\..\Modules\_weakref.c # End Source File # Begin Source File -SOURCE=..\_winreg.c +SOURCE=..\winreg.c # End Source File # Begin Source File diff --git a/PC/VS7.1/python.iss b/PC/VS7.1/python.iss index 70c9bf3abd9..2f6c8b72712 100644 --- a/PC/VS7.1/python.iss +++ b/PC/VS7.1/python.iss @@ -155,8 +155,8 @@ Source: libs\select.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Compone Source: DLLs\unicodedata.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main Source: libs\unicodedata.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main -Source: DLLs\_winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main +Source: DLLs\winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main +Source: libs\winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main Source: DLLs\winsound.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main Source: libs\winsound.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main diff --git a/PC/VS7.1/python20.wse b/PC/VS7.1/python20.wse index 6c1c387c3c5..8611b8e574b 100644 --- a/PC/VS7.1/python20.wse +++ b/PC/VS7.1/python20.wse @@ -1713,8 +1713,8 @@ item: Remark Text=Extension module DLLs (.pyd); keep in synch with libs directory next end item: Install File - Source=.\_winreg.pyd - Destination=%MAINDIR%\DLLs\_winreg.pyd + Source=.\winreg.pyd + Destination=%MAINDIR%\DLLs\winreg.pyd Description=Extension modules Flags=0000000000000010 end @@ -1809,8 +1809,8 @@ item: Remark Text=Link libraries (.lib); keep in synch with DLLs above, except that the Python lib lives here. end item: Install File - Source=.\_winreg.lib - Destination=%MAINDIR%\libs\_winreg.lib + Source=.\winreg.lib + Destination=%MAINDIR%\libs\winreg.lib Description=Link library files Flags=0000000000000010 end diff --git a/PC/VS7.1/pythoncore.vcproj b/PC/VS7.1/pythoncore.vcproj index f06d626339f..38982f4ddc4 100644 --- a/PC/VS7.1/pythoncore.vcproj +++ b/PC/VS7.1/pythoncore.vcproj @@ -401,7 +401,7 @@ RelativePath="..\..\Modules\_weakref.c"> + RelativePath="..\..\Pc\winreg.c"> diff --git a/PC/VS8.0/pythoncore.vcproj b/PC/VS8.0/pythoncore.vcproj index 8e59dae84e3..75414ce5a24 100644 --- a/PC/VS8.0/pythoncore.vcproj +++ b/PC/VS8.0/pythoncore.vcproj @@ -1559,7 +1559,7 @@ >