File tree Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -1428,25 +1428,11 @@ struct npy_format_descriptor<
1428
1428
};
1429
1429
1430
1430
template <typename T>
1431
- struct npy_format_descriptor <T, enable_if_t <is_same_ignoring_cvref<T, PyObject *>::value>> {
1432
- static constexpr auto name = const_name(" object" );
1433
-
1434
- static constexpr int value = npy_api::NPY_OBJECT_;
1435
-
1436
- static pybind11::dtype dtype () { return pybind11::dtype (/* typenum*/ value); }
1437
- };
1438
-
1439
- template <>
1440
- struct npy_format_descriptor <handle, enable_if_t <sizeof (handle) == sizeof (PyObject *)>> {
1441
- static constexpr auto name = const_name(" object" );
1442
-
1443
- static constexpr int value = npy_api::NPY_OBJECT_;
1444
-
1445
- static pybind11::dtype dtype () { return pybind11::dtype (/* typenum*/ value); }
1446
- };
1447
-
1448
- template <>
1449
- struct npy_format_descriptor <object, enable_if_t <sizeof (object) == sizeof (PyObject *)>> {
1431
+ struct npy_format_descriptor <
1432
+ T,
1433
+ enable_if_t <is_same_ignoring_cvref<T, PyObject *>::value
1434
+ || ((std::is_same<T, handle>::value || std::is_same<T, object>::value)
1435
+ && sizeof (T) == sizeof (PyObject *))>> {
1450
1436
static constexpr auto name = const_name(" object" );
1451
1437
1452
1438
static constexpr int value = npy_api::NPY_OBJECT_;
You can’t perform that action at this time.
0 commit comments