Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7ce98ff7
Commit
7ce98ff7
authored
Dec 19, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
parent
bc40ae87
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
79 additions
and
87 deletions
+79
-87
Doc/library/shutil.rst
Doc/library/shutil.rst
+3
-4
Lib/ctypes/__init__.py
Lib/ctypes/__init__.py
+3
-3
Lib/ctypes/test/test_checkretval.py
Lib/ctypes/test/test_checkretval.py
+1
-1
Lib/ctypes/test/test_win32.py
Lib/ctypes/test/test_win32.py
+1
-1
Lib/idlelib/EditorWindow.py
Lib/idlelib/EditorWindow.py
+2
-2
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+2
-2
Lib/multiprocessing/connection.py
Lib/multiprocessing/connection.py
+1
-1
Lib/ntpath.py
Lib/ntpath.py
+2
-2
Lib/platform.py
Lib/platform.py
+1
-1
Lib/shutil.py
Lib/shutil.py
+2
-9
Lib/tarfile.py
Lib/tarfile.py
+2
-2
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+2
-2
Lib/test/test_mmap.py
Lib/test/test_mmap.py
+1
-1
Lib/test/test_os.py
Lib/test/test_os.py
+9
-9
Lib/test/test_winreg.py
Lib/test/test_winreg.py
+8
-8
Lib/test/test_winsound.py
Lib/test/test_winsound.py
+1
-1
Lib/urllib/request.py
Lib/urllib/request.py
+2
-2
Lib/webbrowser.py
Lib/webbrowser.py
+1
-1
Modules/_ctypes/callproc.c
Modules/_ctypes/callproc.c
+18
-18
Modules/_multiprocessing/multiprocessing.c
Modules/_multiprocessing/multiprocessing.c
+2
-2
Modules/posixmodule.c
Modules/posixmodule.c
+1
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+5
-5
PC/VC6/build_ssl.py
PC/VC6/build_ssl.py
+1
-1
PC/VS7.1/build_ssl.py
PC/VS7.1/build_ssl.py
+1
-1
PC/VS8.0/build_ssl.py
PC/VS8.0/build_ssl.py
+1
-1
PC/winreg.c
PC/winreg.c
+2
-2
Python/errors.c
Python/errors.c
+3
-3
Tools/scripts/win_add2path.py
Tools/scripts/win_add2path.py
+1
-1
No files found.
Doc/library/shutil.rst
View file @
7ce98ff7
...
...
@@ -393,11 +393,10 @@ provided by this module. ::
errors.extend(err.args[0])
try:
copystat(src, dst)
except WindowsError:
# can't copy file access times on Windows
pass
except OSError as why:
errors.extend((src, dst, str(why)))
# can't copy file access times on Windows
if why.winerror is None:
errors.extend((src, dst, str(why)))
if errors:
raise Error(errors)
...
...
Lib/ctypes/__init__.py
View file @
7ce98ff7
...
...
@@ -395,7 +395,7 @@ if _os.name in ("nt", "ce"):
_type_
=
"l"
# _check_retval_ is called with the function's result when it
# is used as restype. It checks for the FAILED bit, and
# raises a
Windows
Error if it is set.
# raises a
n OS
Error if it is set.
#
# The _check_retval_ method is implemented in C, so that the
# method definition itself is not included in the traceback
...
...
@@ -407,7 +407,7 @@ if _os.name in ("nt", "ce"):
class
OleDLL
(
CDLL
):
"""This class represents a dll exporting functions using the
Windows stdcall calling convention, and returning HRESULT.
HRESULT error values are automatically raised as
Windows
Error
HRESULT error values are automatically raised as
OS
Error
exceptions.
"""
_func_flags_
=
_FUNCFLAG_STDCALL
...
...
@@ -456,7 +456,7 @@ if _os.name in ("nt", "ce"):
code
=
GetLastError
()
if
descr
is
None
:
descr
=
FormatError
(
code
).
strip
()
return
Windows
Error
(
None
,
descr
,
None
,
code
)
return
OS
Error
(
None
,
descr
,
None
,
code
)
if
sizeof
(
c_uint
)
==
sizeof
(
c_void_p
):
c_size_t
=
c_uint
...
...
Lib/ctypes/test/test_checkretval.py
View file @
7ce98ff7
...
...
@@ -31,7 +31,7 @@ class Test(unittest.TestCase):
pass
else
:
def
test_oledll
(
self
):
self
.
assertRaises
(
Windows
Error
,
self
.
assertRaises
(
OS
Error
,
oledll
.
oleaut32
.
CreateTypeLib2
,
0
,
None
,
None
)
...
...
Lib/ctypes/test/test_win32.py
View file @
7ce98ff7
...
...
@@ -40,7 +40,7 @@ if sys.platform == "win32":
# Call functions with invalid arguments, and make sure
# that access violations are trapped and raise an
# exception.
self
.
assertRaises
(
Windows
Error
,
windll
.
kernel32
.
GetModuleHandleA
,
32
)
self
.
assertRaises
(
OS
Error
,
windll
.
kernel32
.
GetModuleHandleA
,
32
)
def
test_noargs
(
self
):
# This is a special case on win32 x64
...
...
Lib/idlelib/EditorWindow.py
View file @
7ce98ff7
...
...
@@ -536,7 +536,7 @@ class EditorWindow(object):
if
sys
.
platform
[:
3
]
==
'win'
:
try
:
os
.
startfile
(
self
.
help_url
)
except
Windows
Error
as
why
:
except
OS
Error
as
why
:
tkMessageBox
.
showerror
(
title
=
'Document Start Failure'
,
message
=
str
(
why
),
parent
=
self
.
text
)
else
:
...
...
@@ -845,7 +845,7 @@ class EditorWindow(object):
if
sys
.
platform
[:
3
]
==
'win'
:
try
:
os
.
startfile
(
helpfile
)
except
Windows
Error
as
why
:
except
OS
Error
as
why
:
tkMessageBox
.
showerror
(
title
=
'Document Start Failure'
,
message
=
str
(
why
),
parent
=
self
.
text
)
else
:
...
...
Lib/importlib/_bootstrap.py
View file @
7ce98ff7
...
...
@@ -755,7 +755,7 @@ class WindowsRegistryFinder:
def
_open_registry
(
cls
,
key
):
try
:
return
_winreg
.
OpenKey
(
_winreg
.
HKEY_CURRENT_USER
,
key
)
except
Windows
Error
:
except
OS
Error
:
return
_winreg
.
OpenKey
(
_winreg
.
HKEY_LOCAL_MACHINE
,
key
)
@
classmethod
...
...
@@ -769,7 +769,7 @@ class WindowsRegistryFinder:
try
:
with
cls
.
_open_registry
(
key
)
as
hkey
:
filepath
=
_winreg
.
QueryValue
(
hkey
,
""
)
except
Windows
Error
:
except
OS
Error
:
return
None
return
filepath
...
...
Lib/multiprocessing/connection.py
View file @
7ce98ff7
...
...
@@ -676,7 +676,7 @@ if sys.platform == 'win32':
0
,
_winapi
.
NULL
,
_winapi
.
OPEN_EXISTING
,
_winapi
.
FILE_FLAG_OVERLAPPED
,
_winapi
.
NULL
)
except
Windows
Error
as
e
:
except
OS
Error
as
e
:
if
e
.
winerror
not
in
(
_winapi
.
ERROR_SEM_TIMEOUT
,
_winapi
.
ERROR_PIPE_BUSY
)
or
_check_timeout
(
t
):
raise
...
...
Lib/ntpath.py
View file @
7ce98ff7
...
...
@@ -331,7 +331,7 @@ def lexists(path):
"""Test whether a path exists. Returns True for broken symbolic links"""
try
:
st
=
os
.
lstat
(
path
)
except
(
OSError
,
WindowsError
)
:
except
OSError
:
return
False
return
True
...
...
@@ -584,7 +584,7 @@ else: # use native Windows method on Windows
if
path
:
# Empty path must return current working directory.
try
:
path
=
_getfullpathname
(
path
)
except
Windows
Error
:
except
OS
Error
:
pass
# Bad path - return unchanged.
elif
isinstance
(
path
,
bytes
):
path
=
os
.
getcwdb
()
...
...
Lib/platform.py
View file @
7ce98ff7
...
...
@@ -581,7 +581,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
# Discard any type that isn't REG_SZ
if type == REG_SZ and name.find("Server") != -1:
product_type = VER_NT_SERVER
except
Windows
Error:
except
OS
Error:
# Use default of VER_NT_WORKSTATION
pass
...
...
Lib/shutil.py
View file @
7ce98ff7
...
...
@@ -60,11 +60,6 @@ class RegistryError(Exception):
and unpacking registeries fails"""
try
:
WindowsError
except
NameError
:
WindowsError
=
None
def
copyfileobj
(
fsrc
,
fdst
,
length
=
16
*
1024
):
"""copy data from file-like object fsrc to file-like object fdst"""
while
1
:
...
...
@@ -334,10 +329,8 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
try
:
copystat
(
src
,
dst
)
except
OSError
as
why
:
if
WindowsError
is
not
None
and
isinstance
(
why
,
WindowsError
):
# Copying file access times may fail on Windows
pass
else
:
# Copying file access times may fail on Windows
if
why
.
winerror
is
None
:
errors
.
append
((
src
,
dst
,
str
(
why
)))
if
errors
:
raise
Error
(
errors
)
...
...
Lib/tarfile.py
View file @
7ce98ff7
...
...
@@ -56,9 +56,9 @@ except ImportError:
# os.symlink on Windows prior to 6.0 raises NotImplementedError
symlink_exception
=
(
AttributeError
,
NotImplementedError
)
try
:
#
WindowsError (
1314) will be raised if the caller does not hold the
#
OSError (winerror=
1314) will be raised if the caller does not hold the
# SeCreateSymbolicLinkPrivilege privilege
symlink_exception
+=
(
Windows
Error
,)
symlink_exception
+=
(
OS
Error
,)
except
NameError
:
pass
...
...
Lib/test/test_codecs.py
View file @
7ce98ff7
...
...
@@ -2035,8 +2035,8 @@ class CodePageTest(unittest.TestCase):
def
test_invalid_code_page
(
self
):
self
.
assertRaises
(
ValueError
,
codecs
.
code_page_encode
,
-
1
,
'a'
)
self
.
assertRaises
(
ValueError
,
codecs
.
code_page_decode
,
-
1
,
b'a'
)
self
.
assertRaises
(
Windows
Error
,
codecs
.
code_page_encode
,
123
,
'a'
)
self
.
assertRaises
(
Windows
Error
,
codecs
.
code_page_decode
,
123
,
b'a'
)
self
.
assertRaises
(
OS
Error
,
codecs
.
code_page_encode
,
123
,
'a'
)
self
.
assertRaises
(
OS
Error
,
codecs
.
code_page_decode
,
123
,
b'a'
)
def
test_code_page_name
(
self
):
self
.
assertRaisesRegex
(
UnicodeEncodeError
,
'cp932'
,
...
...
Lib/test/test_mmap.py
View file @
7ce98ff7
...
...
@@ -658,7 +658,7 @@ class MmapTests(unittest.TestCase):
m
=
mmap
.
mmap
(
f
.
fileno
(),
0
)
f
.
close
()
try
:
m
.
resize
(
0
)
# will raise
Windows
Error
m
.
resize
(
0
)
# will raise
OS
Error
except
:
pass
try
:
...
...
Lib/test/test_os.py
View file @
7ce98ff7
...
...
@@ -468,9 +468,9 @@ class StatAttributeTests(unittest.TestCase):
# Verify that an open file can be stat'ed
try
:
os
.
stat
(
r"c:\
p
agefile.sys"
)
except
WindowsError
as
e
:
if
e
.
errno
==
2
:
# file does not exist; cannot run test
return
except
FileNotFoundError
:
pass
# file does not exist; cannot run test
except
OSError
as
e
:
self
.
fail
(
"Could not stat pagefile.sys"
)
@
unittest
.
skipUnless
(
hasattr
(
os
,
"pipe"
),
"requires os.pipe()"
)
...
...
@@ -1042,27 +1042,27 @@ class ExecTests(unittest.TestCase):
class
Win32ErrorTests
(
unittest
.
TestCase
):
def
test_rename
(
self
):
self
.
assertRaises
(
Windows
Error
,
os
.
rename
,
support
.
TESTFN
,
support
.
TESTFN
+
".bak"
)
self
.
assertRaises
(
OS
Error
,
os
.
rename
,
support
.
TESTFN
,
support
.
TESTFN
+
".bak"
)
def
test_remove
(
self
):
self
.
assertRaises
(
Windows
Error
,
os
.
remove
,
support
.
TESTFN
)
self
.
assertRaises
(
OS
Error
,
os
.
remove
,
support
.
TESTFN
)
def
test_chdir
(
self
):
self
.
assertRaises
(
Windows
Error
,
os
.
chdir
,
support
.
TESTFN
)
self
.
assertRaises
(
OS
Error
,
os
.
chdir
,
support
.
TESTFN
)
def
test_mkdir
(
self
):
f
=
open
(
support
.
TESTFN
,
"w"
)
try
:
self
.
assertRaises
(
Windows
Error
,
os
.
mkdir
,
support
.
TESTFN
)
self
.
assertRaises
(
OS
Error
,
os
.
mkdir
,
support
.
TESTFN
)
finally
:
f
.
close
()
os
.
unlink
(
support
.
TESTFN
)
def
test_utime
(
self
):
self
.
assertRaises
(
Windows
Error
,
os
.
utime
,
support
.
TESTFN
,
None
)
self
.
assertRaises
(
OS
Error
,
os
.
utime
,
support
.
TESTFN
,
None
)
def
test_chmod
(
self
):
self
.
assertRaises
(
Windows
Error
,
os
.
chmod
,
support
.
TESTFN
,
0
)
self
.
assertRaises
(
OS
Error
,
os
.
chmod
,
support
.
TESTFN
,
0
)
class
TestInvalidFD
(
unittest
.
TestCase
):
singles
=
[
"fchdir"
,
"dup"
,
"fdopen"
,
"fdatasync"
,
"fstat"
,
...
...
Lib/test/test_winreg.py
View file @
7ce98ff7
...
...
@@ -54,13 +54,13 @@ class BaseWinregTests(unittest.TestCase):
def
delete_tree
(
self
,
root
,
subkey
):
try
:
hkey
=
OpenKey
(
root
,
subkey
,
KEY_ALL_ACCESS
)
except
Windows
Error
:
except
OS
Error
:
# subkey does not exist
return
while
True
:
try
:
subsubkey
=
EnumKey
(
hkey
,
0
)
except
Windows
Error
:
except
OS
Error
:
# no more subkeys
break
self
.
delete_tree
(
hkey
,
subsubkey
)
...
...
@@ -176,7 +176,7 @@ class BaseWinregTests(unittest.TestCase):
try
:
key
=
OpenKey
(
root_key
,
test_key_name
)
self
.
fail
(
"Could open the non-existent key"
)
except
Windows
Error
:
# Use this error name this time
except
OS
Error
:
# Use this error name this time
pass
def
_test_all
(
self
,
root_key
,
subkeystr
=
"sub_key"
):
...
...
@@ -227,7 +227,7 @@ class LocalWinregTests(BaseWinregTests):
def
test_inexistant_remote_registry
(
self
):
connect
=
lambda
:
ConnectRegistry
(
"abcdefghijkl"
,
HKEY_CURRENT_USER
)
self
.
assertRaises
(
Windows
Error
,
connect
)
self
.
assertRaises
(
OS
Error
,
connect
)
def
testExpandEnvironmentStrings
(
self
):
r
=
ExpandEnvironmentStrings
(
"%windir%
\
\
test"
)
...
...
@@ -239,8 +239,8 @@ class LocalWinregTests(BaseWinregTests):
try
:
with
ConnectRegistry
(
None
,
HKEY_LOCAL_MACHINE
)
as
h
:
self
.
assertNotEqual
(
h
.
handle
,
0
)
raise
Windows
Error
except
Windows
Error
:
raise
OS
Error
except
OS
Error
:
self
.
assertEqual
(
h
.
handle
,
0
)
def
test_changing_value
(
self
):
...
...
@@ -375,7 +375,7 @@ class Win64WinregTests(BaseWinregTests):
open_fail
=
lambda
:
OpenKey
(
HKEY_CURRENT_USER
,
test_reflect_key_name
,
0
,
KEY_READ
|
KEY_WOW64_64KEY
)
self
.
assertRaises
(
Windows
Error
,
open_fail
)
self
.
assertRaises
(
OS
Error
,
open_fail
)
# Now explicitly open the 64-bit version of the key
with
OpenKey
(
HKEY_CURRENT_USER
,
test_reflect_key_name
,
0
,
...
...
@@ -415,7 +415,7 @@ class Win64WinregTests(BaseWinregTests):
open_fail
=
lambda
:
OpenKeyEx
(
HKEY_CURRENT_USER
,
test_reflect_key_name
,
0
,
KEY_READ
|
KEY_WOW64_64KEY
)
self
.
assertRaises
(
Windows
Error
,
open_fail
)
self
.
assertRaises
(
OS
Error
,
open_fail
)
# Make sure the 32-bit key is actually there
with
OpenKeyEx
(
HKEY_CURRENT_USER
,
test_reflect_key_name
,
0
,
...
...
Lib/test/test_winsound.py
View file @
7ce98ff7
...
...
@@ -22,7 +22,7 @@ def has_sound(sound):
key
=
winreg
.
OpenKeyEx
(
winreg
.
HKEY_CURRENT_USER
,
"AppEvents
\
Schemes
\
Apps
\
.De
f
ault
\
{
0
}
\
.De
f
ault"
.
format
(
sound
))
return
winreg
.
EnumValue
(
key
,
0
)[
1
]
!=
""
except
Windows
Error
:
except
OS
Error
:
return
False
class
BeepTest
(
unittest
.
TestCase
):
...
...
Lib/urllib/request.py
View file @
7ce98ff7
...
...
@@ -2573,7 +2573,7 @@ elif os.name == 'nt':
proxies
[
'https'
]
=
'https://%s'
%
proxyServer
proxies
[
'ftp'
]
=
'ftp://%s'
%
proxyServer
internetSettings
.
Close
()
except
(
Windows
Error
,
ValueError
,
TypeError
):
except
(
OS
Error
,
ValueError
,
TypeError
):
# Either registry key not found etc, or the value in an
# unexpected format.
# proxies already set up to be empty so nothing to do
...
...
@@ -2603,7 +2603,7 @@ elif os.name == 'nt':
proxyOverride
=
str
(
winreg
.
QueryValueEx
(
internetSettings
,
'ProxyOverride'
)[
0
])
# ^^^^ Returned as Unicode but problems if not converted to ASCII
except
Windows
Error
:
except
OS
Error
:
return
0
if
not
proxyEnable
or
not
proxyOverride
:
return
0
...
...
Lib/webbrowser.py
View file @
7ce98ff7
...
...
@@ -534,7 +534,7 @@ if sys.platform[:3] == "win":
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
try
:
os
.
startfile
(
url
)
except
Windows
Error
:
except
OS
Error
:
# [Error 22] No application is associated with the specified
# file for this operation: '<URL>'
return
False
...
...
Modules/_ctypes/callproc.c
View file @
7ce98ff7
...
...
@@ -257,18 +257,18 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
to a virtual address for which it does not
have the appropriate access. */
if
(
pr
->
ExceptionInformation
[
0
]
==
0
)
PyErr_Format
(
PyExc_
Windows
Error
,
PyErr_Format
(
PyExc_
OS
Error
,
"exception: access violation reading %p"
,
pr
->
ExceptionInformation
[
1
]);
else
PyErr_Format
(
PyExc_
Windows
Error
,
PyErr_Format
(
PyExc_
OS
Error
,
"exception: access violation writing %p"
,
pr
->
ExceptionInformation
[
1
]);
break
;
case
EXCEPTION_BREAKPOINT
:
/* A breakpoint was encountered. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: breakpoint encountered"
);
break
;
...
...
@@ -278,14 +278,14 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
alignment. For example, 16-bit values must be
aligned on 2-byte boundaries, 32-bit values on
4-byte boundaries, and so on. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: datatype misalignment"
);
break
;
case
EXCEPTION_SINGLE_STEP
:
/* A trace trap or other single-instruction mechanism
signaled that one instruction has been executed. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: single step"
);
break
;
...
...
@@ -293,7 +293,7 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The thread attempted to access an array element
that is out of bounds, and the underlying hardware
supports bounds checking. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: array bounds exceeded"
);
break
;
...
...
@@ -302,28 +302,28 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
is denormal. A denormal value is one that is too
small to represent as a standard floating-point
value. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: floating-point operand denormal"
);
break
;
case
EXCEPTION_FLT_DIVIDE_BY_ZERO
:
/* The thread attempted to divide a floating-point
value by a floating-point divisor of zero. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: float divide by zero"
);
break
;
case
EXCEPTION_FLT_INEXACT_RESULT
:
/* The result of a floating-point operation cannot be
represented exactly as a decimal fraction. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: float inexact"
);
break
;
case
EXCEPTION_FLT_INVALID_OPERATION
:
/* This exception represents any floating-point
exception not included in this list. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: float invalid operation"
);
break
;
...
...
@@ -331,21 +331,21 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The exponent of a floating-point operation is
greater than the magnitude allowed by the
corresponding type. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: float overflow"
);
break
;
case
EXCEPTION_FLT_STACK_CHECK
:
/* The stack overflowed or underflowed as the result
of a floating-point operation. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: stack over/underflow"
);
break
;
case
EXCEPTION_STACK_OVERFLOW
:
/* The stack overflowed or underflowed as the result
of a floating-point operation. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: stack overflow"
);
break
;
...
...
@@ -353,21 +353,21 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The exponent of a floating-point operation is less
than the magnitude allowed by the corresponding
type. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: float underflow"
);
break
;
case
EXCEPTION_INT_DIVIDE_BY_ZERO
:
/* The thread attempted to divide an integer value by
an integer divisor of zero. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: integer divide by zero"
);
break
;
case
EXCEPTION_INT_OVERFLOW
:
/* The result of an integer operation caused a carry
out of the most significant bit of the result. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: integer overflow"
);
break
;
...
...
@@ -375,14 +375,14 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The thread attempted to execute an instruction
whose operation is not allowed in the current
machine mode. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: priviledged instruction"
);
break
;
case
EXCEPTION_NONCONTINUABLE_EXCEPTION
:
/* The thread attempted to continue execution after a
noncontinuable exception occurred. */
PyErr_SetString
(
PyExc_
Windows
Error
,
PyErr_SetString
(
PyExc_
OS
Error
,
"exception: nocontinuable"
);
break
;
...
...
Modules/_multiprocessing/multiprocessing.c
View file @
7ce98ff7
...
...
@@ -21,12 +21,12 @@ _PyMp_SetError(PyObject *Type, int num)
#ifdef MS_WINDOWS
case
MP_STANDARD_ERROR
:
if
(
Type
==
NULL
)
Type
=
PyExc_
Windows
Error
;
Type
=
PyExc_
OS
Error
;
PyErr_SetExcFromWindowsErr
(
Type
,
0
);
break
;
case
MP_SOCKET_ERROR
:
if
(
Type
==
NULL
)
Type
=
PyExc_
Windows
Error
;
Type
=
PyExc_
OS
Error
;
PyErr_SetExcFromWindowsErr
(
Type
,
WSAGetLastError
());
break
;
#else
/* !MS_WINDOWS */
...
...
Modules/posixmodule.c
View file @
7ce98ff7
...
...
@@ -1041,7 +1041,7 @@ win32_error_object(char* function, PyObject* filename)
errno
=
GetLastError
();
if
(
filename
)
return
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_
Windows
Error
,
PyExc_
OS
Error
,
errno
,
filename
);
else
...
...
Objects/unicodeobject.c
View file @
7ce98ff7
...
...
@@ -6589,8 +6589,8 @@ decode_code_page_flags(UINT code_page)
* Decode a byte string from a Windows code page into unicode object in strict
* mode.
*
* Returns consumed size if succeed, returns -2 on decode error, or raise a
*
Windows
Error and returns -1 on other error.
* Returns consumed size if succeed, returns -2 on decode error, or raise a
n
*
OS
Error and returns -1 on other error.
*/
static
int
decode_code_page_strict
(
UINT
code_page
,
...
...
@@ -6641,7 +6641,7 @@ error:
* Decode a byte string from a code page into unicode object with an error
* handler.
*
* Returns consumed size if succeed, or raise a
Windows
Error or
* Returns consumed size if succeed, or raise a
n OS
Error or
* UnicodeDecodeError exception and returns -1 on error.
*/
static
int
...
...
@@ -6897,7 +6897,7 @@ encode_code_page_flags(UINT code_page, const char *errors)
* mode.
*
* Returns consumed characters if succeed, returns -2 on encode error, or raise
* a
Windows
Error and returns -1 on other error.
* a
n OS
Error and returns -1 on other error.
*/
static
int
encode_code_page_strict
(
UINT
code_page
,
PyObject
**
outbytes
,
...
...
@@ -6993,7 +6993,7 @@ error:
* Encode a Unicode string to a Windows code page into a byte string using a
* error handler.
*
* Returns consumed characters if succeed, or raise a
Windows
Error and returns
* Returns consumed characters if succeed, or raise a
n OS
Error and returns
* -1 on other error.
*/
static
int
...
...
PC/VC6/build_ssl.py
View file @
7ce98ff7
...
...
@@ -66,7 +66,7 @@ def find_best_ssl_dir(sources):
# note: do not abspath s; the build will fail if any
# higher up directory name has spaces in it.
fnames
=
os
.
listdir
(
s
)
except
os
.
e
rror
:
except
OSE
rror
:
fnames
=
[]
for
fname
in
fnames
:
fqn
=
os
.
path
.
join
(
s
,
fname
)
...
...
PC/VS7.1/build_ssl.py
View file @
7ce98ff7
...
...
@@ -62,7 +62,7 @@ def find_best_ssl_dir(sources):
# note: do not abspath s; the build will fail if any
# higher up directory name has spaces in it.
fnames
=
os
.
listdir
(
s
)
except
os
.
e
rror
:
except
OSE
rror
:
fnames
=
[]
for
fname
in
fnames
:
fqn
=
os
.
path
.
join
(
s
,
fname
)
...
...
PC/VS8.0/build_ssl.py
View file @
7ce98ff7
...
...
@@ -71,7 +71,7 @@ def find_best_ssl_dir(sources):
# note: do not abspath s; the build will fail if any
# higher up directory name has spaces in it.
fnames
=
os
.
listdir
(
s
)
except
os
.
e
rror
:
except
OSE
rror
:
fnames
=
[]
for
fname
in
fnames
:
fqn
=
os
.
path
.
join
(
s
,
fname
)
...
...
PC/winreg.c
View file @
7ce98ff7
...
...
@@ -1794,9 +1794,9 @@ PyMODINIT_FUNC PyInit_winreg(void)
if
(
PyDict_SetItemString
(
d
,
"HKEYType"
,
(
PyObject
*
)
&
PyHKEY_Type
)
!=
0
)
return
NULL
;
Py_INCREF
(
PyExc_
Windows
Error
);
Py_INCREF
(
PyExc_
OS
Error
);
if
(
PyDict_SetItemString
(
d
,
"error"
,
PyExc_
Windows
Error
)
!=
0
)
PyExc_
OS
Error
)
!=
0
)
return
NULL
;
/* Add the relevant constants */
...
...
Python/errors.c
View file @
7ce98ff7
...
...
@@ -588,7 +588,7 @@ PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr)
PyObject
*
PyErr_SetFromWindowsErr
(
int
ierr
)
{
return
PyErr_SetExcFromWindowsErrWithFilename
(
PyExc_
Windows
Error
,
return
PyErr_SetExcFromWindowsErrWithFilename
(
PyExc_
OS
Error
,
ierr
,
NULL
);
}
PyObject
*
PyErr_SetFromWindowsErrWithFilename
(
...
...
@@ -597,7 +597,7 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
{
PyObject
*
name
=
filename
?
PyUnicode_DecodeFSDefault
(
filename
)
:
NULL
;
PyObject
*
result
=
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_
Windows
Error
,
PyExc_
OS
Error
,
ierr
,
name
);
Py_XDECREF
(
name
);
return
result
;
...
...
@@ -611,7 +611,7 @@ PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename(
PyUnicode_FromUnicode
(
filename
,
wcslen
(
filename
))
:
NULL
;
PyObject
*
result
=
PyErr_SetExcFromWindowsErrWithFilenameObject
(
PyExc_
Windows
Error
,
PyExc_
OS
Error
,
ierr
,
name
);
Py_XDECREF
(
name
);
return
result
;
...
...
Tools/scripts/win_add2path.py
View file @
7ce98ff7
...
...
@@ -30,7 +30,7 @@ def modify():
with
winreg
.
CreateKey
(
HKCU
,
ENV
)
as
key
:
try
:
envpath
=
winreg
.
QueryValueEx
(
key
,
PATH
)[
0
]
except
Windows
Error
:
except
OS
Error
:
envpath
=
DEFAULT
paths
=
[
envpath
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment