Skip to content

Commit 10627f6

Browse files
committed
Slightly API-breaking.. need to del everything
1 parent ad5f69d commit 10627f6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/binding/python/Series.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,5 +647,18 @@ users to overwrite default options, while keeping any other ones.
647647
py::arg("comm"),
648648
docs_merge_json)
649649
#endif
650-
;
650+
.def("__del__", [](Series &s) {
651+
try
652+
{
653+
s.close();
654+
}
655+
catch (std::exception const &e)
656+
{
657+
std::cerr << "Error during close: " << e.what() << std::endl;
658+
}
659+
catch (...)
660+
{
661+
std::cerr << "Unknown error during close." << std::endl;
662+
}
663+
});
651664
}

test/python/unittest/API/APITest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,9 @@ def makeAvailableChunksRoundTrip(self, ext):
20262026
# Cleaner: write.close()
20272027
# But let's keep this instance to test that that workflow stays
20282028
# functional.
2029+
# Need to delete everything as garbage collection will keep `write`
2030+
# alive as long as E_x is around.
2031+
del E_x
20292032
del write
20302033

20312034
read = io.Series(

0 commit comments

Comments
 (0)