Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
6f588fa2
Verified
Commit
6f588fa2
authored
Jul 17, 2021
by
Justin Carpentier
Browse files
user types: given type should inherit from np.generic
parent
9154c86d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/register.cpp
View file @
6f588fa2
/*
* Copyright 2020 INRIA
* Copyright 2020
-2021
INRIA
*/
#include
"eigenpy/register.hpp"
...
...
@@ -43,6 +43,20 @@ namespace eigenpy
PyArray_CopySwapNFunc
*
copyswapn
,
PyArray_DotFunc
*
dotfunc
)
{
namespace
bp
=
boost
::
python
;
bp
::
list
bases
(
bp
::
handle
<>
(
bp
::
borrowed
(
py_type_ptr
->
tp_bases
)));
bases
.
append
((
bp
::
handle
<>
(
bp
::
borrowed
(
&
PyGenericArrType_Type
))));
bp
::
tuple
tp_bases_extended
(
bases
);
Py_INCREF
(
tp_bases_extended
.
ptr
());
py_type_ptr
->
tp_bases
=
tp_bases_extended
.
ptr
();
py_type_ptr
->
tp_flags
&=
~
Py_TPFLAGS_READY
;
// to force the rebuild
if
(
PyType_Ready
(
py_type_ptr
)
<
0
)
// Force rebuilding of the __bases__ and mro
{
throw
std
::
invalid_argument
(
"PyType_Ready fails to initialize input type."
);
}
PyArray_Descr
*
descr_ptr
=
new
PyArray_Descr
(
*
call_PyArray_DescrFromType
(
NPY_OBJECT
));
PyArray_Descr
&
descr
=
*
descr_ptr
;
descr
.
typeobj
=
py_type_ptr
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment