Increase reference count also in other load_chunk overload#1225
Conversation
Don't know if it is necessary, but looks like we forgot it earlier
I misunderstood your post, I'll need to have a look where this function is actually called |
|
Yes, I think we don't have a test in We also need to add a |
It seems that this exists already .def(
"load_chunk",
[](RecordComponent &r,
py::buffer buffer,
Offset const &offset_in,
Extent const &extent_in) {
uint8_t ndim = r.getDimensionality();
// default arguments
// offset = {0u}: expand to right dim {0u, 0u, ...}
Offset offset = offset_in;
if (offset_in.size() == 1u && offset_in.at(0) == 0u)
offset = Offset(ndim, 0u);
// extent = {-1u}: take full size
Extent extent(ndim, 1u);
if (extent_in.size() == 1u && extent_in.at(0) == -1u)
{
extent = r.getExtent();
for (uint8_t i = 0u; i < ndim; ++i)
extent[i] -= offset[i];
}
else
extent = extent_in;
std::vector<bool> flatten(ndim, false);
load_chunk(r, buffer, offset, extent);
},
py::arg("pre-allocated buffer"),
py::arg_v(
"offset", Offset(1, 0u), "np.zeros(Record_Component.shape)"),
py::arg_v("extent", Extent(1, -1u), "Record_Component.shape")) |
Don't know if it is necessary, but looks like we forgot it back when we added this reference count trick.
Extracted from #1197.