Skip to content

Commit

Permalink
missed a few
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Aug 24, 2024
1 parent 88a0a05 commit b4bc52d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions core/include/core/container_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ namespace scitbx { namespace boost_python { namespace container_conversions {
if (!py_elem_hdl.get()) break; // end of iteration
boost::python::object py_elem_obj(py_elem_hdl);
boost::python::extract<container_element_type> elem_proxy(py_elem_obj);
if (!elem_proxy.check()) {
PyErr_SetString(PyExc_RuntimeError, "Invalid element");
boost::python::throw_error_already_set();
}
ConversionPolicy::set_value(result, i, elem_proxy());
}
ConversionPolicy::assert_size(boost::type<ContainerType>(), i);
Expand Down
13 changes: 9 additions & 4 deletions maps/src/FlatSkyMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,16 @@ flatskymap_setitem_2d(FlatSkyMap &skymap, bp::tuple coords,

FlatSkyMapPtr shallowclone =
boost::dynamic_pointer_cast<FlatSkyMap>(skymap.Clone(false));
FlatSkyMapPtr dummy_subpatch = bp::extract<FlatSkyMapPtr>(
flatskymap_getitem_2d(*shallowclone, coords));
bp::extract<FlatSkyMapPtr> dummyext(flatskymap_getitem_2d(*shallowclone, coords));
if (!dummyext.check()) {
PyErr_SetString(PyExc_ValueError, "Invalid patch");
bp::throw_error_already_set();
}
FlatSkyMapPtr dummy_subpatch = dummyext();

if (bp::extract<FlatSkyMap>(val).check()) {
const FlatSkyMap &patch = bp::extract<FlatSkyMap>(val)();
bp::extract<const FlatSkyMap &> mapext(val);
if (mapext.check()) {
const FlatSkyMap &patch = mapext();
if (!dummy_subpatch->IsCompatible(patch)) {
PyErr_SetString(PyExc_ValueError, "Provided patch to insert is "
"not compatible with the given subregion of the map into "
Expand Down
5 changes: 3 additions & 2 deletions maps/src/maputils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,9 @@ pyconvolve_map(FlatSkyMapConstPtr map, bp::object val)
{

FlatSkyMapConstPtr kernel;
if (bp::extract<FlatSkyMap>(val).check())
kernel = bp::extract<FlatSkyMapConstPtr>(val)();
bp::extract<FlatSkyMapConstPtr> ext(val);
if (ext.check())
kernel = ext();
else
kernel = FlatSkyMapConstPtr(new FlatSkyMap(val, map->yres()));
return ConvolveMap(map, kernel);
Expand Down

0 comments on commit b4bc52d

Please sign in to comment.