Last active
December 21, 2015 21:59
-
-
Save tobych/6372218 to your computer and use it in GitHub Desktop.
Monkey patch to work around Django #13843
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/tobych/6372218 | |
# Monkey patch to work around https://code.djangoproject.com/ticket/13843 | |
import django | |
from functools import wraps | |
def discard_exceptions(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): | |
try: | |
f(*args, **kwds) | |
except (AttributeError, TypeError): | |
pass | |
return wrapper | |
django.contrib.gis.geos.prototypes.threadsafe.GEOSContextHandle.__del__ = discard_exceptions(django.contrib.gis.geos.prototypes.threadsafe.GEOSContextHandle.__del__) | |
django.contrib.gis.geos.prototypes.io.IOBase.__del__ = discard_exceptions(django.contrib.gis.geos.prototypes.io.IOBase.__del__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment