Skip to content

[3.6] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (GH-3539) #3556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an
exception with a bad ``__module__`` attribute. Patch by Oren Milman.
2 changes: 1 addition & 1 deletion Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ PyErr_WriteUnraisable(PyObject *obj)
}

moduleName = _PyObject_GetAttrId(t, &PyId___module__);
if (moduleName == NULL) {
if (moduleName == NULL || !PyUnicode_Check(moduleName)) {
PyErr_Clear();
if (PyFile_WriteString("<unknown>", f) < 0)
goto done;
Expand Down