Skip to content

Commit

Permalink
Merge pull request #1883 from takluyver/add-bug-scripts
Browse files Browse the repository at this point in the history
Add bug demo scripts
  • Loading branch information
tacaswell committed Apr 28, 2021
2 parents de76734 + c172d01 commit 71a82d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 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)
4 changes: 2 additions & 2 deletions other/vlen_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def make_data(kind):
if kind is bytes:
s = b"xx"
else:
s = b"xx".decode('utf8')
s = "xx"

dt = h5py.vlen_dtype(kind)
data = np.array([s*100 for idx in range(1000)])
Expand Down Expand Up @@ -80,6 +80,6 @@ def attr_leak():
ds_leak()
print("Unicode test")
print("============")
make_data(unicode)
make_data(str)
attr_leak()
ds_leak()

0 comments on commit 71a82d9

Please sign in to comment.