diff --git a/dpctl/apis/include/dpctl4pybind11.hpp b/dpctl/apis/include/dpctl4pybind11.hpp index eb563b3f84..80d01af721 100644 --- a/dpctl/apis/include/dpctl4pybind11.hpp +++ b/dpctl/apis/include/dpctl4pybind11.hpp @@ -55,8 +55,12 @@ template <> struct type_caster 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"); } } @@ -87,8 +91,12 @@ template <> struct type_caster 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"); } } @@ -120,7 +128,7 @@ template <> struct type_caster return true; } else { - throw std::runtime_error( + throw py::type_error( "Input is of unexpected type, expected dpctl.SyclContext"); } } @@ -153,7 +161,7 @@ template <> struct type_caster return true; } else { - throw std::runtime_error( + throw py::type_error( "Input is of unexpected type, expected dpctl.SyclEvent"); } }