Skip to content

Commit daa4f8b

Browse files
committed
Merge pull request #706 from izaid/id
Updates to match libdynd
2 parents 6b8f55b + 37cec18 commit daa4f8b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

dynd/include/types/pyobject_type.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
#include <dynd/types/base_type.hpp>
1111

12-
extern const dynd::type_id_t pyobject_id;
13-
1412
class PYDYND_API pyobject_type : public dynd::ndt::base_type {
1513
public:
1614
pyobject_type(dynd::type_id_t new_id);
@@ -29,5 +27,10 @@ namespace ndt {
2927
static type equivalent() { return make_type<pyobject_type>(); }
3028
};
3129

30+
template <>
31+
struct id_of<pyobject_type> {
32+
static const type_id_t value;
33+
};
34+
3235
} // namespace dynd::ndt
3336
} // namespace dynd

dynd/src/types/pyobject_type.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111

1212
using namespace dynd;
1313

14-
const type_id_t pyobject_id = new_id("pyobject", any_kind_id);
15-
1614
pyobject_type::pyobject_type(type_id_t new_id)
17-
: ndt::base_type(new_id, pyobject_id, sizeof(PyObject *), alignof(PyObject *), type_flag_none | type_flag_zeroinit,
18-
0, 0, 0)
15+
: ndt::base_type(new_id, ndt::id_of<pyobject_type>::value, sizeof(PyObject *), alignof(PyObject *),
16+
type_flag_none | type_flag_zeroinit, 0, 0, 0)
1917
{
2018
}
2119

@@ -33,3 +31,5 @@ void pyobject_type::print_data(std::ostream &o, const char *arrmeta, const char
3331
#endif
3432
Py_DECREF(repr);
3533
}
34+
35+
const type_id_t ndt::id_of<pyobject_type>::value = new_id("pyobject", any_kind_id);

0 commit comments

Comments
 (0)