mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
gh-111178: fix UBSan failures in Modules/unicodedata.c
(GH-129801)
fix UBSan failures for `PreviousDBVersion`
This commit is contained in:
parent
ecde940025
commit
c1478d1ebb
1 changed files with 5 additions and 3 deletions
|
@ -77,9 +77,11 @@ typedef struct previous_version {
|
|||
Py_UCS4 (*normalization)(Py_UCS4);
|
||||
} PreviousDBVersion;
|
||||
|
||||
#define PreviousDBVersion_CAST(op) ((PreviousDBVersion *)(op))
|
||||
|
||||
#include "clinic/unicodedata.c.h"
|
||||
|
||||
#define get_old_record(self, v) ((((PreviousDBVersion*)self)->getrecord)(v))
|
||||
#define get_old_record(self, v) (PreviousDBVersion_CAST(self)->getrecord(v))
|
||||
|
||||
static PyMemberDef DB_members[] = {
|
||||
{"unidata_version", Py_T_STRING, offsetof(PreviousDBVersion, name), Py_READONLY},
|
||||
|
@ -1591,14 +1593,14 @@ static PyMethodDef unicodedata_functions[] = {
|
|||
};
|
||||
|
||||
static int
|
||||
ucd_traverse(PreviousDBVersion *self, visitproc visit, void *arg)
|
||||
ucd_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ucd_dealloc(PreviousDBVersion *self)
|
||||
ucd_dealloc(PyObject *self)
|
||||
{
|
||||
PyTypeObject *tp = Py_TYPE(self);
|
||||
PyObject_GC_UnTrack(self);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue