Issue #17401: Output the closefd attribute as boolean.
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 5c1316e..80af83a 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -1055,13 +1055,13 @@
else
return NULL;
res = PyUnicode_FromFormat(
- "<_io.FileIO fd=%d mode='%s' closefd='%d'>",
- self->fd, mode_string(self), self->closefd);
+ "<_io.FileIO fd=%d mode='%s' closefd=%s>",
+ self->fd, mode_string(self), self->closefd ? "True" : "False");
}
else {
res = PyUnicode_FromFormat(
- "<_io.FileIO name=%R mode='%s' closefd='%d'>",
- nameobj, mode_string(self), self->closefd);
+ "<_io.FileIO name=%R mode='%s' closefd=%s>",
+ nameobj, mode_string(self), self->closefd ? "True" : "False");
Py_DECREF(nameobj);
}
return res;