accept None as the same as having passed no argument in file types #7349
This is for consistency with imitation file objects like StringIO and BytesIO.
This commit also adds a few tests, where they were lacking for concerned
methods.
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index e98de9e..164fe5b 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -599,7 +599,7 @@
if (!self->readable)
return err_mode("reading");
- if (!PyArg_ParseTuple(args, "|n", &size))
+ if (!PyArg_ParseTuple(args, "|O&", &_PyIO_ConvertSsize_t, &size))
return NULL;
if (size < 0) {