summaryrefslogtreecommitdiffstats
path: root/Modules/_fileio.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-24 00:50:02 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-24 00:50:02 (GMT)
commitc2f93dc2e42b48a20578599407b0bb51a6663d09 (patch)
treea13677daceceb29f55a468cac3874e1a757dccc9 /Modules/_fileio.c
parentd8595fe304c3d9bb15ad59b1db0b71a2b7ab3c54 (diff)
downloadcpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.zip
cpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.tar.gz
cpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.tar.bz2
Remove native popen() and fdopen(), replacing them with subprocess calls.
Fix a path to an assert in fileio_read(). Some misc tweaks.
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r--Modules/_fileio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 2bda155..c46f17e 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -375,6 +375,12 @@ fileio_read(PyFileIOObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i", &size))
return NULL;
+ if (size < 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "negative read count");
+ return NULL;
+ }
+
bytes = PyBytes_FromStringAndSize(NULL, size);
if (bytes == NULL)
return NULL;