1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

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.
This commit is contained in:
Claude Paroz 2013-02-15 17:12:14 +01:00
parent b19d83fc12
commit 35185495e3

View File

@ -125,6 +125,8 @@ class GeoIP(object):
def __del__(self): def __del__(self):
# Cleaning any GeoIP file handles lying around. # Cleaning any GeoIP file handles lying around.
if GeoIP_delete is None:
return
if self._country: GeoIP_delete(self._country) if self._country: GeoIP_delete(self._country)
if self._city: GeoIP_delete(self._city) if self._city: GeoIP_delete(self._city)