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
f8a4c03e
Commit
f8a4c03e
authored
Nov 15, 2017
by
Serhiy Storchaka
Committed by
GitHub
Nov 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)
parent
aca7f574
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
12 deletions
+18
-12
Lib/test/test_baseexception.py
Lib/test/test_baseexception.py
+1
-1
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+1
-1
Lib/test/test_yield_from.py
Lib/test/test_yield_from.py
+9
-9
Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst
...ore and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst
+2
-0
Objects/exceptions.c
Objects/exceptions.c
+5
-1
No files found.
Lib/test/test_baseexception.py
View file @
f8a4c03e
...
@@ -92,7 +92,7 @@ class ExceptionClassTests(unittest.TestCase):
...
@@ -92,7 +92,7 @@ class ExceptionClassTests(unittest.TestCase):
exc
=
Exception
(
arg
)
exc
=
Exception
(
arg
)
results
=
([
len
(
exc
.
args
),
1
],
[
exc
.
args
[
0
],
arg
],
results
=
([
len
(
exc
.
args
),
1
],
[
exc
.
args
[
0
],
arg
],
[
str
(
exc
),
str
(
arg
)],
[
str
(
exc
),
str
(
arg
)],
[
repr
(
exc
),
exc
.
__class__
.
__name__
+
repr
(
exc
.
args
)])
[
repr
(
exc
),
'%s(%r)'
%
(
exc
.
__class__
.
__name__
,
arg
)])
self
.
interface_test_driver
(
results
)
self
.
interface_test_driver
(
results
)
def
test_interface_multi_arg
(
self
):
def
test_interface_multi_arg
(
self
):
...
...
Lib/test/test_httplib.py
View file @
f8a4c03e
...
@@ -497,7 +497,7 @@ class BasicTest(TestCase):
...
@@ -497,7 +497,7 @@ class BasicTest(TestCase):
def
test_bad_status_repr
(
self
):
def
test_bad_status_repr
(
self
):
exc
=
client
.
BadStatusLine
(
''
)
exc
=
client
.
BadStatusLine
(
''
)
self
.
assertEqual
(
repr
(
exc
),
'''BadStatusLine("
\
'
\
'
",
)'''
)
self
.
assertEqual
(
repr
(
exc
),
'''BadStatusLine("
''"
)'''
)
def
test_partial_reads
(
self
):
def
test_partial_reads
(
self
):
# if we have Content-Length, HTTPResponse knows when to close itself,
# if we have Content-Length, HTTPResponse knows when to close itself,
...
...
Lib/test/test_yield_from.py
View file @
f8a4c03e
...
@@ -418,7 +418,7 @@ class TestPEP380Operation(unittest.TestCase):
...
@@ -418,7 +418,7 @@ class TestPEP380Operation(unittest.TestCase):
"Yielded g2 spam"
,
"Yielded g2 spam"
,
"Yielded g2 more spam"
,
"Yielded g2 more spam"
,
"Finishing g2"
,
"Finishing g2"
,
"g2 returned StopIteration(3
,
)"
,
"g2 returned StopIteration(3)"
,
"Yielded g1 eggs"
,
"Yielded g1 eggs"
,
"Finishing g1"
,
"Finishing g1"
,
])
])
...
@@ -696,15 +696,15 @@ class TestPEP380Operation(unittest.TestCase):
...
@@ -696,15 +696,15 @@ class TestPEP380Operation(unittest.TestCase):
"g starting"
,
"g starting"
,
"f resuming g"
,
"f resuming g"
,
"g returning 1"
,
"g returning 1"
,
"f caught StopIteration(1
,
)"
,
"f caught StopIteration(1)"
,
"g starting"
,
"g starting"
,
"f resuming g"
,
"f resuming g"
,
"g returning (2,)"
,
"g returning (2,)"
,
"f caught StopIteration((2,)
,
)"
,
"f caught StopIteration((2,))"
,
"g starting"
,
"g starting"
,
"f resuming g"
,
"f resuming g"
,
"g returning StopIteration(3
,
)"
,
"g returning StopIteration(3)"
,
"f caught StopIteration(StopIteration(3
,),
)"
,
"f caught StopIteration(StopIteration(3
)
)"
,
])
])
def
test_send_and_return_with_value
(
self
):
def
test_send_and_return_with_value
(
self
):
...
@@ -741,17 +741,17 @@ class TestPEP380Operation(unittest.TestCase):
...
@@ -741,17 +741,17 @@ class TestPEP380Operation(unittest.TestCase):
"f sending spam to g"
,
"f sending spam to g"
,
"g received 'spam'"
,
"g received 'spam'"
,
"g returning 1"
,
"g returning 1"
,
'f caught StopIteration(1
,
)'
,
'f caught StopIteration(1)'
,
'g starting'
,
'g starting'
,
'f sending spam to g'
,
'f sending spam to g'
,
"g received 'spam'"
,
"g received 'spam'"
,
'g returning (2,)'
,
'g returning (2,)'
,
'f caught StopIteration((2,)
,
)'
,
'f caught StopIteration((2,))'
,
'g starting'
,
'g starting'
,
'f sending spam to g'
,
'f sending spam to g'
,
"g received 'spam'"
,
"g received 'spam'"
,
'g returning StopIteration(3
,
)'
,
'g returning StopIteration(3)'
,
'f caught StopIteration(StopIteration(3
,),
)'
'f caught StopIteration(StopIteration(3
)
)'
])
])
def
test_catching_exception_from_subgen_and_returning
(
self
):
def
test_catching_exception_from_subgen_and_returning
(
self
):
...
...
Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst
0 → 100644
View file @
f8a4c03e
Standard repr() of BaseException with a single argument no longer contains
redundant trailing comma.
Objects/exceptions.c
View file @
f8a4c03e
...
@@ -117,6 +117,10 @@ static PyObject *
...
@@ -117,6 +117,10 @@ static PyObject *
BaseException_repr
(
PyBaseExceptionObject
*
self
)
BaseException_repr
(
PyBaseExceptionObject
*
self
)
{
{
const
char
*
name
=
_PyType_Name
(
Py_TYPE
(
self
));
const
char
*
name
=
_PyType_Name
(
Py_TYPE
(
self
));
if
(
PyTuple_GET_SIZE
(
self
->
args
)
==
1
)
return
PyUnicode_FromFormat
(
"%s(%R)"
,
name
,
PyTuple_GET_ITEM
(
self
->
args
,
0
));
else
return
PyUnicode_FromFormat
(
"%s%R"
,
name
,
self
->
args
);
return
PyUnicode_FromFormat
(
"%s%R"
,
name
,
self
->
args
);
}
}
...
...
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