Skip to content
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
Next Next commit
fix UBSan failures for PyStdPrinter_Object
  • Loading branch information
picnixz committed Mar 20, 2025
commit 660370bbec657e48e375d8e6aa297c02ce750c85
12 changes: 6 additions & 6 deletions Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,27 +404,27 @@ static PyMethodDef stdprinter_methods[] = {
};

static PyObject *
get_closed(PyStdPrinter_Object *self, void *closure)
get_closed(PyObject *self, void *Py_UNUSED(closure))
{
Py_RETURN_FALSE;
}

static PyObject *
get_mode(PyStdPrinter_Object *self, void *closure)
get_mode(PyObject *self, void *Py_UNUSED(closure))
{
return PyUnicode_FromString("w");
}

static PyObject *
get_encoding(PyStdPrinter_Object *self, void *closure)
get_encoding(PyObject *self, void *Py_UNUSED(closure))
{
Py_RETURN_NONE;
}

static PyGetSetDef stdprinter_getsetlist[] = {
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
{"encoding", (getter)get_encoding, NULL, "Encoding of the file"},
{"mode", (getter)get_mode, NULL, "String giving the file mode"},
{"closed", get_closed, NULL, "True if the file is closed"},
{"encoding", get_encoding, NULL, "Encoding of the file"},
{"mode", get_mode, NULL, "String giving the file mode"},
{0},
};

Expand Down
Loading