diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-03-06 23:59:22 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-03-06 23:59:22 +0000 |
commit | 80f6b2a2ceb7981c292fd3071f5d2eba1c9866ab (patch) | |
tree | 60c0854439c86c7169cc16362b32640f5c6a9275 /numpy | |
parent | 4c1ae336a15e4f701848fac12a521ba67bf784d3 (diff) | |
download | numpy-80f6b2a2ceb7981c292fd3071f5d2eba1c9866ab.tar.gz |
BUG: f2py: fix infinite loops in *_from_pyobj with unicode input
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/f2py/cfuncs.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 45f622700..74a0ab363 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -689,7 +689,7 @@ static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { \t} \tif (PyComplex_Check(obj)) \t\ttmp = PyObject_GetAttrString(obj,\"real\"); -\telse if (PyString_Check(obj)) +\telse if (PyString_Check(obj) || PyUnicode_Check(obj)) \t\t/*pass*/; \telse if (PySequence_Check(obj)) \t\ttmp = PySequence_GetItem(obj,0); @@ -721,7 +721,7 @@ static int long_from_pyobj(long* v,PyObject *obj,const char *errmess) { \t} \tif (PyComplex_Check(obj)) \t\ttmp = PyObject_GetAttrString(obj,\"real\"); -\telse if (PyString_Check(obj)) +\telse if (PyString_Check(obj) || PyUnicode_Check(obj)) \t\t/*pass*/; \telse if (PySequence_Check(obj)) \t\ttmp = PySequence_GetItem(obj,0); @@ -758,7 +758,7 @@ static int long_long_from_pyobj(long_long* v,PyObject *obj,const char *errmess) \t} \tif (PyComplex_Check(obj)) \t\ttmp = PyObject_GetAttrString(obj,\"real\"); -\telse if (PyString_Check(obj)) +\telse if (PyString_Check(obj) || PyUnicode_Check(obj)) \t\t/*pass*/; \telse if (PySequence_Check(obj)) \t\ttmp = PySequence_GetItem(obj,0); @@ -819,7 +819,7 @@ static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { \t} \tif (PyComplex_Check(obj)) \t\ttmp = PyObject_GetAttrString(obj,\"real\"); -\telse if (PyString_Check(obj)) +\telse if (PyString_Check(obj) || PyUnicode_Check(obj)) \t\t/*pass*/; \telse if (PySequence_Check(obj)) \t\ttmp = PySequence_GetItem(obj,0); @@ -929,7 +929,7 @@ static int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char \t\t(*v).r = PyLong_AsDouble(obj); \t\treturn (!PyErr_Occurred()); \t} -\tif (PySequence_Check(obj) && (!PyString_Check(obj))) { +\tif (PySequence_Check(obj) && !(PyString_Check(obj) || PyUnicode_Check(obj))) { \t\tPyObject *tmp = PySequence_GetItem(obj,0); \t\tif (tmp) { \t\t\tif (complex_double_from_pyobj(v,tmp,errmess)) { |