Skip to content

Commit

Permalink
MFIter: Finalize() on StopIteration
Browse files Browse the repository at this point in the history
Since `for` loops create no scope in Python, we need to trigger
finalize logic, including stream syncs, before the destructor of
`MultiFab` iterators are called.
  • Loading branch information
ax3l committed Oct 14, 2022
1 parent 978f696 commit a7fc736
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Base/MultiFab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void init_MultiFab(py::module &m) {
if( !mfi.isValid() )
{
first_or_done = true;
mfi.Finalize();
throw py::stop_iteration();
}
return mfi;
Expand Down

0 comments on commit a7fc736

Please sign in to comment.