Skip to content
Closed
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 @@
Fix a crash in the warnings module when allocating a synthetic filename fails under memory pressure.
3 changes: 3 additions & 0 deletions Python/_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,9 @@ setup_context(Py_ssize_t stack_level,
globals = interp->sysdict;
*filename = PyUnicode_FromString("<sys>");
*lineno = 0;
if (*filename == NULL) {
return 0; /* nothing else allocated yet on this path */
}
}
else {
globals = f->f_frame->f_globals;
Expand Down
Loading