{"push_id":1058788641,"size":2,"distinct_size":2,"ref":"refs/heads/with_USBContext","head":"4ed3869a4746fc38417dddac6da1b76b84b0644a","before":"9037dc55af28b6ce6e817f60e97d2dbe2fef4999","commits":[{"sha":"d5e46d6b3785ca3add4547ff46164d1f2f8ceb99","author":{"email":"79ed65387ffcd88b36f0a80b55bba4063084e90e@gmail.com","name":"Vincent Pelletier"},"message":".travis.yml: Update.\n\nSources need autoconf 2.69 or higher, so request \"trusty\" instance. For some\nreason, one has to require sudo to get that version...\nAlso, 1.0.20 was released, test with it.","distinct":true,"url":"https://api.github.com/repos/vpelletier/python-libusb1/commits/d5e46d6b3785ca3add4547ff46164d1f2f8ceb99"},{"sha":"4ed3869a4746fc38417dddac6da1b76b84b0644a","author":{"email":"79ed65387ffcd88b36f0a80b55bba4063084e90e@gmail.com","name":"Vincent Pelletier"},"message":"USBContext: Become a context manager.\n\n__del__ methods in python 3 (3.5 at least) do not necessarily follow\nobject cross-reference tree, even without cycle, on interpreter shutdown:\n  $ python3\n  Python 3.5.1+ (default, Mar 30 2016, 22:46:26)\n  [GCC 5.3.1 20160323] on linux\n  Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n  >>> class A(object):\n  ...   def __del__(self):\n  ...     print(self.__dict__)\n  ...\n  >>> a = A()\n  >>> b = A()\n  >>> a.b = b\n  >>> ^D\n  {}\n  {'b': <__main__.A object at 0x7f3e85a5c6a0>}\nNote that \"b.__del__()\" (with empty dict) happens before \"a.__del__()\"\n(the dict with key \"b\").\nThe alternative is to encourage users to use USBContext as a context\nmanager (this is an unintended name coincidence...), which can then\ninternally tell all related instances to trigger de-allocations inside\nlibusb level during __exit__, well before interpreter shutdown.\nDo not get rid of __del__ methods, as (for example) an USBTransfer may\nstill legitimately be garbage-collected while its parent instances (\nUSBDeviceHandle, USBDevice, USBContext) survive.\nPreserve backward-compatibility, but add a warning.\n\nUpdate examples and tests.","distinct":true,"url":"https://api.github.com/repos/vpelletier/python-libusb1/commits/4ed3869a4746fc38417dddac6da1b76b84b0644a"}]}