From 8b7625f14530af84f89bea7c830478c07495c2d5 Mon Sep 17 00:00:00 2001 From: "elias.bachaalany" Date: Mon, 15 Feb 2010 11:58:44 +0000 Subject: [PATCH] qfile_t._from_fp was broken --- swig/fpro.i | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/swig/fpro.i b/swig/fpro.i index 0f47ffe..430226e 100644 --- a/swig/fpro.i +++ b/swig/fpro.i @@ -21,7 +21,7 @@ private: return false; own = false; fn.sprnt("", fp); - fp = fp; + this->fp = fp; return true; } inline void _from_cobject(PyObject *pycobject) @@ -198,9 +198,9 @@ public: //-------------------------------------------------------------------------- int write(PyObject *py_buf) { - size_t sz = PyString_GET_SIZE(py_buf); - void *buf = (void *)PyString_AS_STRING(py_buf); - return qfwrite(fp, buf, sz); + if (!PyString_Check(py_buf)) + return 0; + return qfwrite(fp, (void *)PyString_AS_STRING(py_buf), PyString_GET_SIZE(py_buf)); } //--------------------------------------------------------------------------