10000 gh-111178: fix UBSan failures in `Modules/_tkinter.c` by picnixz · Pull Request #129795 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111178: fix UBSan failures in Modules/_tkinter.c #129795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 26, 2025
Prev Previous commit
Next Next commit
remove unused TkttObject_FAST_CAST macro
  • Loading branch information
picnixz committed Feb 25, 2025
commit 08efc4c3f260f100673d3eee174656d3b11d88d0
5 changes: 3 additions & 2 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ typedef struct {
PyObject *string; /* This cannot cause cycles. */
} PyTclObject;

// TODO(picnixz): maybe assert that 'op' is really a PyTclObject (we might want
// to also add a FAST_CAST macro to bypass the check if needed).
#define PyTclObject_CAST(op) ((PyTclObject *)(op))

static PyObject *PyTclObject_Type;
Expand Down Expand Up @@ -2698,9 +2700,8 @@ typedef struct {
PyObject *func;
} TkttObject;

#define TkttObject_FAST_CAST(op) ((TkttObject *)(op))
#define TkttObject_CAST(op) \
(assert(TkttObject_Check(op)), TkttObject_FAST_CAST(op))
(assert(TkttObject_Check(op)), ((TkttObject *)(op)))

/*[clinic input]
_tkinter.tktimertoken.deletetimerhandler
Expand Down
0