diff --git a/Lib/test/test_capi/test_watchers.py b/Lib/test/test_capi/test_watchers.py index 6b8855ec219d27..3e04fdc64f9418 100644 --- a/Lib/test/test_capi/test_watchers.py +++ b/Lib/test/test_capi/test_watchers.py @@ -110,9 +110,11 @@ def test_error(self): with catch_unraisable_exception() as cm: d["foo"] = "bar" self.assertIn( - "PyDict_EVENT_ADDED watcher callback for tp_name); } Py_DECREF(op); diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index ad3857c429fd4e..a3d55b76aa1012 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -902,7 +902,7 @@ module_clear(PyModuleObject *m) { int res = m->md_def->m_clear((PyObject*)m); if (PyErr_Occurred()) { - PyErr_FormatUnraisable("Exception ignored in m_clear of module%s%V\n", + PyErr_FormatUnraisable("Exception ignored in m_clear of module%s%V", m->md_name ? " " : "", m->md_name, ""); } diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 3e87a96f61f850..9cece98759f058 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -828,7 +828,9 @@ PyType_Modified(PyTypeObject *type) if (bits & 1) { PyType_WatchCallback cb = interp->type_watchers[i]; if (cb && (cb(type) < 0)) { - PyErr_FormatUnraisable("Exception ignored in watcher callback for %R", i, type); + PyErr_FormatUnraisable( + "Exception ignored in watcher callback #%d for %R", + i, type); } } i++;