summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>2021-05-28 16:29:19 (GMT)
committerGitHub <noreply@github.com>2021-05-28 16:29:19 (GMT)
commit490b638e63558013b71dbfba6e47cb9e6d80c911 (patch)
tree761c313a6652970ffaf74b80b7a8de9a1e728897
parent0fa282c55f1a45765340cb24ed65c90ffe2aa405 (diff)
downloadcpython-490b638e63558013b71dbfba6e47cb9e6d80c911.zip
cpython-490b638e63558013b71dbfba6e47cb9e6d80c911.tar.gz
cpython-490b638e63558013b71dbfba6e47cb9e6d80c911.tar.bz2
bpo-42972: Fix GC assertion error in _winapi by untracking Overlapped earlier (GH(26429)
-rw-r--r--Modules/_winapi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 30fcb4e..2c03462 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -132,6 +132,7 @@ overlapped_dealloc(OverlappedObject *self)
DWORD bytes;
int err = GetLastError();
+ PyObject_GC_UnTrack(self);
if (self->pending) {
if (check_CancelIoEx() &&
Py_CancelIoEx(self->handle, &self->overlapped) &&
@@ -164,7 +165,6 @@ overlapped_dealloc(OverlappedObject *self)
CloseHandle(self->overlapped.hEvent);
SetLastError(err);
- PyObject_GC_UnTrack(self);
if (self->write_buffer.obj)
PyBuffer_Release(&self->write_buffer);
Py_CLEAR(self->read_buffer);