diff --git a/libsrc/core/python_ngcore.hpp b/libsrc/core/python_ngcore.hpp index 49136e53..b3e428b3 100644 --- a/libsrc/core/python_ngcore.hpp +++ b/libsrc/core/python_ngcore.hpp @@ -50,7 +50,9 @@ namespace ngcore { using TFlat = FlatArray; using TArray = Array; - std::string suffix = std::string(typeid(T).name()) + "_" + typeid(TIND).name(); + std::string suffix = std::string(Demangle(typeid(T).name())) + "_" + Demangle(typeid(TIND).name()); + std::replace(suffix.begin(), suffix.end(), ':', '_'); + std::replace(suffix.begin(), suffix.end(), ' ', '_'); std::string fname = std::string("FlatArray_") + suffix; auto flatarray_class = py::class_(m, fname.c_str(), py::buffer_protocol()) diff --git a/tests/pytest/test_array.py b/tests/pytest/test_array.py index ccd186c1..54c48755 100644 --- a/tests/pytest/test_array.py +++ b/tests/pytest/test_array.py @@ -2,7 +2,7 @@ from pyngcore import * from numpy import sort, array def test_array_numpy(): - a = Array_i_m(5) + a = Array_int_unsigned_long(5) a[:] = 0 a[3:] = 2 assert(sum(a) == 4)