diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-11 12:39:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 12:39:09 (GMT) |
commit | 916686fdb273d6adbd403e6d58029960ec7a89ab (patch) | |
tree | 513ec194ba47f25a500d8b96dca3e70736347972 /Modules | |
parent | b87d03d355a1b303a1e0550b0da0fdeb99674da5 (diff) | |
download | cpython-916686fdb273d6adbd403e6d58029960ec7a89ab.zip cpython-916686fdb273d6adbd403e6d58029960ec7a89ab.tar.gz cpython-916686fdb273d6adbd403e6d58029960ec7a89ab.tar.bz2 |
GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738)
* fix allocator and deallocator
* 📜🤖 Added by blurb_it.
* code review
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit f5b76330cfb93e1ad1a77c71dafe719f6a808cec)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_multiprocessing/semaphore.c | 6 |
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] |