Skip to content

Commit a7c449b

Browse files
CuriousLearnerncoghlan
authored andcommitted
bpo-30721: Add missing '?' to new error message (GH-3131)
1 parent f0202bb commit a7c449b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎Lib/test/test_print.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ def test_stream_redirection_hint_for_py2_migration(self):
161161
with self.assertRaises(TypeError) as context:
162162
print >> sys.stderr, "message"
163163
self.assertIn('Did you mean "print(<message>, '
164-
'file=<output_stream>)', str(context.exception))
164+
'file=<output_stream>)"?', str(context.exception))
165165

166166
# Test correct hint is produced in the case where RHS implements
167167
# __rrshift__ but returns NotImplemented
168168
with self.assertRaises(TypeError) as context:
169169
print >> 42
170170
self.assertIn('Did you mean "print(<message>, '
171-
'file=<output_stream>)', str(context.exception))
171+
'file=<output_stream>)"?', str(context.exception))
172172

173173
# Test stream redirection hint is specific to print
174174
with self.assertRaises(TypeError) as context:

‎Objects/abstract.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name)
827827
PyErr_Format(PyExc_TypeError,
828828
"unsupported operand type(s) for %.100s: "
829829
"'%.100s' and '%.100s'. Did you mean \"print(<message>, "
830-
"file=<output_stream>)\"",
830+
"file=<output_stream>)\"?",
831831
op_name,
832832
v->ob_type->tp_name,
833833
w->ob_type->tp_name);

0 commit comments

Comments
 (0)