diff options
Diffstat (limited to 'numpy/core/src/arraymethods.c')
-rw-r--r-- | numpy/core/src/arraymethods.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c index c01d3db4b..e13061a4e 100644 --- a/numpy/core/src/arraymethods.c +++ b/numpy/core/src/arraymethods.c @@ -440,16 +440,14 @@ array_tofile(PyArrayObject *self, PyObject *args, PyObject *kwds) FILE *fd; char *sep=""; char *format=""; - char *mode=""; static char *kwlist[] = {"file", "sep", "format", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ss", kwlist, &file, &sep, &format)) return NULL; if (PyString_Check(file)) { - if (sep == "") mode="wb"; - else mode="w"; - file = PyFile_FromString(PyString_AS_STRING(file), mode); + file = PyObject_CallFunction((PyObject *)&PyFile_Type, + "Os", file, "wb"); if (file==NULL) return NULL; } else { |