{"action":"closed","issue":{"url":"https://api.github.com/repos/h5py/h5py/issues/534","repository_url":"https://api.github.com/repos/h5py/h5py","labels_url":"https://api.github.com/repos/h5py/h5py/issues/534/labels{/name}","comments_url":"https://api.github.com/repos/h5py/h5py/issues/534/comments","events_url":"https://api.github.com/repos/h5py/h5py/issues/534/events","html_url":"https://github.com/h5py/h5py/issues/534","id":54467348,"number":534,"title":"SystemError with custom destructor and python3.4","user":{"login":"Xarthisius","id":352673,"avatar_url":"https://avatars.githubusercontent.com/u/352673?v=3","gravatar_id":"","url":"https://api.github.com/users/Xarthisius","html_url":"https://github.com/Xarthisius","followers_url":"https://api.github.com/users/Xarthisius/followers","following_url":"https://api.github.com/users/Xarthisius/following{/other_user}","gists_url":"https://api.github.com/users/Xarthisius/gists{/gist_id}","starred_url":"https://api.github.com/users/Xarthisius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xarthisius/subscriptions","organizations_url":"https://api.github.com/users/Xarthisius/orgs","repos_url":"https://api.github.com/users/Xarthisius/repos","events_url":"https://api.github.com/users/Xarthisius/events{/privacy}","received_events_url":"https://api.github.com/users/Xarthisius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/h5py/h5py/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/h5py/h5py/labels/no-action-taken","name":"no-action-taken","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-15T16:09:31Z","updated_at":"2016-02-10T04:07:07Z","closed_at":"2016-02-10T04:07:07Z","body":"I'm not quite sure it's a *bug* in h5py, but I hope you'll help me with your expertise. Following code\r\n```\r\nimport h5py\r\n\r\nclass HDF5FileHandler(object):\r\n    handle = None\r\n    def __init__(self, filename):\r\n        self.handle = h5py.File(filename, 'r')\r\n\r\n    def __del__(self):\r\n        if self.handle is not None:\r\n            self.handle.close()\r\n\r\n\r\na = HDF5FileHandler(\"/home/xarth/test.h5\")\r\n```\r\nwith *h5py-2.4.0* and *python3.4* yields:\r\n```\r\nException ignored in: <bound method HDF5FileHandler.__del__ of <__main__.HDF5FileHandler object at 0x7fdfe25ec240>>\r\nTraceback (most recent call last):\r\n  File \"h.py\", line 10, in __del__\r\n  File \"/usr/lib64/python3.4/site-packages/h5py/_hl/files.py\", line 243, in close\r\n  File \"h5py/_objects.pyx\", line 54, in h5py._objects.with_phil.wrapper (/var/tmp/portage/dev-python/h5py-2.4.0/work/h5py-2.4.0/h5py/_objects.c:2705)\r\n  File \"h5py/_objects.pyx\", line 55, in h5py._objects.with_phil.wrapper (/var/tmp/portage/dev-python/h5py-2.4.0/work/h5py-2.4.0/h5py/_objects.c:2662)\r\n  File \"h5py/h5f.pyx\", line 230, in h5py.h5f.get_obj_ids (/var/tmp/portage/dev-python/h5py-2.4.0/work/h5py-2.4.0/h5py/h5f.c:3401)\r\n  File \"h5py/h5i.pyx\", line 37, in h5py.h5i.wrap_identifier (/var/tmp/portage/dev-python/h5py-2.4.0/work/h5py-2.4.0/h5py/h5i.c:1112)\r\nSystemError: Parent module 'h5py' not loaded, cannot perform relative import\r\n```\r\nThat only happens when file handle is closed by garbage collector. Is there anything particularly wrong with `HDF5FileHandler.__del__`? Could it be mitigated somehow in a way that would be backward compatible with python2.7 and previous versions of h5py?"}}