Skip to content

Commit

Permalink
Add script demonstrating issue h5pygh-1495
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Apr 27, 2021
1 parent de76734 commit a468de1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions other/unterm-generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Demonstrated an error garbage collecting an h5py object at Python shutdown
https://github.com/h5py/h5py/issues/1495
"""

import h5py

def yield_groups(filename):
with h5py.File(filename, 'r') as fh:
for group in fh:
yield group

filename = "file_with_10_groups.hdf5"
grp_generator = yield_groups(filename)
next(grp_generator)

0 comments on commit a468de1

Please sign in to comment.