diff --git a/django/contrib/gis/geos/prototypes/errcheck.py b/django/contrib/gis/geos/prototypes/errcheck.py
index c5037c1..2af3dc4 100644
a
|
b
|
|
3 | 3 | """ |
4 | 4 | from ctypes import c_void_p, string_at, CDLL |
5 | 5 | from django.contrib.gis.geos.error import GEOSException |
6 | | from django.contrib.gis.geos.libgeos import lgeos, GEOS_VERSION |
| 6 | from django.contrib.gis.geos.libgeos import lgeos |
7 | 7 | |
8 | 8 | # Getting the `free` routine used to free the memory allocated for |
9 | 9 | # string pointers returned by GEOS. |
10 | | if GEOS_VERSION >= (3, 1, 0): |
11 | | # In versions 3.1 and above, `GEOSFree` was added to the C API |
| 10 | try: |
| 11 | # In versions 3.1.1 and above, `GEOSFree` was added to the C API |
12 | 12 | # because `free` isn't always available on all platforms. |
13 | 13 | free = lgeos.GEOSFree |
14 | | free.argtypes = [c_void_p] |
15 | | free.restype = None |
16 | | else: |
| 14 | except AttributeError: |
17 | 15 | # Getting the `free` routine from the C library of the platform. |
18 | 16 | # The C library is obtained by passing None into `CDLL`. |
19 | 17 | libc = CDLL(None) |
20 | 18 | free = libc.free |
| 19 | else: |
| 20 | free.argtypes = [c_void_p] |
| 21 | free.restype = None |
21 | 22 | |
22 | 23 | ### ctypes error checking routines ### |
23 | 24 | def last_arg_byref(args): |