Verified Commit 10beaf23 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

user type: add dtype property

parent 6f588fa2
...@@ -82,6 +82,11 @@ namespace eigenpy ...@@ -82,6 +82,11 @@ namespace eigenpy
const int code = call_PyArray_RegisterDataType(descr_ptr); const int code = call_PyArray_RegisterDataType(descr_ptr);
assert(code >= 0 && "The return code should be positive"); assert(code >= 0 && "The return code should be positive");
PyArray_Descr * new_descr = call_PyArray_DescrFromType(code); PyArray_Descr * new_descr = call_PyArray_DescrFromType(code);
if(PyDict_SetItemString(py_type_ptr->tp_dict,"dtype",(PyObject*)descr_ptr) < 0)
{
throw std::invalid_argument("PyDict_SetItemString fails.");
}
instance().type_to_py_type_bindings.insert(std::make_pair(type_info_ptr,py_type_ptr)); instance().type_to_py_type_bindings.insert(std::make_pair(type_info_ptr,py_type_ptr));
instance().py_array_descr_bindings[py_type_ptr] = new_descr; instance().py_array_descr_bindings[py_type_ptr] = new_descr;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment