8000 gh-111178: fix UBSan failures in `Python/context.c` by picnixz · Pull Request #128242 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111178: fix UBSan failures in Python/context.c #128242

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 4 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix UBSan failures for _PyContextTokenMissing
  • Loading branch information
picnixz committed Dec 23, 2024
commit 637335d9061d237e2a59e7090daa2ee145bc9d21
11 changes: 3 additions & 8 deletions Python/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,7 @@ class _contextvars.Token "PyContextToken *" "&PyContextToken_Type"
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=338a5e2db13d3f5b]*/


static inline PyContextToken *
_PyContextToken_CAST(PyObject *op)
{
assert(PyObject_TypeCheck(op, &PyContextToken_Type));
return (PyContextToken *)op;
}
#define _PyContextToken_CAST(op) ((PyContextToken *)(op))


static PyObject *
Expand Down Expand Up @@ -1290,7 +1285,7 @@ context_token_missing_tp_repr(PyObject *self)
}

static void
context_token_missing_tp_dealloc(_PyContextTokenMissing *Py_UNUSED(self))
context_token_missing_tp_dealloc(PyObject *Py_UNUSED(self))
{
#ifdef Py_DEBUG
/* The singleton is statically allocated. */
Expand All @@ -1305,7 +1300,7 @@ PyTypeObject _PyContextTokenMissing_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"Token.MISSING",
sizeof(_PyContextTokenMissing),
.tp_dealloc = (destructor)context_token_missing_tp_dealloc,
.tp_dealloc = context_token_missing_tp_dealloc,
.tp_getattro = PyObject_GenericGetAttr,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_repr = context_token_missing_tp_repr,
Expand Down
Loading
0