[Python-checkins] bpo-30721: Add missing '?' to new error message (GH-3131)
Nick Coghlan
webhook-mailer at python.org
Fri Aug 18 08:18:17 EDT 2017
https://github.com/python/cpython/commit/a7c449b8c08933deabcf329fb74ed1336f6db34f
commit: a7c449b8c08933deabcf329fb74ed1336f6db34f
branch: master
author: Sanyam Khurana <sanyam at sanyamkhurana.com>
committer: Nick Coghlan <ncoghlan at gmail.com>
date: 2017-08-18T22:18:14+10:00
summary:
bpo-30721: Add missing '?' to new error message (GH-3131)
files:
M Lib/test/test_print.py
M Objects/abstract.c
diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py
index 80993279b8d..e6434feaf5e 100644
--- a/Lib/test/test_print.py
+++ b/Lib/test/test_print.py
@@ -161,14 +161,14 @@ def test_stream_redirection_hint_for_py2_migration(self):
with self.assertRaises(TypeError) as context:
print >> sys.stderr, "message"
self.assertIn('Did you mean "print(<message>, '
- 'file=<output_stream>)', str(context.exception))
+ 'file=<output_stream>)"?', str(context.exception))
# Test correct hint is produced in the case where RHS implements
# __rrshift__ but returns NotImplemented
with self.assertRaises(TypeError) as context:
print >> 42
self.assertIn('Did you mean "print(<message>, '
- 'file=<output_stream>)', str(context.exception))
+ 'file=<output_stream>)"?', str(context.exception))
# Test stream redirection hint is specific to print
with self.assertRaises(TypeError) as context:
diff --git a/Objects/abstract.c b/Objects/abstract.c
index abd97953bd9..66ac0e3ea73 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -827,7 +827,7 @@ binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name)
PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %.100s: "
"'%.100s' and '%.100s'. Did you mean \"print(<message>, "
- "file=<output_stream>)\"",
+ "file=<output_stream>)\"?",
op_name,
v->ob_type->tp_name,
w->ob_type->tp_name);
More information about the Python-checkins
mailing list