diff options
author | Michael W. Hudson <mwh@python.net> | 2001-10-31 18:51:01 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2001-10-31 18:51:01 (GMT) |
commit | e2ec3ebcb852923a7ce23122dcd32c341c9416b9 (patch) | |
tree | d007ece748fd93228eff69c331bee3847100d01b | |
parent | 2dab9c7d9b16bb64fb97fb687a87df9d1509c359 (diff) | |
download | cpython-e2ec3ebcb852923a7ce23122dcd32c341c9416b9.zip cpython-e2ec3ebcb852923a7ce23122dcd32c341c9416b9.tar.gz cpython-e2ec3ebcb852923a7ce23122dcd32c341c9416b9.tar.bz2 |
fix for
[ #476557 ] Wrong error message for file.write(a, b)
Makes file.write a METH_VARARGS function.
-rw-r--r-- | Objects/fileobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index cda5ff2..ebccc84 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -1161,7 +1161,7 @@ file_write(PyFileObject *f, PyObject *args) int n, n2; if (f->f_fp == NULL) return err_closed(); - if (!PyArg_Parse(args, f->f_binary ? "s#" : "t#", &s, &n)) + if (!PyArg_ParseTuple(args, f->f_binary ? "s#" : "t#", &s, &n)) return NULL; f->f_softspace = 0; Py_BEGIN_ALLOW_THREADS @@ -1378,7 +1378,7 @@ static char isatty_doc[] = static PyMethodDef file_methods[] = { {"readline", (PyCFunction)file_readline, METH_VARARGS, readline_doc}, {"read", (PyCFunction)file_read, METH_VARARGS, read_doc}, - {"write", (PyCFunction)file_write, METH_OLDARGS, write_doc}, + {"write", (PyCFunction)file_write, METH_VARARGS, write_doc}, {"fileno", (PyCFunction)file_fileno, METH_NOARGS, fileno_doc}, {"seek", (PyCFunction)file_seek, METH_VARARGS, seek_doc}, #ifdef HAVE_FTRUNCATE |