hercules-team / python-augeas

Python bindings for Augeas
GNU Lesser General Public License v2.1
44 stars 31 forks source link

Added sanity check to avoid an exception when the augeas object is already des... #5

Closed cristobalrosa closed 7 years ago

cristobalrosa commented 10 years ago

...troyed (Exception AttributeError: 'NoneType' object has no attribute '_libaugeas' in <bound method Augeas.del of <augeas.Augeas object at 0xb6f764ac>> ignored)

ThomasWaldmann commented 9 years ago

Could this issue please be fixed ASAP?

I just debugged the same problem because it spills a lot of these exceptions into unit testing logs (at a time when unit tests are finished).

I fixed it slightly differently: in Augeas.close method by adding the upper line:

    if Augeas:
        Augeas._libaugeas.aug_close(self.__handle)

I think my fix is completely harmless as if the if-condition is falsish, the next line would crash anyway.

thedrow commented 7 years ago

Thanks for your contribution but the library was re-written to use CFFI instead of ctypes. The issue in the new version is already fixed.