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
4e07a8c9
Commit
4e07a8c9
authored
Aug 28, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
59043f96
ea62bd50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
Lib/test/test_exceptions.py
Lib/test/test_exceptions.py
+2
-2
Misc/NEWS
Misc/NEWS
+3
-0
Objects/exceptions.c
Objects/exceptions.c
+2
-2
No files found.
Lib/test/test_exceptions.py
View file @
4e07a8c9
...
...
@@ -216,14 +216,14 @@ class ExceptionTests(unittest.TestCase):
self
.
assertEqual
(
w
.
winerror
,
3
)
self
.
assertEqual
(
w
.
strerror
,
'foo'
)
self
.
assertEqual
(
w
.
filename
,
'bar'
)
self
.
assertEqual
(
str
(
w
),
"[Error 3] foo: 'bar'"
)
self
.
assertEqual
(
str
(
w
),
"[
Win
Error 3] foo: 'bar'"
)
# Unknown win error becomes EINVAL (22)
w
=
OSError
(
0
,
'foo'
,
None
,
1001
)
self
.
assertEqual
(
w
.
errno
,
22
)
self
.
assertEqual
(
w
.
winerror
,
1001
)
self
.
assertEqual
(
w
.
strerror
,
'foo'
)
self
.
assertEqual
(
w
.
filename
,
None
)
self
.
assertEqual
(
str
(
w
),
"[Error 1001] foo"
)
self
.
assertEqual
(
str
(
w
),
"[
Win
Error 1001] foo"
)
# Non-numeric "errno"
w
=
OSError
(
'bar'
,
'foo'
)
self
.
assertEqual
(
w
.
errno
,
'bar'
)
...
...
Misc/NEWS
View file @
4e07a8c9
...
...
@@ -40,6 +40,9 @@ What's New in Python 3.3.0 Release Candidate 2?
Core
and
Builtins
-----------------
-
Issue
#
15784
:
Modify
OSError
.
__str__
()
to
better
distinguish
between
errno
error
numbers
and
Windows
error
numbers
.
-
Issue
#
15781
:
Fix
two
small
race
conditions
in
import
's module locking.
Library
...
...
Objects/exceptions.c
View file @
4e07a8c9
...
...
@@ -1016,12 +1016,12 @@ OSError_str(PyOSErrorObject *self)
#ifdef MS_WINDOWS
/* If available, winerror has the priority over myerrno */
if
(
self
->
winerror
&&
self
->
filename
)
return
PyUnicode_FromFormat
(
"[Error %S] %S: %R"
,
return
PyUnicode_FromFormat
(
"[
Win
Error %S] %S: %R"
,
self
->
winerror
?
self
->
winerror
:
Py_None
,
self
->
strerror
?
self
->
strerror
:
Py_None
,
self
->
filename
);
if
(
self
->
winerror
&&
self
->
strerror
)
return
PyUnicode_FromFormat
(
"[Error %S] %S"
,
return
PyUnicode_FromFormat
(
"[
Win
Error %S] %S"
,
self
->
winerror
?
self
->
winerror
:
Py_None
,
self
->
strerror
?
self
->
strerror
:
Py_None
);
#endif
...
...
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