diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-03-22 15:20:14 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-05 17:53:15 +0200 |
commit | 8ecb8a909ecde13f179b8fce170582e47373f50c (patch) | |
tree | 8aad5ec03932a4876a1302f441759131f342c314 | |
parent | c7d0c7c5ce00a37461908dd9329aa563cd146b1e (diff) |
shiboken6: Test nullptr_t
Testing the support introduced by
3c2ef04c9eade4226f139064c6c45cb4819834e0.
Task-number: PYSIDE-854
Change-Id: I2d7276baf2c81e24f3f7389448352541a78e18bd
Reviewed-by: Christian Tismer <tismer@stackless.com>
5 files changed, 15 insertions, 0 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 816230475..e353aa5d8 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -231,6 +231,7 @@ type_map.update({ "List": ArrayLikeVariable, "Optional": typing.Optional, "long": int, + "long long": int, "nullptr": None, "PyCallable": typing.Callable, "PyObject": object, @@ -285,6 +286,7 @@ type_map.update({ "signed long": int, "std.list": typing.List, "std.map": typing.Dict, + "std.nullptr_t": NoneType, "std.pair": typing.Tuple, "std.string": str, "std.wstring": str, diff --git a/sources/shiboken6/tests/libsample/functions.cpp b/sources/shiboken6/tests/libsample/functions.cpp index ffa3722b7..7aca16250 100644 --- a/sources/shiboken6/tests/libsample/functions.cpp +++ b/sources/shiboken6/tests/libsample/functions.cpp @@ -263,3 +263,8 @@ std::wstring addStdWStrings(const std::wstring &s1, const std::wstring &s2) { return s1 + s2; } + +void testNullPtrT(std::nullptr_t t) +{ + cout << __FUNCTION__ << ' ' << t << '\n'; +} diff --git a/sources/shiboken6/tests/libsample/functions.h b/sources/shiboken6/tests/libsample/functions.h index 46ccd196c..273809d6c 100644 --- a/sources/shiboken6/tests/libsample/functions.h +++ b/sources/shiboken6/tests/libsample/functions.h @@ -89,6 +89,8 @@ LIBSAMPLE_API double sumDoubleMatrix(double m[2][3]); LIBSAMPLE_API std::string addStdStrings(const std::string &s1, const std::string &s2); LIBSAMPLE_API std::wstring addStdWStrings(const std::wstring &s1, const std::wstring &s2); +LIBSAMPLE_API void testNullPtrT(std::nullptr_t); + class LIBSAMPLE_API ArrayModifyTest { public: diff --git a/sources/shiboken6/tests/samplebinding/sample_test.py b/sources/shiboken6/tests/samplebinding/sample_test.py index 660a3cd3d..d3ae4e867 100644 --- a/sources/shiboken6/tests/samplebinding/sample_test.py +++ b/sources/shiboken6/tests/samplebinding/sample_test.py @@ -96,6 +96,10 @@ class ModuleTest(unittest.TestCase): self.assertEqual(sample.addStdStrings(t1, t1), expected) self.assertEqual(sample.addStdWStrings(t1, t1), expected) + def testNullPtrT(self): + sample.testNullPtrT(None) + self.assertRaises(TypeError, sample.testNullPtrT, 42) + if __name__ == '__main__': unittest.main() diff --git a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml index 8891efdf6..7484a43f0 100644 --- a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml +++ b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml @@ -4,6 +4,7 @@ <suppress-warning text="Duplicate type entry: 'SampleNamespace'" /> <primitive-type name="ObjectType::Identifier"/> + <primitive-type name="std::nullptr_t"/> <primitive-type name="Foo::HANDLE" target-lang-api-name="PyLong"/> @@ -413,6 +414,7 @@ <function signature="overloadedFunc(int)" /> <function signature="addStdStrings(const std::string&, const std::string&)"/> <function signature="addStdWStrings(const std::wstring&, const std::wstring&)"/> + <function signature="testNullPtrT(std::nullptr_t)"/> <value-type name="ArrayModifyTest"> <modify-function signature="sumIntArray(int, int*)"> |