mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-111178: fix UBSan failures in Modules/curses*.c
(GH-128244)
* fix UBSan failures in `_cursesmodule.c` * fix UBSan failures in `_curses_panel.c` * suppress an unused return value
This commit is contained in:
parent
8522f8bacb
commit
621d4ff35e
2 changed files with 114 additions and 71 deletions
|
@ -62,7 +62,7 @@ _curses_panel_traverse(PyObject *mod, visitproc visit, void *arg)
|
|||
static void
|
||||
_curses_panel_free(void *mod)
|
||||
{
|
||||
_curses_panel_clear((PyObject *) mod);
|
||||
(void)_curses_panel_clear((PyObject *)mod);
|
||||
}
|
||||
|
||||
/* Utility Functions */
|
||||
|
@ -101,6 +101,8 @@ typedef struct {
|
|||
PyCursesWindowObject *wo; /* for reference counts */
|
||||
} PyCursesPanelObject;
|
||||
|
||||
#define _PyCursesPanelObject_CAST(op) ((PyCursesPanelObject *)(op))
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
this window from under our feet we need to keep track of references
|
||||
|
@ -277,9 +279,10 @@ PyCursesPanel_New(_curses_panel_state *state, PANEL *pan,
|
|||
}
|
||||
|
||||
static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
PyCursesPanel_Dealloc(PyObject *self)
|
||||
{
|
||||
PyObject *tp, *obj;
|
||||
PyCursesPanelObject *po = _PyCursesPanelObject_CAST(self);
|
||||
|
||||
tp = (PyObject *) Py_TYPE(po);
|
||||
obj = (PyObject *) panel_userptr(po->pan);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue