diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-15 18:46:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-15 21:18:43 +0200 |
commit | b4547b8a80d33fef1823f93a14a13ee78ed1bde9 (patch) | |
tree | 855ccefd204a1e5c89f3c397c0a0095a724fbdc7 | |
parent | cf0c2ffaea95bc7ab332c98e8d2491e7152904e9 (diff) |
shiboken6: Enable adding functions taking a numpy PyArrayObject
Add the correct check function for a numpy PyArrayObject.
Task-number: PYSIDE-1540
Task-number: PYSIDE-1503
Change-Id: If7b25808edb65553fc0ee54ddf1532fe2d3c2272
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/shiboken6/generator/shiboken/pytypenames.h | 3 | ||||
-rw-r--r-- | sources/shiboken6/generator/shiboken/shibokengenerator.cpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/pytypenames.h b/sources/shiboken6/generator/shiboken/pytypenames.h index 7dd5f8aee..779f67f2f 100644 --- a/sources/shiboken6/generator/shiboken/pytypenames.h +++ b/sources/shiboken6/generator/shiboken/pytypenames.h @@ -44,6 +44,9 @@ static inline QString cPyObjectT() { return QStringLiteral("PyObject"); } static inline QString cPySequenceT() { return QStringLiteral("PySequence"); } static inline QString cPyTypeObjectT() { return QStringLiteral("PyTypeObject"); } +// numpy +static inline QString cPyArrayObjectT() { return QStringLiteral("PyArrayObject"); } + static inline QString sbkCharT() { return QStringLiteral("SbkChar"); } #endif // PYTYPENAMES_H diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index 75b3fe890..05a9e7571 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -1121,6 +1121,9 @@ ShibokenGenerator::CPythonCheckFunctionResult if (type == pyStrT()) return {QLatin1String("Shiboken::String::check"), {}}; + if (type == cPyArrayObjectT()) + return {QLatin1String("PyArray_Check"), {}}; + CPythonCheckFunctionResult result; result.type = buildAbstractMetaTypeFromString(type); if (!result.type.has_value() || result.type->typeEntry()->isCustom()) |