Merge branch 'std_exception_inv_arg' into 'master'

use std invalid argument instead of Exception in py constructor

See merge request ngsolve/netgen!685
This commit is contained in:
Schöberl, Joachim 2024-11-05 11:00:48 +01:00
commit ddf64c8250

View File

@ -167,12 +167,9 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
py::class_<gp_Pnt2d>(m, "gp_Pnt2d", "2d OCC point")
.def(py::init([] (py::tuple pnt)
.def(py::init([] (std::tuple<double,double> pnt)
{
if (py::len(pnt) != 2)
throw Exception("need 2-tuple to create gp_Pnt2d");
return gp_Pnt2d(py::cast<double>(pnt[0]),
py::cast<double>(pnt[1]));
return gp_Pnt2d(get<0>(pnt), get<1>(pnt));
}))
.def(py::init([] (double x, double y) {
return gp_Pnt2d(x, y);