Commit 35185495 authored by Claude Paroz's avatar Claude Paroz
Browse files

Fixed #17066 -- Prevented TypeError in GeoIP.__del__

When garbaging GeoIP instances, it happens that GeoIP_delete is
already None.
Thanks mitar for the report and stefanw for tests.
parent b19d83fc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,8 @@ class GeoIP(object):

    def __del__(self):
        # Cleaning any GeoIP file handles lying around.
        if GeoIP_delete is None:
            return
        if self._country: GeoIP_delete(self._country)
        if self._city: GeoIP_delete(self._city)