mirror of
https://github.com/python/cpython.git
synced 2025-12-08 10:21:13 +00:00
gh-111178: fix UBSan failures in Modules/_multiprocessing/semaphore.c (#129084)
fix UBSan failures for `SemLockObject`
This commit is contained in:
parent
382340d559
commit
5ed5572cac
1 changed files with 5 additions and 2 deletions
|
|
@ -28,6 +28,8 @@ typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
} SemLockObject;
|
} SemLockObject;
|
||||||
|
|
||||||
|
#define _SemLockObject_CAST(op) ((SemLockObject *)(op))
|
||||||
|
|
||||||
/*[python input]
|
/*[python input]
|
||||||
class SEM_HANDLE_converter(CConverter):
|
class SEM_HANDLE_converter(CConverter):
|
||||||
type = "SEM_HANDLE"
|
type = "SEM_HANDLE"
|
||||||
|
|
@ -576,8 +578,9 @@ _multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
semlock_dealloc(SemLockObject* self)
|
semlock_dealloc(PyObject *op)
|
||||||
{
|
{
|
||||||
|
SemLockObject *self = _SemLockObject_CAST(op);
|
||||||
PyTypeObject *tp = Py_TYPE(self);
|
PyTypeObject *tp = Py_TYPE(self);
|
||||||
PyObject_GC_UnTrack(self);
|
PyObject_GC_UnTrack(self);
|
||||||
if (self->handle != SEM_FAILED)
|
if (self->handle != SEM_FAILED)
|
||||||
|
|
@ -718,7 +721,7 @@ _multiprocessing_SemLock___exit___impl(SemLockObject *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
semlock_traverse(SemLockObject *s, visitproc visit, void *arg)
|
semlock_traverse(PyObject *s, visitproc visit, void *arg)
|
||||||
{
|
{
|
||||||
Py_VISIT(Py_TYPE(s));
|
Py_VISIT(Py_TYPE(s));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue