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/iobase.c b/Modules/_io/iobase.c
index 38080f7..bd6cd5f 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -455,7 +455,7 @@
     PyObject *buffer, *result;
     Py_ssize_t old_size = -1;
 
-    if (!PyArg_ParseTuple(args, "|n:readline", &limit)) {
+    if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) {
         return NULL;
     }
 
@@ -579,14 +579,9 @@
     Py_ssize_t hint = -1, length = 0;
     PyObject *hintobj = Py_None, *result;
 
-    if (!PyArg_ParseTuple(args, "|O:readlines", &hintobj)) {
+    if (!PyArg_ParseTuple(args, "|O&:readlines", &_PyIO_ConvertSsize_t, &hint)) {
         return NULL;
     }
-    if (hintobj != Py_None) {
-        hint = PyNumber_AsSsize_t(hintobj, PyExc_ValueError);
-        if (hint == -1 && PyErr_Occurred())
-            return NULL;
-    }
 
     result = PyList_New(0);
     if (result == NULL)