-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.