summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_multiprocessing/semaphore.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 9a2d1f8..3356658 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -452,9 +452,7 @@ static PyObject *
newsemlockobject(PyTypeObject *type, SEM_HANDLE handle, int kind, int maxvalue,
char *name)
{
- SemLockObject *self;
-
- self = PyObject_New(SemLockObject, type);
+ SemLockObject *self = (SemLockObject *)type->tp_alloc(type, 0);
if (!self)
return NULL;
self->handle = handle;
@@ -571,7 +569,7 @@ semlock_dealloc(SemLockObject* self)
if (self->handle != SEM_FAILED)
SEM_CLOSE(self->handle);
PyMem_Free(self->name);
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
/*[clinic input]