Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-32703: Fix coroutine resource warning in case where there's an error
  • Loading branch information
1st1 committed Jan 29, 2018
commit 11bdda9f455b83b782b79d56b4550404c78f940c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix coroutine's ResourceWarning when there's an active error set when it's
being finalized.
4 changes: 1 addition & 3 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ _PyGen_Finalize(PyObject *self)
if (gen->gi_code != NULL &&
((PyCodeObject *)gen->gi_code)->co_flags & CO_COROUTINE &&
gen->gi_frame->f_lasti == -1) {
if (!error_value) {
_PyErr_WarnUnawaitedCoroutine((PyObject *)gen);
}
_PyErr_WarnUnawaitedCoroutine((PyObject *)gen);
}
else {
res = gen_close(gen, NULL);
Expand Down