Changeset 998
- Timestamp:
- 01/03/08 14:55:22
- Files:
-
- Shapely/trunk/shapely/geometry/base.py (modified) (2 diffs)
- Shapely/trunk/shapely/geos.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Shapely/trunk/shapely/geometry/base.py
r944 r998 6 6 import sys 7 7 8 from shapely.geos import lgeos 8 from shapely.geos import lgeos, free, allocated_c_char_p 9 9 from shapely.predicates import BinaryPredicate, UnaryPredicate 10 10 from shapely.topology import BinaryTopologicalOp, UnaryTopologicalOp … … 304 304 def relate(self, other): 305 305 func = lgeos.GEOSRelate 306 func.restype = c_char_p 306 def errcheck(result, func, argtuple): 307 retval = result.value 308 free(result) 309 return retval 310 func.restype = allocated_c_char_p 311 func.errcheck = errcheck 307 312 return lgeos.GEOSRelate(self._geom, other._geom) 308 313 Shapely/trunk/shapely/geos.py
r888 r998 4 4 5 5 import atexit 6 from ctypes import CDLL, CFUNCTYPE, c_char_p6 from ctypes import cdll, CDLL, CFUNCTYPE, c_char_p 7 7 from ctypes.util import find_library 8 8 import sys … … 17 17 except: 18 18 raise 19 free = cdll.msvcrt.free 19 20 elif sys.platform == 'darwin': 20 21 lgeos = CDLL(find_library('geos_c')) 22 free = CDLL(find_library('libc')).free 21 23 else: 22 24 # Try the major versioned name first, falling back on the unversioned name. … … 27 29 except: 28 30 raise 31 free = CDLL('libc.so.6').free 32 33 34 class allocated_c_char_p(c_char_p): 35 pass 36 29 37 30 38 # Exceptions
