Visitar URL original
gh-132413: Clear weakref to _datetime after modules are finalized by neonene · Pull Request #136152 · python/cpython · GitHub
Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add non-NULL check
  • Loading branch information
neonene authored Jul 1, 2025
commit 263bdb2f94e32a3b1dcd006bc87839fbbbac8df5
8 changes: 5 additions & 3 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,10 +1621,12 @@ finalize_remove_modules(PyObject *modules, int verbose)
}
}

if (PyList_Extend(weaklist, weak_ext) < 0) {
PyErr_FormatUnraisable("Exception ignored while removing modules");
if (weaklist != NULL) {
if (PyList_Extend(weaklist, weak_ext) < 0) {
PyErr_FormatUnraisable("Exception ignored while removing modules");
}
Py_DECREF(weak_ext);
}
Py_DECREF(weak_ext);

#undef CLEAR_MODULE
#undef STORE_MODULE_WEAKREF
Expand Down