Skip to content

Commit 27f81e8

Browse files
authored
gh-111178: fix UBSan failures for PyStdPrinter_Object (#131607)
1 parent f65be09 commit 27f81e8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Objects/fileobject.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -404,27 +404,27 @@ static PyMethodDef stdprinter_methods[] = {
404404
};
405405

406406
static PyObject *
407-
get_closed(PyStdPrinter_Object *self, void *closure)
407+
get_closed(PyObject *self, void *Py_UNUSED(closure))
408408
{
409409
Py_RETURN_FALSE;
410410
}
411411

412412
static PyObject *
413-
get_mode(PyStdPrinter_Object *self, void *closure)
413+
get_mode(PyObject *self, void *Py_UNUSED(closure))
414414
{
415415
return PyUnicode_FromString("w");
416416
}
417417

418418
static PyObject *
419-
get_encoding(PyStdPrinter_Object *self, void *closure)
419+
get_encoding(PyObject *self, void *Py_UNUSED(closure))
420420
{
421421
Py_RETURN_NONE;
422422
}
423423

424424
static PyGetSetDef stdprinter_getsetlist[] = {
425-
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
426-
{"encoding", (getter)get_encoding, NULL, "Encoding of the file"},
427-
{"mode", (getter)get_mode, NULL, "String giving the file mode"},
425+
{"closed", get_closed, NULL, "True if the file is closed"},
426+
{"encoding", get_encoding, NULL, "Encoding of the file"},
427+
{"mode", get_mode, NULL, "String giving the file mode"},
428428
{0},
429429
};
430430

0 commit comments

Comments
 (0)