[Python-checkins] cpython: Fix usage of PyMem_Malloc() in overlapped.c
victor.stinner
python-checkins at python.org
Wed Mar 16 18:37:46 EDT 2016
https://hg.python.org/cpython/rev/959e58cfbde9
changeset: 100563:959e58cfbde9
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Mar 16 23:25:02 2016 +0100
summary:
Fix usage of PyMem_Malloc() in overlapped.c
Issue #26563: Replace PyMem_Malloc() with PyMem_RawFree() since
PostToQueueCallback() calls PyMem_RawFree() (previously PyMem_Free()) in a new
C thread which doesn't hold the GIL.
files:
Modules/overlapped.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -238,7 +238,7 @@
PostQueuedCompletionStatus(p->CompletionPort, TimerOrWaitFired,
0, p->Overlapped);
/* ignore possible error! */
- PyMem_Free(p);
+ PyMem_RawFree(p);
}
PyDoc_STRVAR(
@@ -262,7 +262,10 @@
&Milliseconds))
return NULL;
- pdata = PyMem_Malloc(sizeof(struct PostCallbackData));
+ /* Use PyMem_RawMalloc() rather than PyMem_Malloc(), since
+ PostToQueueCallback() will call PyMem_Free() from a new C thread
+ which doesn't hold the GIL. */
+ pdata = PyMem_RawMalloc(sizeof(struct PostCallbackData));
if (pdata == NULL)
return SetFromWindowsErr(0);
@@ -273,7 +276,7 @@
pdata, Milliseconds,
WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE))
{
- PyMem_Free(pdata);
+ PyMem_RawFree(pdata);
return SetFromWindowsErr(0);
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list