diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-12-19 11:35:22 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-12-21 18:20:25 +0000 |
commit | 2f4bfa56e7e1263dd160ceaadd06f41614c997d8 (patch) | |
tree | bc6d7f483f325e14add29dff040512f2bc2c6b8a /sources/shiboken2/libshiboken | |
parent | 44184b76ea3c8edd827d380e156131648444baec (diff) |
libshiboken: Recover from numpy import failures
Clear the Python error on failure. Note that PyErr_Occurred() is not
set for some reason in that case.
Task-number: PYSIDE-580
Change-Id: I5672b9f5bf98e3d409abb4132f2face060826a0a
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r-- | sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp index e941fbe26..97eab2205 100644 --- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp +++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp @@ -270,11 +270,11 @@ void initNumPyArrayConverters() // Make sure to read about the magic defines PY_ARRAY_UNIQUE_SYMBOL etc., // when changing this or spreading the code over several source files. if (_import_array() < 0) { - PyErr_Print(); - PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); + if (debugNumPy) + PyErr_Print(); + PyErr_Clear(); return; } - // Extend the converters for primitive types by NumPy ones. extendArrayConverter1<short, NPY_SHORT>(); extendArrayConverter2<short, NPY_SHORT>(); |