Skip to content

Commit 95504f4

Browse files
authored
gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475)
Replace "on verb+ing" with "while verb+ing".
1 parent 3ebe3d7 commit 95504f4

25 files changed

+79
-59
lines changed

Lib/test/test_cmd_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def test_stdout_flush_at_shutdown(self):
491491
rc, out, err = assert_python_failure('-c', code)
492492
self.assertEqual(b'', out)
493493
self.assertEqual(120, rc)
494-
self.assertIn(b'Exception ignored on flushing sys.stdout:\n'
494+
self.assertIn(b'Exception ignored while flushing sys.stdout:\n'
495495
b'OSError: '.replace(b'\n', os.linesep.encode()),
496496
err)
497497

Lib/test/test_ctypes/test_callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def func():
324324

325325
self.assertIsInstance(cm.unraisable.exc_value, TypeError)
326326
self.assertEqual(cm.unraisable.err_msg,
327-
f"Exception ignored on converting result "
327+
f"Exception ignored while converting result "
328328
f"of ctypes callback function {func!r}")
329329
self.assertIsNone(cm.unraisable.object)
330330

Lib/test/test_ctypes/test_random_things.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def expect_unraisable(self, exc_type, exc_msg=None):
5151
if exc_msg is not None:
5252
self.assertEqual(str(cm.unraisable.exc_value), exc_msg)
5353
self.assertEqual(cm.unraisable.err_msg,
54-
f"Exception ignored on calling ctypes "
54+
f"Exception ignored while calling ctypes "
5555
f"callback function {callback_func!r}")
5656
self.assertIsNone(cm.unraisable.object)
5757

Lib/test/test_signal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def handler(signum, frame):
383383
except ZeroDivisionError:
384384
# An ignored exception should have been printed out on stderr
385385
err = err.getvalue()
386-
if ('Exception ignored when trying to write to the signal wakeup fd'
386+
if ('Exception ignored while trying to write to the signal wakeup fd'
387387
not in err):
388388
raise AssertionError(err)
389389
if ('OSError: [Errno %d]' % errno.EBADF) not in err:
@@ -572,7 +572,7 @@ def handler(signum, frame):
572572
signal.raise_signal(signum)
573573
574574
err = err.getvalue()
575-
if ('Exception ignored when trying to {action} to the signal wakeup fd'
575+
if ('Exception ignored while trying to {action} to the signal wakeup fd'
576576
not in err):
577577
raise AssertionError(err)
578578
""".format(action=action)
@@ -642,7 +642,7 @@ def handler(signum, frame):
642642
"buffer" % written)
643643
644644
# By default, we get a warning when a signal arrives
645-
msg = ('Exception ignored when trying to {action} '
645+
msg = ('Exception ignored while trying to {action} '
646646
'to the signal wakeup fd')
647647
signal.set_wakeup_fd(write.fileno())
648648

Modules/_ctypes/_ctypes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ _DictRemover_call(PyObject *myself, PyObject *args, PyObject *kw)
183183
DictRemoverObject *self = _DictRemoverObject_CAST(myself);
184184
if (self->key && self->dict) {
185185
if (-1 == PyDict_DelItem(self->dict, self->key)) {
186-
PyErr_FormatUnraisable("Exception ignored on calling _ctypes.DictRemover");
186+
PyErr_FormatUnraisable("Exception ignored while "
187+
"calling _ctypes.DictRemover");
187188
}
188189
Py_CLEAR(self->key);
189190
Py_CLEAR(self->dict);

Modules/_ctypes/callbacks.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ static void _CallPythonObject(ctypes_state *st,
225225

226226
result = PyObject_Vectorcall(callable, args, nargs, NULL);
227227
if (result == NULL) {
228-
PyErr_FormatUnraisable(
229-
"Exception ignored on calling ctypes callback function %R",
230-
callable);
228+
PyErr_FormatUnraisable("Exception ignored while "
229+
"calling ctypes callback function %R",
230+
callable);
231231
}
232232

233233
#ifdef MS_WIN32
@@ -269,7 +269,7 @@ static void _CallPythonObject(ctypes_state *st,
269269
if (keep == NULL) {
270270
/* Could not convert callback result. */
271271
PyErr_FormatUnraisable(
272-
"Exception ignored on converting result "
272+
"Exception ignored while converting result "
273273
"of ctypes callback function %R",
274274
callable);
275275
}
@@ -282,7 +282,7 @@ static void _CallPythonObject(ctypes_state *st,
282282
"memory leak in callback function.",
283283
1) == -1) {
284284
PyErr_FormatUnraisable(
285-
"Exception ignored on converting result "
285+
"Exception ignored while converting result "
286286
"of ctypes callback function %R",
287287
callable);
288288
}

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ clear_current_module(PyInterpreterState *interp, PyObject *expected)
226226
goto finally;
227227

228228
error:
229-
PyErr_FormatUnraisable("Exception ignored when clearing _datetime module");
229+
PyErr_FormatUnraisable("Exception ignored while clearing _datetime module");
230230

231231
finally:
232232
PyErr_SetRaisedException(exc);

Modules/_lsprof.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ profiler_dealloc(ProfilerObject *op)
933933
if (op->flags & POF_ENABLED) {
934934
PyThreadState *tstate = _PyThreadState_GET();
935935
if (_PyEval_SetProfile(tstate, NULL, NULL) < 0) {
936-
PyErr_FormatUnraisable("Exception ignored when destroying _lsprof profiler");
936+
PyErr_FormatUnraisable("Exception ignored while "
937+
"destroying _lsprof profiler");
937938
}
938939
}
939940

Modules/_testcapi/watchers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ allocate_too_many_code_watchers(PyObject *self, PyObject *args)
428428
PyObject *exc = PyErr_GetRaisedException();
429429
for (int i = 0; i < num_watchers; i++) {
430430
if (PyCode_ClearWatcher(watcher_ids[i]) < 0) {
431-
PyErr_FormatUnraisable("Exception ignored when "
431+
PyErr_FormatUnraisable("Exception ignored while "
432432
"clearing code watcher");
433433
break;
434434
}
@@ -610,7 +610,7 @@ allocate_too_many_func_watchers(PyObject *self, PyObject *args)
610610
PyObject *exc = PyErr_GetRaisedException();
611611
for (int i = 0; i < num_watchers; i++) {
612612
if (PyFunction_ClearWatcher(watcher_ids[i]) < 0) {
613-
PyErr_FormatUnraisable("Exception ignored when "
613+
PyErr_FormatUnraisable("Exception ignored while "
614614
"clearing function watcher");
615615
break;
616616
}
@@ -757,7 +757,7 @@ allocate_too_many_context_watchers(PyObject *self, PyObject *args)
757757
PyObject *exc = PyErr_GetRaisedException();
758758
for (int i = 0; i < num_watchers; i++) {
759759
if (PyContext_ClearWatcher(watcher_ids[i]) < 0) {
760-
PyErr_FormatUnraisable("Exception ignored when "
760+
PyErr_FormatUnraisable("Exception ignored while "
761761
"clearing context watcher");
762762
break;
763763
}

Modules/_winapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ overlapped_dealloc(OverlappedObject *self)
177177
PyErr_SetString(PyExc_PythonFinalizationError,
178178
"I/O operations still in flight while destroying "
179179
"Overlapped object, the process may crash");
180-
PyErr_FormatUnraisable("Exception ignored when deallocating "
180+
PyErr_FormatUnraisable("Exception ignored while deallocating "
181181
"overlapped operation %R", self);
182182
}
183183
else {

0 commit comments

Comments
 (0)