Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions dpctl/apis/include/dpctl4pybind11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ template <> struct type_caster<sycl::queue>
value = *q;
return true;
}
else if (source == Py_None) {
value = sycl::queue{};
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclQueue");
}
}
Expand Down Expand Up @@ -87,8 +91,12 @@ template <> struct type_caster<sycl::device>
value = *d;
return true;
}
else if (source == Py_None) {
value = sycl::device{};
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclDevice");
}
}
Expand Down Expand Up @@ -120,7 +128,7 @@ template <> struct type_caster<sycl::context>
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclContext");
}
}
Expand Down Expand Up @@ -153,7 +161,7 @@ template <> struct type_caster<sycl::event>
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclEvent");
}
}
Expand Down