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/textio.c b/Modules/_io/textio.c
index 2f99a60..91fecae 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1455,7 +1455,7 @@
CHECK_INITIALIZED(self);
- if (!PyArg_ParseTuple(args, "|n:read", &n))
+ if (!PyArg_ParseTuple(args, "|O&:read", &_PyIO_ConvertSsize_t, &n))
return NULL;
CHECK_CLOSED(self);