mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475)
Replace "on verb+ing" with "while verb+ing".
This commit is contained in:
parent
3ebe3d7688
commit
95504f429e
25 changed files with 79 additions and 59 deletions
|
@ -1475,13 +1475,15 @@ finalize_modules_delete_special(PyThreadState *tstate, int verbose)
|
|||
PySys_WriteStderr("# clear builtins._\n");
|
||||
}
|
||||
if (PyDict_SetItemString(interp->builtins, "_", Py_None) < 0) {
|
||||
PyErr_FormatUnraisable("Exception ignored on setting builtin variable _");
|
||||
PyErr_FormatUnraisable("Exception ignored while "
|
||||
"setting builtin variable _");
|
||||
}
|
||||
|
||||
const char * const *p;
|
||||
for (p = sys_deletes; *p != NULL; p++) {
|
||||
if (_PySys_ClearAttrString(interp, *p, verbose) < 0) {
|
||||
PyErr_FormatUnraisable("Exception ignored on clearing sys.%s", *p);
|
||||
PyErr_FormatUnraisable("Exception ignored while "
|
||||
"clearing sys.%s", *p);
|
||||
}
|
||||
}
|
||||
for (p = sys_files; *p != NULL; p+=2) {
|
||||
|
@ -1492,13 +1494,15 @@ finalize_modules_delete_special(PyThreadState *tstate, int verbose)
|
|||
}
|
||||
PyObject *value;
|
||||
if (PyDict_GetItemStringRef(interp->sysdict, orig_name, &value) < 0) {
|
||||
PyErr_FormatUnraisable("Exception ignored on restoring sys.%s", name);
|
||||
PyErr_FormatUnraisable("Exception ignored while "
|
||||
"restoring sys.%s", name);
|
||||
}
|
||||
if (value == NULL) {
|
||||
value = Py_NewRef(Py_None);
|
||||
}
|
||||
if (PyDict_SetItemString(interp->sysdict, name, value) < 0) {
|
||||
PyErr_FormatUnraisable("Exception ignored on restoring sys.%s", name);
|
||||
PyErr_FormatUnraisable("Exception ignored while "
|
||||
"restoring sys.%s", name);
|
||||
}
|
||||
Py_DECREF(value);
|
||||
}
|
||||
|
@ -1510,7 +1514,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
|||
{
|
||||
PyObject *weaklist = PyList_New(0);
|
||||
if (weaklist == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules");
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules");
|
||||
}
|
||||
|
||||
#define STORE_MODULE_WEAKREF(name, mod) \
|
||||
|
@ -1519,13 +1523,13 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
|||
if (wr) { \
|
||||
PyObject *tup = PyTuple_Pack(2, name, wr); \
|
||||
if (!tup || PyList_Append(weaklist, tup) < 0) { \
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules"); \
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules"); \
|
||||
} \
|
||||
Py_XDECREF(tup); \
|
||||
Py_DECREF(wr); \
|
||||
} \
|
||||
else { \
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules"); \
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -1536,7 +1540,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
|||
} \
|
||||
STORE_MODULE_WEAKREF(name, mod); \
|
||||
if (PyObject_SetItem(modules, name, Py_None) < 0) { \
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules"); \
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -1550,14 +1554,14 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
|||
else {
|
||||
PyObject *iterator = PyObject_GetIter(modules);
|
||||
if (iterator == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules");
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules");
|
||||
}
|
||||
else {
|
||||
PyObject *key;
|
||||
while ((key = PyIter_Next(iterator))) {
|
||||
PyObject *value = PyObject_GetItem(modules, key);
|
||||
if (value == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules");
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules");
|
||||
continue;
|
||||
}
|
||||
CLEAR_MODULE(key, value);
|
||||
|
@ -1565,7 +1569,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
|||
Py_DECREF(key);
|
||||
}
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_FormatUnraisable("Exception ignored on removing modules");
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules");
|
||||
}
|
||||
Py_DECREF(iterator);
|
||||
}
|
||||
|
@ -1585,7 +1589,7 @@ finalize_clear_modules_dict(PyObject *modules)
|
|||
}
|
||||
else {
|
||||
if (PyObject_CallMethodNoArgs(modules, &_Py_ID(clear)) == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored on clearing sys.modules");
|
||||
PyErr_FormatUnraisable("Exception ignored while clearing sys.modules");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1597,11 +1601,11 @@ finalize_restore_builtins(PyThreadState *tstate)
|
|||
PyInterpreterState *interp = tstate->interp;
|
||||
PyObject *dict = PyDict_Copy(interp->builtins);
|
||||
if (dict == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored on restoring builtins");
|
||||
PyErr_FormatUnraisable("Exception ignored while restoring builtins");
|
||||
}
|
||||
PyDict_Clear(interp->builtins);
|
||||
if (PyDict_Update(interp->builtins, interp->builtins_copy)) {
|
||||
PyErr_FormatUnraisable("Exception ignored on restoring builtins");
|
||||
PyErr_FormatUnraisable("Exception ignored while restoring builtins");
|
||||
}
|
||||
Py_XDECREF(dict);
|
||||
}
|
||||
|
@ -1773,7 +1777,7 @@ flush_std_files(void)
|
|||
|
||||
if (fout != NULL && fout != Py_None && !file_is_closed(fout)) {
|
||||
if (_PyFile_Flush(fout) < 0) {
|
||||
PyErr_FormatUnraisable("Exception ignored on flushing sys.stdout");
|
||||
PyErr_FormatUnraisable("Exception ignored while flushing sys.stdout");
|
||||
status = -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue