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

Skip to content

Commit 38feaf0

Browse files
committed
#2879: rename _winreg to winreg.
1 parent 2cb57a4 commit 38feaf0

20 files changed

Lines changed: 72 additions & 71 deletions

Doc/library/windows.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ This chapter describes modules that are only available on MS Windows platforms.
1111

1212
msilib.rst
1313
msvcrt.rst
14-
_winreg.rst
14+
winreg.rst
1515
winsound.rst
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
2-
:mod:`_winreg` -- Windows registry access
1+
:mod:`winreg` -- Windows registry access
32
=========================================
43

5-
.. module:: _winreg
4+
.. module:: winreg
65
:platform: Windows
76
:synopsis: Routines and objects for manipulating the Windows registry.
87
.. sectionauthor:: Mark Hammond <[email protected]>

Lib/distutils/msvc9compiler.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
from distutils import log
2525
from distutils.util import get_platform
2626

27-
import _winreg
27+
import winreg
2828

29-
RegOpenKeyEx = _winreg.OpenKeyEx
30-
RegEnumKey = _winreg.EnumKey
31-
RegEnumValue = _winreg.EnumValue
32-
RegError = _winreg.error
29+
RegOpenKeyEx = winreg.OpenKeyEx
30+
RegEnumKey = winreg.EnumKey
31+
RegEnumValue = winreg.EnumValue
32+
RegError = winreg.error
3333

34-
HKEYS = (_winreg.HKEY_USERS,
35-
_winreg.HKEY_CURRENT_USER,
36-
_winreg.HKEY_LOCAL_MACHINE,
37-
_winreg.HKEY_CLASSES_ROOT)
34+
HKEYS = (winreg.HKEY_USERS,
35+
winreg.HKEY_CURRENT_USER,
36+
winreg.HKEY_LOCAL_MACHINE,
37+
winreg.HKEY_CLASSES_ROOT)
3838

3939
VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f"
4040
WINSDK_BASE = r"Software\Microsoft\Microsoft SDKs\Windows"

Lib/distutils/msvccompiler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
_can_read_reg = False
2222
try:
23-
import _winreg
23+
import winreg
2424

2525
_can_read_reg = True
26-
hkey_mod = _winreg
26+
hkey_mod = winreg
2727

28-
RegOpenKeyEx = _winreg.OpenKeyEx
29-
RegEnumKey = _winreg.EnumKey
30-
RegEnumValue = _winreg.EnumValue
31-
RegError = _winreg.error
28+
RegOpenKeyEx = winreg.OpenKeyEx
29+
RegEnumKey = winreg.EnumKey
30+
RegEnumValue = winreg.EnumValue
31+
RegError = winreg.error
3232

3333
except ImportError:
3434
try:
@@ -44,7 +44,7 @@
4444
except ImportError:
4545
log.info("Warning: Can't read registry to find the "
4646
"necessary compiler setting\n"
47-
"Make sure that Python modules _winreg, "
47+
"Make sure that Python modules winreg, "
4848
"win32api or win32con are installed.")
4949
pass
5050

Lib/platform.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ def _win32_getvalue(key,name,default=''):
529529
# Use win32api if available
530530
from win32api import RegQueryValueEx
531531
except ImportError:
532-
# On Python 2.0 and later, emulate using _winreg
533-
import _winreg
534-
RegQueryValueEx = _winreg.QueryValueEx
532+
# On Python 2.0 and later, emulate using winreg
533+
import winreg
534+
RegQueryValueEx = winreg.QueryValueEx
535535
try:
536536
return RegQueryValueEx(key,name)
537537
except:
@@ -579,14 +579,14 @@ def win32_ver(release='',version='',csd='',ptype=''):
579579
# No emulation possible, so return the defaults...
580580
return release,version,csd,ptype
581581
else:
582-
# Emulation using _winreg (added in Python 2.0) and
582+
# Emulation using winreg (added in Python 2.0) and
583583
# sys.getwindowsversion() (added in Python 2.3)
584-
import _winreg
584+
import winreg
585585
GetVersionEx = sys.getwindowsversion
586-
RegQueryValueEx = _winreg.QueryValueEx
587-
RegOpenKeyEx = _winreg.OpenKeyEx
588-
RegCloseKey = _winreg.CloseKey
589-
HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE
586+
RegQueryValueEx = winreg.QueryValueEx
587+
RegOpenKeyEx = winreg.OpenKeyEx
588+
RegCloseKey = winreg.CloseKey
589+
HKEY_LOCAL_MACHINE = winreg.HKEY_LOCAL_MACHINE
590590
VER_PLATFORM_WIN32_WINDOWS = 1
591591
VER_PLATFORM_WIN32_NT = 2
592592
VER_NT_WORKSTATION = 1

Lib/test/test_winreg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Test the windows specific win32reg module.
33
# Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
44

5-
from _winreg import *
5+
from winreg import *
66
import os, sys
77
import unittest
88

Lib/urllib.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,19 +1489,19 @@ def getproxies_registry():
14891489
"""
14901490
proxies = {}
14911491
try:
1492-
import _winreg
1492+
import winreg
14931493
except ImportError:
14941494
# Std module, so should be around - but you never know!
14951495
return proxies
14961496
try:
1497-
internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
1497+
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
14981498
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
1499-
proxyEnable = _winreg.QueryValueEx(internetSettings,
1500-
'ProxyEnable')[0]
1499+
proxyEnable = winreg.QueryValueEx(internetSettings,
1500+
'ProxyEnable')[0]
15011501
if proxyEnable:
15021502
# Returned as Unicode but problems if not converted to ASCII
1503-
proxyServer = str(_winreg.QueryValueEx(internetSettings,
1504-
'ProxyServer')[0])
1503+
proxyServer = str(winreg.QueryValueEx(internetSettings,
1504+
'ProxyServer')[0])
15051505
if '=' in proxyServer:
15061506
# Per-protocol settings
15071507
for p in proxyServer.split(';'):
@@ -1537,18 +1537,18 @@ def getproxies():
15371537

15381538
def proxy_bypass_registry(host):
15391539
try:
1540-
import _winreg
1540+
import winreg
15411541
import re
15421542
except ImportError:
15431543
# Std modules, so should be around - but you never know!
15441544
return 0
15451545
try:
1546-
internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
1546+
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
15471547
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
1548-
proxyEnable = _winreg.QueryValueEx(internetSettings,
1549-
'ProxyEnable')[0]
1550-
proxyOverride = str(_winreg.QueryValueEx(internetSettings,
1551-
'ProxyOverride')[0])
1548+
proxyEnable = winreg.QueryValueEx(internetSettings,
1549+
'ProxyEnable')[0]
1550+
proxyOverride = str(winreg.QueryValueEx(internetSettings,
1551+
'ProxyOverride')[0])
15521552
# ^^^^ Returned as Unicode but problems if not converted to ASCII
15531553
except WindowsError:
15541554
return 0

Misc/NEWS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ Core and Builtins
3939
Extension Modules
4040
-----------------
4141

42+
- Renamed ``_winreg`` module to ``winreg``.
43+
4244
- Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the platform.
4345

4446
- Support for Windows 9x has been removed from the winsound module.
4547

46-
- Fixed #2870: cmathmodule.c compile error
48+
- Fixed #2870: cmathmodule.c compile error.
4749

4850
Library
4951
-------

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static PyObject *
476476
win32_error(char* function, char* filename)
477477
{
478478
/* XXX We should pass the function name along in the future.
479-
(_winreg.c also wants to pass the function name.)
479+
(winreg.c also wants to pass the function name.)
480480
This would however require an additional param to the
481481
Windows error object, which is non-trivial.
482482
*/

PC/VC6/pythoncore.dsp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)