1 /* Generated by Cython 0.29.21 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [
7             "/home/sean/local/include/cpl_conv.h",
8             "/home/sean/local/include/cpl_error.h",
9             "/home/sean/local/include/cpl_string.h",
10             "/home/sean/local/include/cpl_vsi.h",
11             "/home/sean/local/include/gdal.h",
12             "/home/sean/local/include/gdal_alg.h",
13             "/home/sean/local/include/gdal_version.h",
14             "/home/sean/local/include/gdalwarper.h",
15             "/home/sean/local/include/ogr_api.h",
16             "/home/sean/local/include/ogr_core.h",
17             "/home/sean/local/include/ogr_srs_api.h"
18         ],
19         "include_dirs": [
20             "/home/sean/local/include"
21         ],
22         "libraries": [
23             "gdal"
24         ],
25         "library_dirs": [
26             "/home/sean/local/lib"
27         ],
28         "name": "fiona._env",
29         "sources": [
30             "fiona/_env.pyx"
31         ]
32     },
33     "module_name": "fiona._env"
34 }
35 END: Cython Metadata */
36 
37 #define PY_SSIZE_T_CLEAN
38 #include "Python.h"
39 #ifndef Py_PYTHON_H
40     #error Python headers needed to compile C extensions, please install development version of Python.
41 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
42     #error Cython requires Python 2.6+ or Python 3.3+.
43 #else
44 #define CYTHON_ABI "0_29_21"
45 #define CYTHON_HEX_VERSION 0x001D15F0
46 #define CYTHON_FUTURE_DIVISION 1
47 #include <stddef.h>
48 #ifndef offsetof
49   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
50 #endif
51 #if !defined(WIN32) && !defined(MS_WINDOWS)
52   #ifndef __stdcall
53     #define __stdcall
54   #endif
55   #ifndef __cdecl
56     #define __cdecl
57   #endif
58   #ifndef __fastcall
59     #define __fastcall
60   #endif
61 #endif
62 #ifndef DL_IMPORT
63   #define DL_IMPORT(t) t
64 #endif
65 #ifndef DL_EXPORT
66   #define DL_EXPORT(t) t
67 #endif
68 #define __PYX_COMMA ,
69 #ifndef HAVE_LONG_LONG
70   #if PY_VERSION_HEX >= 0x02070000
71     #define HAVE_LONG_LONG
72   #endif
73 #endif
74 #ifndef PY_LONG_LONG
75   #define PY_LONG_LONG LONG_LONG
76 #endif
77 #ifndef Py_HUGE_VAL
78   #define Py_HUGE_VAL HUGE_VAL
79 #endif
80 #ifdef PYPY_VERSION
81   #define CYTHON_COMPILING_IN_PYPY 1
82   #define CYTHON_COMPILING_IN_PYSTON 0
83   #define CYTHON_COMPILING_IN_CPYTHON 0
84   #undef CYTHON_USE_TYPE_SLOTS
85   #define CYTHON_USE_TYPE_SLOTS 0
86   #undef CYTHON_USE_PYTYPE_LOOKUP
87   #define CYTHON_USE_PYTYPE_LOOKUP 0
88   #if PY_VERSION_HEX < 0x03050000
89     #undef CYTHON_USE_ASYNC_SLOTS
90     #define CYTHON_USE_ASYNC_SLOTS 0
91   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
92     #define CYTHON_USE_ASYNC_SLOTS 1
93   #endif
94   #undef CYTHON_USE_PYLIST_INTERNALS
95   #define CYTHON_USE_PYLIST_INTERNALS 0
96   #undef CYTHON_USE_UNICODE_INTERNALS
97   #define CYTHON_USE_UNICODE_INTERNALS 0
98   #undef CYTHON_USE_UNICODE_WRITER
99   #define CYTHON_USE_UNICODE_WRITER 0
100   #undef CYTHON_USE_PYLONG_INTERNALS
101   #define CYTHON_USE_PYLONG_INTERNALS 0
102   #undef CYTHON_AVOID_BORROWED_REFS
103   #define CYTHON_AVOID_BORROWED_REFS 1
104   #undef CYTHON_ASSUME_SAFE_MACROS
105   #define CYTHON_ASSUME_SAFE_MACROS 0
106   #undef CYTHON_UNPACK_METHODS
107   #define CYTHON_UNPACK_METHODS 0
108   #undef CYTHON_FAST_THREAD_STATE
109   #define CYTHON_FAST_THREAD_STATE 0
110   #undef CYTHON_FAST_PYCALL
111   #define CYTHON_FAST_PYCALL 0
112   #undef CYTHON_PEP489_MULTI_PHASE_INIT
113   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
114   #undef CYTHON_USE_TP_FINALIZE
115   #define CYTHON_USE_TP_FINALIZE 0
116   #undef CYTHON_USE_DICT_VERSIONS
117   #define CYTHON_USE_DICT_VERSIONS 0
118   #undef CYTHON_USE_EXC_INFO_STACK
119   #define CYTHON_USE_EXC_INFO_STACK 0
120 #elif defined(PYSTON_VERSION)
121   #define CYTHON_COMPILING_IN_PYPY 0
122   #define CYTHON_COMPILING_IN_PYSTON 1
123   #define CYTHON_COMPILING_IN_CPYTHON 0
124   #ifndef CYTHON_USE_TYPE_SLOTS
125     #define CYTHON_USE_TYPE_SLOTS 1
126   #endif
127   #undef CYTHON_USE_PYTYPE_LOOKUP
128   #define CYTHON_USE_PYTYPE_LOOKUP 0
129   #undef CYTHON_USE_ASYNC_SLOTS
130   #define CYTHON_USE_ASYNC_SLOTS 0
131   #undef CYTHON_USE_PYLIST_INTERNALS
132   #define CYTHON_USE_PYLIST_INTERNALS 0
133   #ifndef CYTHON_USE_UNICODE_INTERNALS
134     #define CYTHON_USE_UNICODE_INTERNALS 1
135   #endif
136   #undef CYTHON_USE_UNICODE_WRITER
137   #define CYTHON_USE_UNICODE_WRITER 0
138   #undef CYTHON_USE_PYLONG_INTERNALS
139   #define CYTHON_USE_PYLONG_INTERNALS 0
140   #ifndef CYTHON_AVOID_BORROWED_REFS
141     #define CYTHON_AVOID_BORROWED_REFS 0
142   #endif
143   #ifndef CYTHON_ASSUME_SAFE_MACROS
144     #define CYTHON_ASSUME_SAFE_MACROS 1
145   #endif
146   #ifndef CYTHON_UNPACK_METHODS
147     #define CYTHON_UNPACK_METHODS 1
148   #endif
149   #undef CYTHON_FAST_THREAD_STATE
150   #define CYTHON_FAST_THREAD_STATE 0
151   #undef CYTHON_FAST_PYCALL
152   #define CYTHON_FAST_PYCALL 0
153   #undef CYTHON_PEP489_MULTI_PHASE_INIT
154   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
155   #undef CYTHON_USE_TP_FINALIZE
156   #define CYTHON_USE_TP_FINALIZE 0
157   #undef CYTHON_USE_DICT_VERSIONS
158   #define CYTHON_USE_DICT_VERSIONS 0
159   #undef CYTHON_USE_EXC_INFO_STACK
160   #define CYTHON_USE_EXC_INFO_STACK 0
161 #else
162   #define CYTHON_COMPILING_IN_PYPY 0
163   #define CYTHON_COMPILING_IN_PYSTON 0
164   #define CYTHON_COMPILING_IN_CPYTHON 1
165   #ifndef CYTHON_USE_TYPE_SLOTS
166     #define CYTHON_USE_TYPE_SLOTS 1
167   #endif
168   #if PY_VERSION_HEX < 0x02070000
169     #undef CYTHON_USE_PYTYPE_LOOKUP
170     #define CYTHON_USE_PYTYPE_LOOKUP 0
171   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
172     #define CYTHON_USE_PYTYPE_LOOKUP 1
173   #endif
174   #if PY_MAJOR_VERSION < 3
175     #undef CYTHON_USE_ASYNC_SLOTS
176     #define CYTHON_USE_ASYNC_SLOTS 0
177   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
178     #define CYTHON_USE_ASYNC_SLOTS 1
179   #endif
180   #if PY_VERSION_HEX < 0x02070000
181     #undef CYTHON_USE_PYLONG_INTERNALS
182     #define CYTHON_USE_PYLONG_INTERNALS 0
183   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
184     #define CYTHON_USE_PYLONG_INTERNALS 1
185   #endif
186   #ifndef CYTHON_USE_PYLIST_INTERNALS
187     #define CYTHON_USE_PYLIST_INTERNALS 1
188   #endif
189   #ifndef CYTHON_USE_UNICODE_INTERNALS
190     #define CYTHON_USE_UNICODE_INTERNALS 1
191   #endif
192   #if PY_VERSION_HEX < 0x030300F0
193     #undef CYTHON_USE_UNICODE_WRITER
194     #define CYTHON_USE_UNICODE_WRITER 0
195   #elif !defined(CYTHON_USE_UNICODE_WRITER)
196     #define CYTHON_USE_UNICODE_WRITER 1
197   #endif
198   #ifndef CYTHON_AVOID_BORROWED_REFS
199     #define CYTHON_AVOID_BORROWED_REFS 0
200   #endif
201   #ifndef CYTHON_ASSUME_SAFE_MACROS
202     #define CYTHON_ASSUME_SAFE_MACROS 1
203   #endif
204   #ifndef CYTHON_UNPACK_METHODS
205     #define CYTHON_UNPACK_METHODS 1
206   #endif
207   #ifndef CYTHON_FAST_THREAD_STATE
208     #define CYTHON_FAST_THREAD_STATE 1
209   #endif
210   #ifndef CYTHON_FAST_PYCALL
211     #define CYTHON_FAST_PYCALL 1
212   #endif
213   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
214     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
215   #endif
216   #ifndef CYTHON_USE_TP_FINALIZE
217     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
218   #endif
219   #ifndef CYTHON_USE_DICT_VERSIONS
220     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
221   #endif
222   #ifndef CYTHON_USE_EXC_INFO_STACK
223     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
224   #endif
225 #endif
226 #if !defined(CYTHON_FAST_PYCCALL)
227 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
228 #endif
229 #if CYTHON_USE_PYLONG_INTERNALS
230   #include "longintrepr.h"
231   #undef SHIFT
232   #undef BASE
233   #undef MASK
234   #ifdef SIZEOF_VOID_P
235     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
236   #endif
237 #endif
238 #ifndef __has_attribute
239   #define __has_attribute(x) 0
240 #endif
241 #ifndef __has_cpp_attribute
242   #define __has_cpp_attribute(x) 0
243 #endif
244 #ifndef CYTHON_RESTRICT
245   #if defined(__GNUC__)
246     #define CYTHON_RESTRICT __restrict__
247   #elif defined(_MSC_VER) && _MSC_VER >= 1400
248     #define CYTHON_RESTRICT __restrict
249   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
250     #define CYTHON_RESTRICT restrict
251   #else
252     #define CYTHON_RESTRICT
253   #endif
254 #endif
255 #ifndef CYTHON_UNUSED
256 # if defined(__GNUC__)
257 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
258 #     define CYTHON_UNUSED __attribute__ ((__unused__))
259 #   else
260 #     define CYTHON_UNUSED
261 #   endif
262 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
263 #   define CYTHON_UNUSED __attribute__ ((__unused__))
264 # else
265 #   define CYTHON_UNUSED
266 # endif
267 #endif
268 #ifndef CYTHON_MAYBE_UNUSED_VAR
269 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)270      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
271 #  else
272 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
273 #  endif
274 #endif
275 #ifndef CYTHON_NCP_UNUSED
276 # if CYTHON_COMPILING_IN_CPYTHON
277 #  define CYTHON_NCP_UNUSED
278 # else
279 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
280 # endif
281 #endif
282 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
283 #ifdef _MSC_VER
284     #ifndef _MSC_STDINT_H_
285         #if _MSC_VER < 1300
286            typedef unsigned char     uint8_t;
287            typedef unsigned int      uint32_t;
288         #else
289            typedef unsigned __int8   uint8_t;
290            typedef unsigned __int32  uint32_t;
291         #endif
292     #endif
293 #else
294    #include <stdint.h>
295 #endif
296 #ifndef CYTHON_FALLTHROUGH
297   #if defined(__cplusplus) && __cplusplus >= 201103L
298     #if __has_cpp_attribute(fallthrough)
299       #define CYTHON_FALLTHROUGH [[fallthrough]]
300     #elif __has_cpp_attribute(clang::fallthrough)
301       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
302     #elif __has_cpp_attribute(gnu::fallthrough)
303       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
304     #endif
305   #endif
306   #ifndef CYTHON_FALLTHROUGH
307     #if __has_attribute(fallthrough)
308       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
309     #else
310       #define CYTHON_FALLTHROUGH
311     #endif
312   #endif
313   #if defined(__clang__ ) && defined(__apple_build_version__)
314     #if __apple_build_version__ < 7000000
315       #undef  CYTHON_FALLTHROUGH
316       #define CYTHON_FALLTHROUGH
317     #endif
318   #endif
319 #endif
320 
321 #ifndef CYTHON_INLINE
322   #if defined(__clang__)
323     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
324   #elif defined(__GNUC__)
325     #define CYTHON_INLINE __inline__
326   #elif defined(_MSC_VER)
327     #define CYTHON_INLINE __inline
328   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
329     #define CYTHON_INLINE inline
330   #else
331     #define CYTHON_INLINE
332   #endif
333 #endif
334 
335 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
336   #define Py_OptimizeFlag 0
337 #endif
338 #define __PYX_BUILD_PY_SSIZE_T "n"
339 #define CYTHON_FORMAT_SSIZE_T "z"
340 #if PY_MAJOR_VERSION < 3
341   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
342   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
343           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
344   #define __Pyx_DefaultClassType PyClass_Type
345 #else
346   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
347 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
348   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
349           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
350 #else
351   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
352           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
353 #endif
354   #define __Pyx_DefaultClassType PyType_Type
355 #endif
356 #ifndef Py_TPFLAGS_CHECKTYPES
357   #define Py_TPFLAGS_CHECKTYPES 0
358 #endif
359 #ifndef Py_TPFLAGS_HAVE_INDEX
360   #define Py_TPFLAGS_HAVE_INDEX 0
361 #endif
362 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
363   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
364 #endif
365 #ifndef Py_TPFLAGS_HAVE_FINALIZE
366   #define Py_TPFLAGS_HAVE_FINALIZE 0
367 #endif
368 #ifndef METH_STACKLESS
369   #define METH_STACKLESS 0
370 #endif
371 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
372   #ifndef METH_FASTCALL
373      #define METH_FASTCALL 0x80
374   #endif
375   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
376   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
377                                                           Py_ssize_t nargs, PyObject *kwnames);
378 #else
379   #define __Pyx_PyCFunctionFast _PyCFunctionFast
380   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
381 #endif
382 #if CYTHON_FAST_PYCCALL
383 #define __Pyx_PyFastCFunction_Check(func)\
384     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
385 #else
386 #define __Pyx_PyFastCFunction_Check(func) 0
387 #endif
388 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
389   #define PyObject_Malloc(s)   PyMem_Malloc(s)
390   #define PyObject_Free(p)     PyMem_Free(p)
391   #define PyObject_Realloc(p)  PyMem_Realloc(p)
392 #endif
393 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
394   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
395   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
396   #define PyMem_RawFree(p)             PyMem_Free(p)
397 #endif
398 #if CYTHON_COMPILING_IN_PYSTON
399   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
400   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
401 #else
402   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
403   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
404 #endif
405 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
406   #define __Pyx_PyThreadState_Current PyThreadState_GET()
407 #elif PY_VERSION_HEX >= 0x03060000
408   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
409 #elif PY_VERSION_HEX >= 0x03000000
410   #define __Pyx_PyThreadState_Current PyThreadState_GET()
411 #else
412   #define __Pyx_PyThreadState_Current _PyThreadState_Current
413 #endif
414 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
415 #include "pythread.h"
416 #define Py_tss_NEEDS_INIT 0
417 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)418 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
419   *key = PyThread_create_key();
420   return 0;
421 }
PyThread_tss_alloc(void)422 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
423   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
424   *key = Py_tss_NEEDS_INIT;
425   return key;
426 }
PyThread_tss_free(Py_tss_t * key)427 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
428   PyObject_Free(key);
429 }
PyThread_tss_is_created(Py_tss_t * key)430 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
431   return *key != Py_tss_NEEDS_INIT;
432 }
PyThread_tss_delete(Py_tss_t * key)433 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
434   PyThread_delete_key(*key);
435   *key = Py_tss_NEEDS_INIT;
436 }
PyThread_tss_set(Py_tss_t * key,void * value)437 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
438   return PyThread_set_key_value(*key, value);
439 }
PyThread_tss_get(Py_tss_t * key)440 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
441   return PyThread_get_key_value(*key);
442 }
443 #endif
444 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
445 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
446 #else
447 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
448 #endif
449 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
450   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
451   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
452 #else
453   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
454   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
455 #endif
456 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
457 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
458 #else
459 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
460 #endif
461 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
462   #define CYTHON_PEP393_ENABLED 1
463   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
464                                               0 : _PyUnicode_Ready((PyObject *)(op)))
465   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
466   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
467   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
468   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
469   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
470   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
471   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
472   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
473   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
474   #else
475   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
476   #endif
477 #else
478   #define CYTHON_PEP393_ENABLED 0
479   #define PyUnicode_1BYTE_KIND  1
480   #define PyUnicode_2BYTE_KIND  2
481   #define PyUnicode_4BYTE_KIND  4
482   #define __Pyx_PyUnicode_READY(op)       (0)
483   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
484   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
485   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
486   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
487   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
488   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
489   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
490   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
491 #endif
492 #if CYTHON_COMPILING_IN_PYPY
493   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
494   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
495 #else
496   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
497   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
498       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
499 #endif
500 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
501   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
502 #endif
503 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
504   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
505 #endif
506 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
507   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
508 #endif
509 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
510 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
511 #if PY_MAJOR_VERSION >= 3
512   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
513 #else
514   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
515 #endif
516 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
517   #define PyObject_ASCII(o)            PyObject_Repr(o)
518 #endif
519 #if PY_MAJOR_VERSION >= 3
520   #define PyBaseString_Type            PyUnicode_Type
521   #define PyStringObject               PyUnicodeObject
522   #define PyString_Type                PyUnicode_Type
523   #define PyString_Check               PyUnicode_Check
524   #define PyString_CheckExact          PyUnicode_CheckExact
525 #ifndef PyObject_Unicode
526   #define PyObject_Unicode             PyObject_Str
527 #endif
528 #endif
529 #if PY_MAJOR_VERSION >= 3
530   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
531   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
532 #else
533   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
534   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
535 #endif
536 #ifndef PySet_CheckExact
537   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
538 #endif
539 #if PY_VERSION_HEX >= 0x030900A4
540   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
541   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
542 #else
543   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
544   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
545 #endif
546 #if CYTHON_ASSUME_SAFE_MACROS
547   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
548 #else
549   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
550 #endif
551 #if PY_MAJOR_VERSION >= 3
552   #define PyIntObject                  PyLongObject
553   #define PyInt_Type                   PyLong_Type
554   #define PyInt_Check(op)              PyLong_Check(op)
555   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
556   #define PyInt_FromString             PyLong_FromString
557   #define PyInt_FromUnicode            PyLong_FromUnicode
558   #define PyInt_FromLong               PyLong_FromLong
559   #define PyInt_FromSize_t             PyLong_FromSize_t
560   #define PyInt_FromSsize_t            PyLong_FromSsize_t
561   #define PyInt_AsLong                 PyLong_AsLong
562   #define PyInt_AS_LONG                PyLong_AS_LONG
563   #define PyInt_AsSsize_t              PyLong_AsSsize_t
564   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
565   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
566   #define PyNumber_Int                 PyNumber_Long
567 #endif
568 #if PY_MAJOR_VERSION >= 3
569   #define PyBoolObject                 PyLongObject
570 #endif
571 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
572   #ifndef PyUnicode_InternFromString
573     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
574   #endif
575 #endif
576 #if PY_VERSION_HEX < 0x030200A4
577   typedef long Py_hash_t;
578   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
579   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
580 #else
581   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
582   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
583 #endif
584 #if PY_MAJOR_VERSION >= 3
585   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
586 #else
587   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
588 #endif
589 #if CYTHON_USE_ASYNC_SLOTS
590   #if PY_VERSION_HEX >= 0x030500B1
591     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
592     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
593   #else
594     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
595   #endif
596 #else
597   #define __Pyx_PyType_AsAsync(obj) NULL
598 #endif
599 #ifndef __Pyx_PyAsyncMethodsStruct
600     typedef struct {
601         unaryfunc am_await;
602         unaryfunc am_aiter;
603         unaryfunc am_anext;
604     } __Pyx_PyAsyncMethodsStruct;
605 #endif
606 
607 #if defined(WIN32) || defined(MS_WINDOWS)
608   #define _USE_MATH_DEFINES
609 #endif
610 #include <math.h>
611 #ifdef NAN
612 #define __PYX_NAN() ((float) NAN)
613 #else
__PYX_NAN()614 static CYTHON_INLINE float __PYX_NAN() {
615   float value;
616   memset(&value, 0xFF, sizeof(value));
617   return value;
618 }
619 #endif
620 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
621 #define __Pyx_truncl trunc
622 #else
623 #define __Pyx_truncl truncl
624 #endif
625 
626 #define __PYX_MARK_ERR_POS(f_index, lineno) \
627     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
628 #define __PYX_ERR(f_index, lineno, Ln_error) \
629     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
630 
631 #ifndef __PYX_EXTERN_C
632   #ifdef __cplusplus
633     #define __PYX_EXTERN_C extern "C"
634   #else
635     #define __PYX_EXTERN_C extern
636   #endif
637 #endif
638 
639 #define __PYX_HAVE__fiona___env
640 #define __PYX_HAVE_API__fiona___env
641 /* Early includes */
642 #include <string.h>
643 #include <stdio.h>
644 #include "cpl_conv.h"
645 #include "cpl_error.h"
646 #include "cpl_string.h"
647 #include "cpl_vsi.h"
648 #include "ogr_srs_api.h"
649 #include "gdal.h"
650 #include "ogr_api.h"
651 #include "gdalwarper.h"
652 #include "gdal_alg.h"
653 #include "ogr_core.h"
654 #include "gdal_version.h"
655 #include "sys/stat.h"
656 #ifdef _OPENMP
657 #include <omp.h>
658 #endif /* _OPENMP */
659 
660 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
661 #define CYTHON_WITHOUT_ASSERTIONS
662 #endif
663 
664 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
665                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
666 
667 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
668 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 1
669 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
670 #define __PYX_DEFAULT_STRING_ENCODING "utf8"
671 #define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString
672 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
673 #define __Pyx_uchar_cast(c) ((unsigned char)c)
674 #define __Pyx_long_cast(x) ((long)x)
675 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
676     (sizeof(type) < sizeof(Py_ssize_t))  ||\
677     (sizeof(type) > sizeof(Py_ssize_t) &&\
678           likely(v < (type)PY_SSIZE_T_MAX ||\
679                  v == (type)PY_SSIZE_T_MAX)  &&\
680           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
681                                 v == (type)PY_SSIZE_T_MIN)))  ||\
682     (sizeof(type) == sizeof(Py_ssize_t) &&\
683           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
684                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)685 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
686     return (size_t) i < (size_t) limit;
687 }
688 #if defined (__cplusplus) && __cplusplus >= 201103L
689     #include <cstdlib>
690     #define __Pyx_sst_abs(value) std::abs(value)
691 #elif SIZEOF_INT >= SIZEOF_SIZE_T
692     #define __Pyx_sst_abs(value) abs(value)
693 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
694     #define __Pyx_sst_abs(value) labs(value)
695 #elif defined (_MSC_VER)
696     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
697 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
698     #define __Pyx_sst_abs(value) llabs(value)
699 #elif defined (__GNUC__)
700     #define __Pyx_sst_abs(value) __builtin_llabs(value)
701 #else
702     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
703 #endif
704 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
705 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
706 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
707 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
708 #define __Pyx_PyBytes_FromString        PyBytes_FromString
709 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
710 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
711 #if PY_MAJOR_VERSION < 3
712     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
713     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
714 #else
715     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
716     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
717 #endif
718 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
719 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
720 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
721 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
722 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
723 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
724 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
725 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
726 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
727 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
728 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
729 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
730 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
731 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
732 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
733 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)734 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
735     const Py_UNICODE *u_end = u;
736     while (*u_end++) ;
737     return (size_t)(u_end - u - 1);
738 }
739 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
740 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
741 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
742 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
743 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
744 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
745 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
746 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
747 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
748 #define __Pyx_PySequence_Tuple(obj)\
749     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
750 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
751 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
752 #if CYTHON_ASSUME_SAFE_MACROS
753 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
754 #else
755 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
756 #endif
757 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
758 #if PY_MAJOR_VERSION >= 3
759 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
760 #else
761 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
762 #endif
763 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
764 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
765 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)766 static int __Pyx_init_sys_getdefaultencoding_params(void) {
767     PyObject* sys;
768     PyObject* default_encoding = NULL;
769     PyObject* ascii_chars_u = NULL;
770     PyObject* ascii_chars_b = NULL;
771     const char* default_encoding_c;
772     sys = PyImport_ImportModule("sys");
773     if (!sys) goto bad;
774     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
775     Py_DECREF(sys);
776     if (!default_encoding) goto bad;
777     default_encoding_c = PyBytes_AsString(default_encoding);
778     if (!default_encoding_c) goto bad;
779     if (strcmp(default_encoding_c, "ascii") == 0) {
780         __Pyx_sys_getdefaultencoding_not_ascii = 0;
781     } else {
782         char ascii_chars[128];
783         int c;
784         for (c = 0; c < 128; c++) {
785             ascii_chars[c] = c;
786         }
787         __Pyx_sys_getdefaultencoding_not_ascii = 1;
788         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
789         if (!ascii_chars_u) goto bad;
790         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
791         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
792             PyErr_Format(
793                 PyExc_ValueError,
794                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
795                 default_encoding_c);
796             goto bad;
797         }
798         Py_DECREF(ascii_chars_u);
799         Py_DECREF(ascii_chars_b);
800     }
801     Py_DECREF(default_encoding);
802     return 0;
803 bad:
804     Py_XDECREF(default_encoding);
805     Py_XDECREF(ascii_chars_u);
806     Py_XDECREF(ascii_chars_b);
807     return -1;
808 }
809 #endif
810 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
811 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
812 #else
813 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
814 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
815 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)816 static int __Pyx_init_sys_getdefaultencoding_params(void) {
817     PyObject* sys;
818     PyObject* default_encoding = NULL;
819     char* default_encoding_c;
820     sys = PyImport_ImportModule("sys");
821     if (!sys) goto bad;
822     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
823     Py_DECREF(sys);
824     if (!default_encoding) goto bad;
825     default_encoding_c = PyBytes_AsString(default_encoding);
826     if (!default_encoding_c) goto bad;
827     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
828     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
829     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
830     Py_DECREF(default_encoding);
831     return 0;
832 bad:
833     Py_XDECREF(default_encoding);
834     return -1;
835 }
836 #endif
837 #endif
838 
839 
840 /* Test for GCC > 2.95 */
841 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
842   #define likely(x)   __builtin_expect(!!(x), 1)
843   #define unlikely(x) __builtin_expect(!!(x), 0)
844 #else /* !__GNUC__ or GCC < 2.95 */
845   #define likely(x)   (x)
846   #define unlikely(x) (x)
847 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)848 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
849 
850 static PyObject *__pyx_m = NULL;
851 static PyObject *__pyx_d;
852 static PyObject *__pyx_b;
853 static PyObject *__pyx_cython_runtime = NULL;
854 static PyObject *__pyx_empty_tuple;
855 static PyObject *__pyx_empty_bytes;
856 static PyObject *__pyx_empty_unicode;
857 static int __pyx_lineno;
858 static int __pyx_clineno = 0;
859 static const char * __pyx_cfilenm= __FILE__;
860 static const char *__pyx_filename;
861 
862 
863 static const char *__pyx_f[] = {
864   "fiona/_env.pyx",
865   "stringsource",
866 };
867 /* ForceInitThreads.proto */
868 #ifndef __PYX_FORCE_INIT_THREADS
869   #define __PYX_FORCE_INIT_THREADS 0
870 #endif
871 
872 /* NoFastGil.proto */
873 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
874 #define __Pyx_PyGILState_Release PyGILState_Release
875 #define __Pyx_FastGIL_Remember()
876 #define __Pyx_FastGIL_Forget()
877 #define __Pyx_FastGilFuncInit()
878 
879 
880 /*--- Type declarations ---*/
881 struct __pyx_obj_5fiona_4_env_ConfigEnv;
882 struct __pyx_obj_5fiona_4_env_GDALEnv;
883 struct __pyx_opt_args_5fiona_4_env_get_gdal_config;
884 struct __pyx_opt_args_5fiona_4_env_set_gdal_config;
885 struct __pyx_defaults;
886 typedef struct __pyx_defaults __pyx_defaults;
887 struct __pyx_defaults1;
888 typedef struct __pyx_defaults1 __pyx_defaults1;
889 struct __pyx_defaults2;
890 typedef struct __pyx_defaults2 __pyx_defaults2;
891 
892 /* "fiona/_env.pyx":163
893  *
894  *
895  * cpdef get_gdal_config(key, normalize=True):             # <<<<<<<<<<<<<<
896  *     """Get the value of a GDAL configuration option.  When requesting
897  *     ``GDAL_CACHEMAX`` the value is returned unaltered.
898  */
899 struct __pyx_opt_args_5fiona_4_env_get_gdal_config {
900   int __pyx_n;
901   PyObject *normalize;
902 };
903 
904 /* "fiona/_env.pyx":200
905  *
906  *
907  * cpdef set_gdal_config(key, val, normalize=True):             # <<<<<<<<<<<<<<
908  *     """Set a GDAL configuration option's value.
909  *
910  */
911 struct __pyx_opt_args_5fiona_4_env_set_gdal_config {
912   int __pyx_n;
913   PyObject *normalize;
914 };
915 struct __pyx_defaults {
916   PyObject *__pyx_arg_prefix;
917 };
918 struct __pyx_defaults1 {
919   PyObject *__pyx_arg_prefix;
920 };
921 struct __pyx_defaults2 {
922   PyObject *__pyx_arg_prefix;
923 };
924 
925 /* "fiona/_env.pxd":1
926  * cdef class ConfigEnv(object):             # <<<<<<<<<<<<<<
927  *     cdef public object options
928  *
929  */
930 struct __pyx_obj_5fiona_4_env_ConfigEnv {
931   PyObject_HEAD
932   PyObject *options;
933 };
934 
935 
936 /* "fiona/_env.pxd":5
937  *
938  *
939  * cdef class GDALEnv(ConfigEnv):             # <<<<<<<<<<<<<<
940  *     cdef public object _have_registered_drivers
941  */
942 struct __pyx_obj_5fiona_4_env_GDALEnv {
943   struct __pyx_obj_5fiona_4_env_ConfigEnv __pyx_base;
944   PyObject *_have_registered_drivers;
945 };
946 
947 
948 /* --- Runtime support code (head) --- */
949 /* Refnanny.proto */
950 #ifndef CYTHON_REFNANNY
951   #define CYTHON_REFNANNY 0
952 #endif
953 #if CYTHON_REFNANNY
954   typedef struct {
955     void (*INCREF)(void*, PyObject*, int);
956     void (*DECREF)(void*, PyObject*, int);
957     void (*GOTREF)(void*, PyObject*, int);
958     void (*GIVEREF)(void*, PyObject*, int);
959     void* (*SetupContext)(const char*, int, const char*);
960     void (*FinishContext)(void**);
961   } __Pyx_RefNannyAPIStruct;
962   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
963   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
964   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
965 #ifdef WITH_THREAD
966   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
967           if (acquire_gil) {\
968               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
969               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
970               PyGILState_Release(__pyx_gilstate_save);\
971           } else {\
972               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
973           }
974 #else
975   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
976           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
977 #endif
978   #define __Pyx_RefNannyFinishContext()\
979           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
980   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
981   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
982   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
983   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
984   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
985   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
986   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
987   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
988 #else
989   #define __Pyx_RefNannyDeclarations
990   #define __Pyx_RefNannySetupContext(name, acquire_gil)
991   #define __Pyx_RefNannyFinishContext()
992   #define __Pyx_INCREF(r) Py_INCREF(r)
993   #define __Pyx_DECREF(r) Py_DECREF(r)
994   #define __Pyx_GOTREF(r)
995   #define __Pyx_GIVEREF(r)
996   #define __Pyx_XINCREF(r) Py_XINCREF(r)
997   #define __Pyx_XDECREF(r) Py_XDECREF(r)
998   #define __Pyx_XGOTREF(r)
999   #define __Pyx_XGIVEREF(r)
1000 #endif
1001 #define __Pyx_XDECREF_SET(r, v) do {\
1002         PyObject *tmp = (PyObject *) r;\
1003         r = v; __Pyx_XDECREF(tmp);\
1004     } while (0)
1005 #define __Pyx_DECREF_SET(r, v) do {\
1006         PyObject *tmp = (PyObject *) r;\
1007         r = v; __Pyx_DECREF(tmp);\
1008     } while (0)
1009 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1010 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1011 
1012 /* PyObjectGetAttrStr.proto */
1013 #if CYTHON_USE_TYPE_SLOTS
1014 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1015 #else
1016 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1017 #endif
1018 
1019 /* GetBuiltinName.proto */
1020 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1021 
1022 /* RaiseArgTupleInvalid.proto */
1023 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1024     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1025 
1026 /* RaiseDoubleKeywords.proto */
1027 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1028 
1029 /* ParseKeywords.proto */
1030 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1031     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1032     const char* function_name);
1033 
1034 /* PyCFunctionFastCall.proto */
1035 #if CYTHON_FAST_PYCCALL
1036 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1037 #else
1038 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1039 #endif
1040 
1041 /* PyFunctionFastCall.proto */
1042 #if CYTHON_FAST_PYCALL
1043 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1044     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1045 #if 1 || PY_VERSION_HEX < 0x030600B1
1046 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1047 #else
1048 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1049 #endif
1050 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1051     (sizeof(char [1 - 2*!(cond)]) - 1)
1052 #ifndef Py_MEMBER_SIZE
1053 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1054 #endif
1055   static size_t __pyx_pyframe_localsplus_offset = 0;
1056   #include "frameobject.h"
1057   #define __Pxy_PyFrame_Initialize_Offsets()\
1058     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1059      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1060   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1061     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1062 #endif
1063 
1064 /* PyObjectCall.proto */
1065 #if CYTHON_COMPILING_IN_CPYTHON
1066 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1067 #else
1068 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1069 #endif
1070 
1071 /* PyObjectCallMethO.proto */
1072 #if CYTHON_COMPILING_IN_CPYTHON
1073 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1074 #endif
1075 
1076 /* PyObjectCallOneArg.proto */
1077 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1078 
1079 /* PyDictVersioning.proto */
1080 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1081 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1082 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1083 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1084     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1085     (cache_var) = (value);
1086 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1087     static PY_UINT64_T __pyx_dict_version = 0;\
1088     static PyObject *__pyx_dict_cached_value = NULL;\
1089     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1090         (VAR) = __pyx_dict_cached_value;\
1091     } else {\
1092         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1093         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1094     }\
1095 }
1096 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1097 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1098 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1099 #else
1100 #define __PYX_GET_DICT_VERSION(dict)  (0)
1101 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1102 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1103 #endif
1104 
1105 /* GetModuleGlobalName.proto */
1106 #if CYTHON_USE_DICT_VERSIONS
1107 #define __Pyx_GetModuleGlobalName(var, name)  {\
1108     static PY_UINT64_T __pyx_dict_version = 0;\
1109     static PyObject *__pyx_dict_cached_value = NULL;\
1110     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1111         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1112         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1113 }
1114 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1115     PY_UINT64_T __pyx_dict_version;\
1116     PyObject *__pyx_dict_cached_value;\
1117     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1118 }
1119 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1120 #else
1121 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1122 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1123 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1124 #endif
1125 
1126 /* PyObjectCallNoArg.proto */
1127 #if CYTHON_COMPILING_IN_CPYTHON
1128 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1129 #else
1130 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1131 #endif
1132 
1133 /* PyIntBinop.proto */
1134 #if !CYTHON_COMPILING_IN_PYPY
1135 static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1136 #else
1137 #define __Pyx_PyInt_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
1138     (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
1139 #endif
1140 
1141 /* PyObjectCall2Args.proto */
1142 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1143 
1144 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)1145 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1146     int result = PySequence_Contains(seq, item);
1147     return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1148 }
1149 
1150 /* GetItemInt.proto */
1151 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1152     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1153     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1154     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1155                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1156 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1157     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1158     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1159     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1160 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1161                                                               int wraparound, int boundscheck);
1162 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1163     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1164     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1165     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1166 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1167                                                               int wraparound, int boundscheck);
1168 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1169 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1170                                                      int is_list, int wraparound, int boundscheck);
1171 
1172 /* ObjectGetItem.proto */
1173 #if CYTHON_USE_TYPE_SLOTS
1174 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1175 #else
1176 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1177 #endif
1178 
1179 /* PyThreadStateGet.proto */
1180 #if CYTHON_FAST_THREAD_STATE
1181 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1182 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1183 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1184 #else
1185 #define __Pyx_PyThreadState_declare
1186 #define __Pyx_PyThreadState_assign
1187 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1188 #endif
1189 
1190 /* PyErrFetchRestore.proto */
1191 #if CYTHON_FAST_THREAD_STATE
1192 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1193 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1194 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1195 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1196 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1197 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1198 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1199 #if CYTHON_COMPILING_IN_CPYTHON
1200 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1201 #else
1202 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1203 #endif
1204 #else
1205 #define __Pyx_PyErr_Clear() PyErr_Clear()
1206 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1207 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1208 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1209 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1210 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1211 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1212 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1213 #endif
1214 
1215 /* WriteUnraisableException.proto */
1216 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1217                                   int lineno, const char *filename,
1218                                   int full_traceback, int nogil);
1219 
1220 /* IncludeStringH.proto */
1221 #include <string.h>
1222 
1223 /* BytesEquals.proto */
1224 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1225 
1226 /* UnicodeEquals.proto */
1227 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1228 
1229 /* KeywordStringCheck.proto */
1230 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1231 
1232 /* IterFinish.proto */
1233 static CYTHON_INLINE int __Pyx_IterFinish(void);
1234 
1235 /* PyObjectGetMethod.proto */
1236 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1237 
1238 /* PyObjectCallMethod0.proto */
1239 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1240 
1241 /* RaiseNeedMoreValuesToUnpack.proto */
1242 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1243 
1244 /* RaiseTooManyValuesToUnpack.proto */
1245 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1246 
1247 /* UnpackItemEndCheck.proto */
1248 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1249 
1250 /* RaiseNoneIterError.proto */
1251 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1252 
1253 /* UnpackTupleError.proto */
1254 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1255 
1256 /* UnpackTuple2.proto */
1257 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1258     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1259         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1260             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1261             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1262         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1263 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1264     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1265 static int __Pyx_unpack_tuple2_generic(
1266     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1267 
1268 /* dict_iter.proto */
1269 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1270                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1271 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1272                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1273 
1274 /* PyErrExceptionMatches.proto */
1275 #if CYTHON_FAST_THREAD_STATE
1276 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1277 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1278 #else
1279 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1280 #endif
1281 
1282 /* GetAttr.proto */
1283 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1284 
1285 /* GetAttr3.proto */
1286 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1287 
1288 /* SliceObject.proto */
1289 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1290         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1291         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1292         int has_cstart, int has_cstop, int wraparound);
1293 
1294 /* GetTopmostException.proto */
1295 #if CYTHON_USE_EXC_INFO_STACK
1296 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1297 #endif
1298 
1299 /* SaveResetException.proto */
1300 #if CYTHON_FAST_THREAD_STATE
1301 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1302 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1303 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1304 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1305 #else
1306 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1307 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1308 #endif
1309 
1310 /* FastTypeChecks.proto */
1311 #if CYTHON_COMPILING_IN_CPYTHON
1312 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1313 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1314 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1315 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1316 #else
1317 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1318 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1319 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1320 #endif
1321 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1322 
1323 /* GetException.proto */
1324 #if CYTHON_FAST_THREAD_STATE
1325 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1326 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1327 #else
1328 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1329 #endif
1330 
1331 /* SwapException.proto */
1332 #if CYTHON_FAST_THREAD_STATE
1333 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1334 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1335 #else
1336 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1337 #endif
1338 
1339 /* PyObjectLookupSpecial.proto */
1340 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_LookupSpecial(PyObject * obj,PyObject * attr_name)1341 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1342     PyObject *res;
1343     PyTypeObject *tp = Py_TYPE(obj);
1344 #if PY_MAJOR_VERSION < 3
1345     if (unlikely(PyInstance_Check(obj)))
1346         return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1347 #endif
1348     res = _PyType_Lookup(tp, attr_name);
1349     if (likely(res)) {
1350         descrgetfunc f = Py_TYPE(res)->tp_descr_get;
1351         if (!f) {
1352             Py_INCREF(res);
1353         } else {
1354             res = f(res, obj, (PyObject *)tp);
1355         }
1356     } else {
1357         PyErr_SetObject(PyExc_AttributeError, attr_name);
1358     }
1359     return res;
1360 }
1361 #else
1362 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1363 #endif
1364 
1365 /* DictGetItem.proto */
1366 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1367 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1368 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1369     (likely(PyDict_CheckExact(obj)) ?\
1370      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1371 #else
1372 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1373 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1374 #endif
1375 
1376 /* PyIntCompare.proto */
1377 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1378 
1379 /* RaiseException.proto */
1380 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1381 
1382 /* Import.proto */
1383 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1384 
1385 /* ImportFrom.proto */
1386 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1387 
1388 /* HasAttr.proto */
1389 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1390 
1391 /* PyObject_GenericGetAttrNoDict.proto */
1392 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1393 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1394 #else
1395 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1396 #endif
1397 
1398 /* PyObject_GenericGetAttr.proto */
1399 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1400 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1401 #else
1402 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1403 #endif
1404 
1405 /* PyObjectGetAttrStrNoError.proto */
1406 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1407 
1408 /* SetupReduce.proto */
1409 static int __Pyx_setup_reduce(PyObject* type_obj);
1410 
1411 /* CalculateMetaclass.proto */
1412 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1413 
1414 /* FetchCommonType.proto */
1415 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1416 
1417 /* CythonFunctionShared.proto */
1418 #define __Pyx_CyFunction_USED 1
1419 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1420 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1421 #define __Pyx_CYFUNCTION_CCLASS        0x04
1422 #define __Pyx_CyFunction_GetClosure(f)\
1423     (((__pyx_CyFunctionObject *) (f))->func_closure)
1424 #define __Pyx_CyFunction_GetClassObj(f)\
1425     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1426 #define __Pyx_CyFunction_Defaults(type, f)\
1427     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1428 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1429     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1430 typedef struct {
1431     PyCFunctionObject func;
1432 #if PY_VERSION_HEX < 0x030500A0
1433     PyObject *func_weakreflist;
1434 #endif
1435     PyObject *func_dict;
1436     PyObject *func_name;
1437     PyObject *func_qualname;
1438     PyObject *func_doc;
1439     PyObject *func_globals;
1440     PyObject *func_code;
1441     PyObject *func_closure;
1442     PyObject *func_classobj;
1443     void *defaults;
1444     int defaults_pyobjects;
1445     size_t defaults_size;  // used by FusedFunction for copying defaults
1446     int flags;
1447     PyObject *defaults_tuple;
1448     PyObject *defaults_kwdict;
1449     PyObject *(*defaults_getter)(PyObject *);
1450     PyObject *func_annotations;
1451 } __pyx_CyFunctionObject;
1452 static PyTypeObject *__pyx_CyFunctionType = 0;
1453 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1454 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1455                                       int flags, PyObject* qualname,
1456                                       PyObject *self,
1457                                       PyObject *module, PyObject *globals,
1458                                       PyObject* code);
1459 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1460                                                          size_t size,
1461                                                          int pyobjects);
1462 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1463                                                             PyObject *tuple);
1464 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1465                                                              PyObject *dict);
1466 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1467                                                               PyObject *dict);
1468 static int __pyx_CyFunction_init(void);
1469 
1470 /* CythonFunction.proto */
1471 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1472                                       int flags, PyObject* qualname,
1473                                       PyObject *closure,
1474                                       PyObject *module, PyObject *globals,
1475                                       PyObject* code);
1476 
1477 /* SetNameInClass.proto */
1478 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1479 #define __Pyx_SetNameInClass(ns, name, value)\
1480     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1481 #elif CYTHON_COMPILING_IN_CPYTHON
1482 #define __Pyx_SetNameInClass(ns, name, value)\
1483     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1484 #else
1485 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1486 #endif
1487 
1488 /* Py3ClassCreate.proto */
1489 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1490                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1491 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1492                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1493 
1494 /* CLineInTraceback.proto */
1495 #ifdef CYTHON_CLINE_IN_TRACEBACK
1496 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1497 #else
1498 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1499 #endif
1500 
1501 /* CodeObjectCache.proto */
1502 typedef struct {
1503     PyCodeObject* code_object;
1504     int code_line;
1505 } __Pyx_CodeObjectCacheEntry;
1506 struct __Pyx_CodeObjectCache {
1507     int count;
1508     int max_count;
1509     __Pyx_CodeObjectCacheEntry* entries;
1510 };
1511 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1512 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1513 static PyCodeObject *__pyx_find_code_object(int code_line);
1514 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1515 
1516 /* AddTraceback.proto */
1517 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1518                                int py_line, const char *filename);
1519 
1520 /* CIntToPy.proto */
1521 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1522 
1523 /* CIntToPy.proto */
1524 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_CPLErr(CPLErr value);
1525 
1526 /* CIntToPy.proto */
1527 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GIntBig(GIntBig value);
1528 
1529 /* CIntToPy.proto */
1530 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1531 
1532 /* CIntFromPy.proto */
1533 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1534 
1535 /* CIntFromPy.proto */
1536 static CYTHON_INLINE GIntBig __Pyx_PyInt_As_GIntBig(PyObject *);
1537 
1538 /* CIntFromPy.proto */
1539 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1540 
1541 /* CheckBinaryVersion.proto */
1542 static int __Pyx_check_binary_version(void);
1543 
1544 /* FunctionImport.proto */
1545 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
1546 
1547 /* InitStrings.proto */
1548 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1549 
1550 
1551 /* Module declarations from 'libc.string' */
1552 
1553 /* Module declarations from 'libc.stdio' */
1554 
1555 /* Module declarations from 'fiona._err' */
1556 static int (*__pyx_f_5fiona_4_err_exc_wrap_int)(int); /*proto*/
1557 static OGRErr (*__pyx_f_5fiona_4_err_exc_wrap_ogrerr)(OGRErr); /*proto*/
1558 
1559 /* Module declarations from 'fiona._shim' */
1560 static void (*__pyx_f_5fiona_5_shim_set_proj_search_path)(PyObject *); /*proto*/
1561 static void (*__pyx_f_5fiona_5_shim_get_proj_version)(int *, int *, int *); /*proto*/
1562 
1563 /* Module declarations from 'fiona._env' */
1564 static PyTypeObject *__pyx_ptype_5fiona_4_env_ConfigEnv = 0;
1565 static PyTypeObject *__pyx_ptype_5fiona_4_env_GDALEnv = 0;
1566 static int __pyx_v_5fiona_4_env_is_64bit;
1567 static PyObject *__pyx_f_5fiona_4_env__safe_osr_release(OGRSpatialReferenceH); /*proto*/
1568 static void __pyx_f_5fiona_4_env_log_error(CPLErr, int, char const *); /*proto*/
1569 static void __pyx_f_5fiona_4_env_logging_error_handler(CPLErr, int, char const *); /*proto*/
1570 static PyObject *__pyx_f_5fiona_4_env_get_gdal_config(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5fiona_4_env_get_gdal_config *__pyx_optional_args); /*proto*/
1571 static PyObject *__pyx_f_5fiona_4_env_set_gdal_config(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5fiona_4_env_set_gdal_config *__pyx_optional_args); /*proto*/
1572 static PyObject *__pyx_f_5fiona_4_env_del_gdal_config(PyObject *, int __pyx_skip_dispatch); /*proto*/
1573 static PyObject *__pyx_f_5fiona_4_env___pyx_unpickle_ConfigEnv__set_state(struct __pyx_obj_5fiona_4_env_ConfigEnv *, PyObject *); /*proto*/
1574 static PyObject *__pyx_f_5fiona_4_env___pyx_unpickle_GDALEnv__set_state(struct __pyx_obj_5fiona_4_env_GDALEnv *, PyObject *); /*proto*/
1575 #define __Pyx_MODULE_NAME "fiona._env"
1576 extern int __pyx_module_is_main_fiona___env;
1577 int __pyx_module_is_main_fiona___env = 0;
1578 
1579 /* Implementation of 'fiona._env' */
1580 static PyObject *__pyx_builtin_ImportError;
1581 static PyObject *__pyx_builtin_object;
1582 static PyObject *__pyx_builtin_super;
1583 static PyObject *__pyx_builtin_ValueError;
1584 static PyObject *__pyx_builtin_range;
1585 static const char __pyx_k_s[] = "%s";
1586 static const char __pyx_k_ON[] = "ON";
1587 static const char __pyx_k__3[] = "{}.{}";
1588 static const char __pyx_k__4[] = ".";
1589 static const char __pyx_k_os[] = "os";
1590 static const char __pyx_k_OFF[] = "OFF";
1591 static const char __pyx_k_doc[] = "__doc__";
1592 static const char __pyx_k_key[] = "key";
1593 static const char __pyx_k_log[] = "log";
1594 static const char __pyx_k_maj[] = "maj";
1595 static const char __pyx_k_min[] = "min";
1596 static const char __pyx_k_new[] = "__new__";
1597 static const char __pyx_k_osr[] = "osr";
1598 static const char __pyx_k_rev[] = "rev";
1599 static const char __pyx_k_sys[] = "sys";
1600 static const char __pyx_k_val[] = "val";
1601 static const char __pyx_k_Lock[] = "Lock";
1602 static const char __pyx_k_dict[] = "__dict__";
1603 static const char __pyx_k_exit[] = "__exit__";
1604 static const char __pyx_k_file[] = "__file__";
1605 static const char __pyx_k_gdal[] = "gdal";
1606 static const char __pyx_k_info[] = "info";
1607 static const char __pyx_k_init[] = "__init__";
1608 static const char __pyx_k_join[] = "join";
1609 static const char __pyx_k_main[] = "__main__";
1610 static const char __pyx_k_name[] = "__name__";
1611 static const char __pyx_k_path[] = "path";
1612 static const char __pyx_k_proj[] = "proj";
1613 static const char __pyx_k_self[] = "self";
1614 static const char __pyx_k_test[] = "__test__";
1615 static const char __pyx_k_DEBUG[] = "DEBUG";
1616 static const char __pyx_k_ERROR[] = "ERROR";
1617 static const char __pyx_k_debug[] = "debug";
1618 static const char __pyx_k_enter[] = "__enter__";
1619 static const char __pyx_k_items[] = "items";
1620 static const char __pyx_k_lower[] = "lower";
1621 static const char __pyx_k_major[] = "major";
1622 static const char __pyx_k_minor[] = "minor";
1623 static const char __pyx_k_patch[] = "patch";
1624 static const char __pyx_k_range[] = "range";
1625 static const char __pyx_k_share[] = "share";
1626 static const char __pyx_k_super[] = "super";
1627 static const char __pyx_k_utf_8[] = "utf-8";
1628 static const char __pyx_k_where[] = "where";
1629 static const char __pyx_k_encode[] = "encode";
1630 static const char __pyx_k_exists[] = "exists";
1631 static const char __pyx_k_format[] = "format";
1632 static const char __pyx_k_import[] = "__import__";
1633 static const char __pyx_k_module[] = "__module__";
1634 static const char __pyx_k_name_2[] = "name";
1635 static const char __pyx_k_name_c[] = "name_c";
1636 static const char __pyx_k_object[] = "object";
1637 static const char __pyx_k_path_c[] = "path_c";
1638 static const char __pyx_k_pickle[] = "pickle";
1639 static const char __pyx_k_prefix[] = "prefix";
1640 static const char __pyx_k_reduce[] = "__reduce__";
1641 static const char __pyx_k_search[] = "search";
1642 static const char __pyx_k_update[] = "update";
1643 static const char __pyx_k_GDALEnv[] = "GDALEnv";
1644 static const char __pyx_k_WARNING[] = "WARNING";
1645 static const char __pyx_k_abspath[] = "abspath";
1646 static const char __pyx_k_certifi[] = "certifi";
1647 static const char __pyx_k_datadir[] = "datadir";
1648 static const char __pyx_k_dirname[] = "dirname";
1649 static const char __pyx_k_environ[] = "environ";
1650 static const char __pyx_k_isdigit[] = "isdigit";
1651 static const char __pyx_k_logging[] = "logging";
1652 static const char __pyx_k_maxsize[] = "maxsize";
1653 static const char __pyx_k_os_path[] = "os.path";
1654 static const char __pyx_k_popitem[] = "popitem";
1655 static const char __pyx_k_prepare[] = "__prepare__";
1656 static const char __pyx_k_CRITICAL[] = "CRITICAL";
1657 static const char __pyx_k_EnvError[] = "EnvError";
1658 static const char __pyx_k_PROJ_LIB[] = "PROJ_LIB";
1659 static const char __pyx_k_basename[] = "basename";
1660 static const char __pyx_k_code_map[] = "code_map";
1661 static const char __pyx_k_getstate[] = "__getstate__";
1662 static const char __pyx_k_has_data[] = "has_data";
1663 static const char __pyx_k_pyx_type[] = "__pyx_type";
1664 static const char __pyx_k_qualname[] = "__qualname__";
1665 static const char __pyx_k_revision[] = "revision";
1666 static const char __pyx_k_setstate[] = "__setstate__";
1667 static const char __pyx_k_CPLE_None[] = "CPLE_None";
1668 static const char __pyx_k_ConfigEnv[] = "ConfigEnv";
1669 static const char __pyx_k_GDAL_DATA[] = "GDAL_DATA";
1670 static const char __pyx_k_find_file[] = "find_file";
1671 static const char __pyx_k_gdal_data[] = "gdal_data";
1672 static const char __pyx_k_getLogger[] = "getLogger";
1673 static const char __pyx_k_level_map[] = "level_map";
1674 static const char __pyx_k_metaclass[] = "__metaclass__";
1675 static const char __pyx_k_normalize[] = "normalize";
1676 static const char __pyx_k_proj_data[] = "proj_data";
1677 static const char __pyx_k_pyx_state[] = "__pyx_state";
1678 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1679 static const char __pyx_k_threading[] = "threading";
1680 static const char __pyx_k_MainThread[] = "_MainThread";
1681 static const char __pyx_k_ObjectNull[] = "ObjectNull";
1682 static const char __pyx_k_ValueError[] = "ValueError";
1683 static const char __pyx_k_basename_b[] = "basename_b";
1684 static const char __pyx_k_fiona__env[] = "fiona._env";
1685 static const char __pyx_k_fiona__err[] = "fiona._err";
1686 static const char __pyx_k_header_dxf[] = "header.dxf";
1687 static const char __pyx_k_namedtuple[] = "namedtuple";
1688 static const char __pyx_k_pyx_result[] = "__pyx_result";
1689 static const char __pyx_k_setdefault[] = "setdefault";
1690 static const char __pyx_k_CPLE_FileIO[] = "CPLE_FileIO";
1691 static const char __pyx_k_GDALVersion[] = "GDALVersion";
1692 static const char __pyx_k_ImportError[] = "ImportError";
1693 static const char __pyx_k_PickleError[] = "PickleError";
1694 static const char __pyx_k_collections[] = "collections";
1695 static const char __pyx_k_driver_count[] = "driver_count";
1696 static const char __pyx_k_fiona_errors[] = "fiona.errors";
1697 static const char __pyx_k_proj_version[] = "proj_version";
1698 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1699 static const char __pyx_k_search_wheel[] = "search_wheel";
1700 static const char __pyx_k_stringsource[] = "stringsource";
1701 static const char __pyx_k_gdal_cachemax[] = "gdal_cachemax";
1702 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1703 static const char __pyx_k_search_debian[] = "search_debian";
1704 static const char __pyx_k_search_prefix[] = "search_prefix";
1705 static const char __pyx_k_CPLE_BaseError[] = "CPLE_BaseError";
1706 static const char __pyx_k_CURL_CA_BUNDLE[] = "CURL_CA_BUNDLE";
1707 static const char __pyx_k_GDALDataFinder[] = "GDALDataFinder";
1708 static const char __pyx_k_PROJDataFinder[] = "PROJDataFinder";
1709 static const char __pyx_k_current_thread[] = "current_thread";
1710 static const char __pyx_k_fiona__env_pyx[] = "fiona/_env.pyx";
1711 static const char __pyx_k_CPLE_AppDefined[] = "CPLE_AppDefined";
1712 static const char __pyx_k_CPLE_IllegalArg[] = "CPLE_IllegalArg";
1713 static const char __pyx_k_CPLE_OpenFailed[] = "CPLE_OpenFailed";
1714 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1715 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1716 static const char __pyx_k_CPLE_OutOfMemory[] = "CPLE_OutOfMemory";
1717 static const char __pyx_k_gdal_version_num[] = "gdal_version_num";
1718 static const char __pyx_k_CPLE_HttpResponse[] = "CPLE_HttpResponse";
1719 static const char __pyx_k_CPLE_NotSupported[] = "CPLE_NotSupported";
1720 static const char __pyx_k_Stopped_GDALEnv_r[] = "Stopped GDALEnv %r.";
1721 static const char __pyx_k_gdal_release_name[] = "gdal_release_name";
1722 static const char __pyx_k_CPLE_NoWriteAccess[] = "CPLE_NoWriteAccess";
1723 static const char __pyx_k_CPLE_UserInterrupt[] = "CPLE_UserInterrupt";
1724 static const char __pyx_k_Stopping_GDALEnv_r[] = "Stopping GDALEnv %r.";
1725 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1726 static const char __pyx_k_CPLE_AWSAccessDenied[] = "CPLE_AWSAccessDenied";
1727 static const char __pyx_k_CPLE_AssertionFailed[] = "CPLE_AssertionFailed";
1728 static const char __pyx_k_Error_handler_popped[] = "Error handler popped.";
1729 static const char __pyx_k_get_gdal_version_num[] = "get_gdal_version_num";
1730 static const char __pyx_k_pyx_unpickle_GDALEnv[] = "__pyx_unpickle_GDALEnv";
1731 static const char __pyx_k_GDALDataFinder_search[] = "GDALDataFinder.search";
1732 static const char __pyx_k_PROJDataFinder_search[] = "PROJDataFinder.search";
1733 static const char __pyx_k_calc_gdal_version_num[] = "calc_gdal_version_num";
1734 static const char __pyx_k_get_gdal_release_name[] = "get_gdal_release_name";
1735 static const char __pyx_k_update_config_options[] = "update_config_options";
1736 static const char __pyx_k_CPLE_AWSBucketNotFound[] = "CPLE_AWSBucketNotFound";
1737 static const char __pyx_k_CPLE_AWSObjectNotFound[] = "CPLE_AWSObjectNotFound";
1738 static const char __pyx_k_Drivers_not_registered[] = "Drivers not registered.";
1739 static const char __pyx_k_Started_GDALEnv_self_r[] = "Started GDALEnv: self=%r.";
1740 static const char __pyx_k_Unknown_error_number_r[] = "Unknown error number %r.";
1741 static const char __pyx_k_get_gdal_version_tuple[] = "get_gdal_version_tuple";
1742 static const char __pyx_k_get_proj_version_tuple[] = "get_proj_version_tuple";
1743 static const char __pyx_k_pyx_unpickle_ConfigEnv[] = "__pyx_unpickle_ConfigEnv";
1744 static const char __pyx_k_PROJDataFinder_has_data[] = "PROJDataFinder.has_data";
1745 static const char __pyx_k_GDALDataFinder_find_file[] = "GDALDataFinder.find_file";
1746 static const char __pyx_k_set_proj_data_search_path[] = "set_proj_data_search_path";
1747 static const char __pyx_k_CPLE_AWSInvalidCredentials[] = "CPLE_AWSInvalidCredentials";
1748 static const char __pyx_k_GDALDataFinder_search_wheel[] = "GDALDataFinder.search_wheel";
1749 static const char __pyx_k_PROJDataFinder_search_wheel[] = "PROJDataFinder.search_wheel";
1750 static const char __pyx_k_GDALDataFinder_search_debian[] = "GDALDataFinder.search_debian";
1751 static const char __pyx_k_GDALDataFinder_search_prefix[] = "GDALDataFinder.search_prefix";
1752 static const char __pyx_k_PROJDataFinder_search_prefix[] = "PROJDataFinder.search_prefix";
1753 static const char __pyx_k_CPLE_AWSSignatureDoesNotMatch[] = "CPLE_AWSSignatureDoesNotMatch";
1754 static const char __pyx_k_PROJ_LIB_found_in_environment[] = "PROJ_LIB found in environment.";
1755 static const char __pyx_k_GDAL_DATA_found_in_environment[] = "GDAL_DATA found in environment.";
1756 static const char __pyx_k_Finds_GDAL_data_files_Note_this[] = "Finds GDAL data files\n\n    Note: this is not part of the 1.8.x public API.\n\n    ";
1757 static const char __pyx_k_Finds_PROJ_data_files_Note_this[] = "Finds PROJ data files\n\n    Note: this is not part of the public 1.8.x API.\n\n    ";
1758 static const char __pyx_k_GDAL_data_found_in_package_path[] = "GDAL data found in package: path=%r.";
1759 static const char __pyx_k_PROJ_data_found_in_package_path[] = "PROJ data found in package: path=%r.";
1760 static const char __pyx_k_GDAL_and_OGR_driver_and_configur[] = "GDAL and OGR driver and configuration management\n\nThe main thread always utilizes CPLSetConfigOption. Child threads\nutilize CPLSetThreadLocalConfigOption instead. All threads use\nCPLGetConfigOption and not CPLGetThreadLocalConfigOption, thus child\nthreads will inherit config options from the main thread unless the\noption is set to a new value inside the thread.\n";
1761 static const char __pyx_k_GDAL_data_files_are_available_at[] = "GDAL data files are available at built-in paths.";
1762 static const char __pyx_k_GDAL_data_found_in_other_locatio[] = "GDAL data found in other locations: path=%r.";
1763 static const char __pyx_k_Incompatible_checksums_s_vs_0x26[] = "Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))";
1764 static const char __pyx_k_Incompatible_checksums_s_vs_0x93[] = "Incompatible checksums (%s vs 0x93da65a = (options))";
1765 static const char __pyx_k_PROJ_data_files_are_available_at[] = "PROJ data files are available at built-in paths.";
1766 static const char __pyx_k_PROJ_data_found_in_other_locatio[] = "PROJ data found in other locations: path=%r.";
1767 static PyObject *__pyx_n_u_CPLE_AWSAccessDenied;
1768 static PyObject *__pyx_n_u_CPLE_AWSBucketNotFound;
1769 static PyObject *__pyx_n_u_CPLE_AWSInvalidCredentials;
1770 static PyObject *__pyx_n_u_CPLE_AWSObjectNotFound;
1771 static PyObject *__pyx_n_u_CPLE_AWSSignatureDoesNotMatch;
1772 static PyObject *__pyx_n_u_CPLE_AppDefined;
1773 static PyObject *__pyx_n_u_CPLE_AssertionFailed;
1774 static PyObject *__pyx_n_s_CPLE_BaseError;
1775 static PyObject *__pyx_n_u_CPLE_FileIO;
1776 static PyObject *__pyx_n_u_CPLE_HttpResponse;
1777 static PyObject *__pyx_n_u_CPLE_IllegalArg;
1778 static PyObject *__pyx_n_u_CPLE_NoWriteAccess;
1779 static PyObject *__pyx_n_u_CPLE_None;
1780 static PyObject *__pyx_n_u_CPLE_NotSupported;
1781 static PyObject *__pyx_n_u_CPLE_OpenFailed;
1782 static PyObject *__pyx_n_u_CPLE_OutOfMemory;
1783 static PyObject *__pyx_n_u_CPLE_UserInterrupt;
1784 static PyObject *__pyx_n_s_CRITICAL;
1785 static PyObject *__pyx_n_u_CURL_CA_BUNDLE;
1786 static PyObject *__pyx_n_s_ConfigEnv;
1787 static PyObject *__pyx_n_s_DEBUG;
1788 static PyObject *__pyx_kp_u_Drivers_not_registered;
1789 static PyObject *__pyx_n_s_ERROR;
1790 static PyObject *__pyx_n_s_EnvError;
1791 static PyObject *__pyx_kp_u_Error_handler_popped;
1792 static PyObject *__pyx_kp_s_Finds_GDAL_data_files_Note_this;
1793 static PyObject *__pyx_kp_s_Finds_PROJ_data_files_Note_this;
1794 static PyObject *__pyx_n_s_GDALDataFinder;
1795 static PyObject *__pyx_n_s_GDALDataFinder_find_file;
1796 static PyObject *__pyx_n_s_GDALDataFinder_search;
1797 static PyObject *__pyx_n_s_GDALDataFinder_search_debian;
1798 static PyObject *__pyx_n_s_GDALDataFinder_search_prefix;
1799 static PyObject *__pyx_n_s_GDALDataFinder_search_wheel;
1800 static PyObject *__pyx_n_s_GDALEnv;
1801 static PyObject *__pyx_n_s_GDALVersion;
1802 static PyObject *__pyx_n_u_GDALVersion;
1803 static PyObject *__pyx_n_s_GDAL_DATA;
1804 static PyObject *__pyx_n_u_GDAL_DATA;
1805 static PyObject *__pyx_kp_u_GDAL_DATA_found_in_environment;
1806 static PyObject *__pyx_kp_u_GDAL_data_files_are_available_at;
1807 static PyObject *__pyx_kp_u_GDAL_data_found_in_other_locatio;
1808 static PyObject *__pyx_kp_u_GDAL_data_found_in_package_path;
1809 static PyObject *__pyx_n_s_ImportError;
1810 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x26;
1811 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x93;
1812 static PyObject *__pyx_n_s_Lock;
1813 static PyObject *__pyx_n_s_MainThread;
1814 static PyObject *__pyx_n_u_OFF;
1815 static PyObject *__pyx_n_u_ON;
1816 static PyObject *__pyx_n_u_ObjectNull;
1817 static PyObject *__pyx_n_s_PROJDataFinder;
1818 static PyObject *__pyx_n_s_PROJDataFinder_has_data;
1819 static PyObject *__pyx_n_s_PROJDataFinder_search;
1820 static PyObject *__pyx_n_s_PROJDataFinder_search_prefix;
1821 static PyObject *__pyx_n_s_PROJDataFinder_search_wheel;
1822 static PyObject *__pyx_n_u_PROJ_LIB;
1823 static PyObject *__pyx_kp_u_PROJ_LIB_found_in_environment;
1824 static PyObject *__pyx_kp_u_PROJ_data_files_are_available_at;
1825 static PyObject *__pyx_kp_u_PROJ_data_found_in_other_locatio;
1826 static PyObject *__pyx_kp_u_PROJ_data_found_in_package_path;
1827 static PyObject *__pyx_n_s_PickleError;
1828 static PyObject *__pyx_kp_u_Started_GDALEnv_self_r;
1829 static PyObject *__pyx_kp_u_Stopped_GDALEnv_r;
1830 static PyObject *__pyx_kp_u_Stopping_GDALEnv_r;
1831 static PyObject *__pyx_kp_u_Unknown_error_number_r;
1832 static PyObject *__pyx_n_s_ValueError;
1833 static PyObject *__pyx_n_s_WARNING;
1834 static PyObject *__pyx_kp_u__3;
1835 static PyObject *__pyx_kp_u__4;
1836 static PyObject *__pyx_n_s_abspath;
1837 static PyObject *__pyx_n_s_basename;
1838 static PyObject *__pyx_n_s_basename_b;
1839 static PyObject *__pyx_n_s_calc_gdal_version_num;
1840 static PyObject *__pyx_n_s_certifi;
1841 static PyObject *__pyx_n_s_cline_in_traceback;
1842 static PyObject *__pyx_n_s_code_map;
1843 static PyObject *__pyx_n_s_collections;
1844 static PyObject *__pyx_n_s_current_thread;
1845 static PyObject *__pyx_n_s_datadir;
1846 static PyObject *__pyx_n_s_debug;
1847 static PyObject *__pyx_n_s_dict;
1848 static PyObject *__pyx_n_s_dirname;
1849 static PyObject *__pyx_n_s_doc;
1850 static PyObject *__pyx_n_s_driver_count;
1851 static PyObject *__pyx_n_s_encode;
1852 static PyObject *__pyx_n_s_enter;
1853 static PyObject *__pyx_n_s_environ;
1854 static PyObject *__pyx_n_s_exists;
1855 static PyObject *__pyx_n_s_exit;
1856 static PyObject *__pyx_n_s_file;
1857 static PyObject *__pyx_n_s_find_file;
1858 static PyObject *__pyx_n_s_fiona__env;
1859 static PyObject *__pyx_kp_s_fiona__env_pyx;
1860 static PyObject *__pyx_n_s_fiona__err;
1861 static PyObject *__pyx_n_s_fiona_errors;
1862 static PyObject *__pyx_n_s_format;
1863 static PyObject *__pyx_n_u_gdal;
1864 static PyObject *__pyx_n_b_gdal_cachemax;
1865 static PyObject *__pyx_n_u_gdal_data;
1866 static PyObject *__pyx_n_s_gdal_release_name;
1867 static PyObject *__pyx_n_s_gdal_version_num;
1868 static PyObject *__pyx_n_s_getLogger;
1869 static PyObject *__pyx_n_s_get_gdal_release_name;
1870 static PyObject *__pyx_n_s_get_gdal_version_num;
1871 static PyObject *__pyx_n_s_get_gdal_version_tuple;
1872 static PyObject *__pyx_n_s_get_proj_version_tuple;
1873 static PyObject *__pyx_n_s_getstate;
1874 static PyObject *__pyx_n_s_has_data;
1875 static PyObject *__pyx_kp_u_header_dxf;
1876 static PyObject *__pyx_n_s_import;
1877 static PyObject *__pyx_n_s_info;
1878 static PyObject *__pyx_n_s_init;
1879 static PyObject *__pyx_n_s_isdigit;
1880 static PyObject *__pyx_n_s_items;
1881 static PyObject *__pyx_n_s_join;
1882 static PyObject *__pyx_n_s_key;
1883 static PyObject *__pyx_n_s_level_map;
1884 static PyObject *__pyx_n_s_log;
1885 static PyObject *__pyx_n_s_logging;
1886 static PyObject *__pyx_n_s_lower;
1887 static PyObject *__pyx_n_s_main;
1888 static PyObject *__pyx_n_s_maj;
1889 static PyObject *__pyx_n_s_major;
1890 static PyObject *__pyx_n_u_major;
1891 static PyObject *__pyx_n_s_maxsize;
1892 static PyObject *__pyx_n_s_metaclass;
1893 static PyObject *__pyx_n_s_min;
1894 static PyObject *__pyx_n_s_minor;
1895 static PyObject *__pyx_n_u_minor;
1896 static PyObject *__pyx_n_s_module;
1897 static PyObject *__pyx_n_s_name;
1898 static PyObject *__pyx_n_s_name_2;
1899 static PyObject *__pyx_n_s_name_c;
1900 static PyObject *__pyx_n_s_namedtuple;
1901 static PyObject *__pyx_n_s_new;
1902 static PyObject *__pyx_n_s_normalize;
1903 static PyObject *__pyx_n_s_object;
1904 static PyObject *__pyx_n_s_os;
1905 static PyObject *__pyx_n_s_os_path;
1906 static PyObject *__pyx_n_s_osr;
1907 static PyObject *__pyx_n_s_patch;
1908 static PyObject *__pyx_n_s_path;
1909 static PyObject *__pyx_n_s_path_c;
1910 static PyObject *__pyx_n_s_pickle;
1911 static PyObject *__pyx_n_s_popitem;
1912 static PyObject *__pyx_n_s_prefix;
1913 static PyObject *__pyx_n_s_prepare;
1914 static PyObject *__pyx_n_u_proj;
1915 static PyObject *__pyx_n_u_proj_data;
1916 static PyObject *__pyx_n_s_proj_version;
1917 static PyObject *__pyx_n_s_pyx_PickleError;
1918 static PyObject *__pyx_n_s_pyx_checksum;
1919 static PyObject *__pyx_n_s_pyx_result;
1920 static PyObject *__pyx_n_s_pyx_state;
1921 static PyObject *__pyx_n_s_pyx_type;
1922 static PyObject *__pyx_n_s_pyx_unpickle_ConfigEnv;
1923 static PyObject *__pyx_n_s_pyx_unpickle_GDALEnv;
1924 static PyObject *__pyx_n_s_qualname;
1925 static PyObject *__pyx_n_s_range;
1926 static PyObject *__pyx_n_s_reduce;
1927 static PyObject *__pyx_n_s_reduce_cython;
1928 static PyObject *__pyx_n_s_reduce_ex;
1929 static PyObject *__pyx_n_s_rev;
1930 static PyObject *__pyx_n_s_revision;
1931 static PyObject *__pyx_n_u_revision;
1932 static PyObject *__pyx_kp_u_s;
1933 static PyObject *__pyx_n_s_search;
1934 static PyObject *__pyx_n_s_search_debian;
1935 static PyObject *__pyx_n_s_search_prefix;
1936 static PyObject *__pyx_n_s_search_wheel;
1937 static PyObject *__pyx_n_s_self;
1938 static PyObject *__pyx_n_s_set_proj_data_search_path;
1939 static PyObject *__pyx_n_s_setdefault;
1940 static PyObject *__pyx_n_s_setstate;
1941 static PyObject *__pyx_n_s_setstate_cython;
1942 static PyObject *__pyx_n_u_share;
1943 static PyObject *__pyx_kp_s_stringsource;
1944 static PyObject *__pyx_n_s_super;
1945 static PyObject *__pyx_n_s_sys;
1946 static PyObject *__pyx_n_s_test;
1947 static PyObject *__pyx_n_s_threading;
1948 static PyObject *__pyx_n_s_update;
1949 static PyObject *__pyx_n_s_update_config_options;
1950 static PyObject *__pyx_kp_u_utf_8;
1951 static PyObject *__pyx_n_s_val;
1952 static PyObject *__pyx_n_s_where;
1953 static PyObject *__pyx_pf_5fiona_4_env_calc_gdal_version_num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_maj, PyObject *__pyx_v_min, PyObject *__pyx_v_rev); /* proto */
1954 static PyObject *__pyx_pf_5fiona_4_env_2get_gdal_version_num(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1955 static PyObject *__pyx_pf_5fiona_4_env_4get_gdal_release_name(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1956 static PyObject *__pyx_pf_5fiona_4_env_6get_gdal_version_tuple(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1957 static PyObject *__pyx_pf_5fiona_4_env_8get_proj_version_tuple(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1958 static PyObject *__pyx_pf_5fiona_4_env_10driver_count(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1959 static PyObject *__pyx_pf_5fiona_4_env_12get_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_normalize); /* proto */
1960 static PyObject *__pyx_pf_5fiona_4_env_14set_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_val, PyObject *__pyx_v_normalize); /* proto */
1961 static PyObject *__pyx_pf_5fiona_4_env_16del_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key); /* proto */
1962 static int __pyx_pf_5fiona_4_env_9ConfigEnv___init__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
1963 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_2update_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
1964 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_4clear_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self); /* proto */
1965 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_6get_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self); /* proto */
1966 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_7options___get__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self); /* proto */
1967 static int __pyx_pf_5fiona_4_env_9ConfigEnv_7options_2__set__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1968 static int __pyx_pf_5fiona_4_env_9ConfigEnv_7options_4__del__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self); /* proto */
1969 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self); /* proto */
1970 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1971 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_find_file(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_basename); /* proto */
1972 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_2search(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1973 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_4search_wheel(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1974 static PyObject *__pyx_pf_5fiona_4_env_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1975 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_6search_prefix(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1976 static PyObject *__pyx_pf_5fiona_4_env_26__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1977 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_8search_debian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1978 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_has_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1979 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_2search(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1980 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_4search_wheel(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1981 static PyObject *__pyx_pf_5fiona_4_env_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1982 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_6search_prefix(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1983 static int __pyx_pf_5fiona_4_env_7GDALEnv___init__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
1984 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_2start(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1985 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_4stop(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1986 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_6drivers(CYTHON_UNUSED struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1987 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers___get__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1988 static int __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_2__set__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1989 static int __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_4__del__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1990 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self); /* proto */
1991 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1992 static PyObject *__pyx_pf_5fiona_4_env_18set_proj_data_search_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */
1993 static PyObject *__pyx_pf_5fiona_4_env_20__pyx_unpickle_ConfigEnv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1994 static PyObject *__pyx_pf_5fiona_4_env_22__pyx_unpickle_GDALEnv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1995 static PyObject *__pyx_tp_new_5fiona_4_env_ConfigEnv(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1996 static PyObject *__pyx_tp_new_5fiona_4_env_GDALEnv(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1997 static PyObject *__pyx_int_0;
1998 static PyObject *__pyx_int_1;
1999 static PyObject *__pyx_int_2;
2000 static PyObject *__pyx_int_3;
2001 static PyObject *__pyx_int_4;
2002 static PyObject *__pyx_int_5;
2003 static PyObject *__pyx_int_6;
2004 static PyObject *__pyx_int_7;
2005 static PyObject *__pyx_int_8;
2006 static PyObject *__pyx_int_9;
2007 static PyObject *__pyx_int_10;
2008 static PyObject *__pyx_int_11;
2009 static PyObject *__pyx_int_12;
2010 static PyObject *__pyx_int_13;
2011 static PyObject *__pyx_int_14;
2012 static PyObject *__pyx_int_15;
2013 static PyObject *__pyx_int_16;
2014 static PyObject *__pyx_int_100;
2015 static PyObject *__pyx_int_1000;
2016 static PyObject *__pyx_int_10000;
2017 static PyObject *__pyx_int_1000000;
2018 static PyObject *__pyx_int_40410864;
2019 static PyObject *__pyx_int_155035226;
2020 static PyObject *__pyx_int_4294967296;
2021 static PyObject *__pyx_tuple_;
2022 static PyObject *__pyx_slice__5;
2023 static PyObject *__pyx_tuple__2;
2024 static PyObject *__pyx_tuple__6;
2025 static PyObject *__pyx_tuple__7;
2026 static PyObject *__pyx_tuple__8;
2027 static PyObject *__pyx_tuple__11;
2028 static PyObject *__pyx_tuple__13;
2029 static PyObject *__pyx_tuple__15;
2030 static PyObject *__pyx_tuple__18;
2031 static PyObject *__pyx_tuple__19;
2032 static PyObject *__pyx_tuple__21;
2033 static PyObject *__pyx_tuple__23;
2034 static PyObject *__pyx_tuple__24;
2035 static PyObject *__pyx_tuple__26;
2036 static PyObject *__pyx_tuple__27;
2037 static PyObject *__pyx_tuple__29;
2038 static PyObject *__pyx_tuple__31;
2039 static PyObject *__pyx_tuple__32;
2040 static PyObject *__pyx_tuple__34;
2041 static PyObject *__pyx_tuple__36;
2042 static PyObject *__pyx_tuple__37;
2043 static PyObject *__pyx_tuple__39;
2044 static PyObject *__pyx_tuple__40;
2045 static PyObject *__pyx_tuple__42;
2046 static PyObject *__pyx_tuple__44;
2047 static PyObject *__pyx_tuple__46;
2048 static PyObject *__pyx_codeobj__9;
2049 static PyObject *__pyx_codeobj__10;
2050 static PyObject *__pyx_codeobj__12;
2051 static PyObject *__pyx_codeobj__14;
2052 static PyObject *__pyx_codeobj__16;
2053 static PyObject *__pyx_codeobj__17;
2054 static PyObject *__pyx_codeobj__20;
2055 static PyObject *__pyx_codeobj__22;
2056 static PyObject *__pyx_codeobj__25;
2057 static PyObject *__pyx_codeobj__28;
2058 static PyObject *__pyx_codeobj__30;
2059 static PyObject *__pyx_codeobj__33;
2060 static PyObject *__pyx_codeobj__35;
2061 static PyObject *__pyx_codeobj__38;
2062 static PyObject *__pyx_codeobj__41;
2063 static PyObject *__pyx_codeobj__43;
2064 static PyObject *__pyx_codeobj__45;
2065 static PyObject *__pyx_codeobj__47;
2066 /* Late includes */
2067 
2068 /* "fiona/_env.pyx":67
2069  *
2070  *
2071  * cdef _safe_osr_release(OGRSpatialReferenceH srs):             # <<<<<<<<<<<<<<
2072  *     """Wrapper to handle OSR release when NULL."""
2073  *     if srs != NULL:
2074  */
2075 
__pyx_f_5fiona_4_env__safe_osr_release(OGRSpatialReferenceH __pyx_v_srs)2076 static PyObject *__pyx_f_5fiona_4_env__safe_osr_release(OGRSpatialReferenceH __pyx_v_srs) {
2077   PyObject *__pyx_r = NULL;
2078   __Pyx_RefNannyDeclarations
2079   int __pyx_t_1;
2080   __Pyx_RefNannySetupContext("_safe_osr_release", 0);
2081 
2082   /* "fiona/_env.pyx":69
2083  * cdef _safe_osr_release(OGRSpatialReferenceH srs):
2084  *     """Wrapper to handle OSR release when NULL."""
2085  *     if srs != NULL:             # <<<<<<<<<<<<<<
2086  *         OSRRelease(srs)
2087  *     srs = NULL
2088  */
2089   __pyx_t_1 = ((__pyx_v_srs != NULL) != 0);
2090   if (__pyx_t_1) {
2091 
2092     /* "fiona/_env.pyx":70
2093  *     """Wrapper to handle OSR release when NULL."""
2094  *     if srs != NULL:
2095  *         OSRRelease(srs)             # <<<<<<<<<<<<<<
2096  *     srs = NULL
2097  *
2098  */
2099     OSRRelease(__pyx_v_srs);
2100 
2101     /* "fiona/_env.pyx":69
2102  * cdef _safe_osr_release(OGRSpatialReferenceH srs):
2103  *     """Wrapper to handle OSR release when NULL."""
2104  *     if srs != NULL:             # <<<<<<<<<<<<<<
2105  *         OSRRelease(srs)
2106  *     srs = NULL
2107  */
2108   }
2109 
2110   /* "fiona/_env.pyx":71
2111  *     if srs != NULL:
2112  *         OSRRelease(srs)
2113  *     srs = NULL             # <<<<<<<<<<<<<<
2114  *
2115  *
2116  */
2117   __pyx_v_srs = NULL;
2118 
2119   /* "fiona/_env.pyx":67
2120  *
2121  *
2122  * cdef _safe_osr_release(OGRSpatialReferenceH srs):             # <<<<<<<<<<<<<<
2123  *     """Wrapper to handle OSR release when NULL."""
2124  *     if srs != NULL:
2125  */
2126 
2127   /* function exit code */
2128   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2129   __Pyx_XGIVEREF(__pyx_r);
2130   __Pyx_RefNannyFinishContext();
2131   return __pyx_r;
2132 }
2133 
2134 /* "fiona/_env.pyx":74
2135  *
2136  *
2137  * def calc_gdal_version_num(maj, min, rev):             # <<<<<<<<<<<<<<
2138  *     """Calculates the internal gdal version number based on major, minor and revision
2139  *
2140  */
2141 
2142 /* Python wrapper */
2143 static PyObject *__pyx_pw_5fiona_4_env_1calc_gdal_version_num(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2144 static char __pyx_doc_5fiona_4_env_calc_gdal_version_num[] = "Calculates the internal gdal version number based on major, minor and revision\n\n    GDAL Version Information macro changed with GDAL version 1.10.0 (April 2013)\n\n    ";
2145 static PyMethodDef __pyx_mdef_5fiona_4_env_1calc_gdal_version_num = {"calc_gdal_version_num", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_1calc_gdal_version_num, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_calc_gdal_version_num};
__pyx_pw_5fiona_4_env_1calc_gdal_version_num(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2146 static PyObject *__pyx_pw_5fiona_4_env_1calc_gdal_version_num(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2147   PyObject *__pyx_v_maj = 0;
2148   PyObject *__pyx_v_min = 0;
2149   PyObject *__pyx_v_rev = 0;
2150   int __pyx_lineno = 0;
2151   const char *__pyx_filename = NULL;
2152   int __pyx_clineno = 0;
2153   PyObject *__pyx_r = 0;
2154   __Pyx_RefNannyDeclarations
2155   __Pyx_RefNannySetupContext("calc_gdal_version_num (wrapper)", 0);
2156   {
2157     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maj,&__pyx_n_s_min,&__pyx_n_s_rev,0};
2158     PyObject* values[3] = {0,0,0};
2159     if (unlikely(__pyx_kwds)) {
2160       Py_ssize_t kw_args;
2161       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2162       switch (pos_args) {
2163         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2164         CYTHON_FALLTHROUGH;
2165         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2166         CYTHON_FALLTHROUGH;
2167         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2168         CYTHON_FALLTHROUGH;
2169         case  0: break;
2170         default: goto __pyx_L5_argtuple_error;
2171       }
2172       kw_args = PyDict_Size(__pyx_kwds);
2173       switch (pos_args) {
2174         case  0:
2175         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maj)) != 0)) kw_args--;
2176         else goto __pyx_L5_argtuple_error;
2177         CYTHON_FALLTHROUGH;
2178         case  1:
2179         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min)) != 0)) kw_args--;
2180         else {
2181           __Pyx_RaiseArgtupleInvalid("calc_gdal_version_num", 1, 3, 3, 1); __PYX_ERR(0, 74, __pyx_L3_error)
2182         }
2183         CYTHON_FALLTHROUGH;
2184         case  2:
2185         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rev)) != 0)) kw_args--;
2186         else {
2187           __Pyx_RaiseArgtupleInvalid("calc_gdal_version_num", 1, 3, 3, 2); __PYX_ERR(0, 74, __pyx_L3_error)
2188         }
2189       }
2190       if (unlikely(kw_args > 0)) {
2191         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_gdal_version_num") < 0)) __PYX_ERR(0, 74, __pyx_L3_error)
2192       }
2193     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2194       goto __pyx_L5_argtuple_error;
2195     } else {
2196       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2197       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2198       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2199     }
2200     __pyx_v_maj = values[0];
2201     __pyx_v_min = values[1];
2202     __pyx_v_rev = values[2];
2203   }
2204   goto __pyx_L4_argument_unpacking_done;
2205   __pyx_L5_argtuple_error:;
2206   __Pyx_RaiseArgtupleInvalid("calc_gdal_version_num", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
2207   __pyx_L3_error:;
2208   __Pyx_AddTraceback("fiona._env.calc_gdal_version_num", __pyx_clineno, __pyx_lineno, __pyx_filename);
2209   __Pyx_RefNannyFinishContext();
2210   return NULL;
2211   __pyx_L4_argument_unpacking_done:;
2212   __pyx_r = __pyx_pf_5fiona_4_env_calc_gdal_version_num(__pyx_self, __pyx_v_maj, __pyx_v_min, __pyx_v_rev);
2213 
2214   /* function exit code */
2215   __Pyx_RefNannyFinishContext();
2216   return __pyx_r;
2217 }
2218 
__pyx_pf_5fiona_4_env_calc_gdal_version_num(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_maj,PyObject * __pyx_v_min,PyObject * __pyx_v_rev)2219 static PyObject *__pyx_pf_5fiona_4_env_calc_gdal_version_num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_maj, PyObject *__pyx_v_min, PyObject *__pyx_v_rev) {
2220   PyObject *__pyx_r = NULL;
2221   __Pyx_RefNannyDeclarations
2222   PyObject *__pyx_t_1 = NULL;
2223   PyObject *__pyx_t_2 = NULL;
2224   int __pyx_t_3;
2225   PyObject *__pyx_t_4 = NULL;
2226   int __pyx_lineno = 0;
2227   const char *__pyx_filename = NULL;
2228   int __pyx_clineno = 0;
2229   __Pyx_RefNannySetupContext("calc_gdal_version_num", 0);
2230 
2231   /* "fiona/_env.pyx":80
2232  *
2233  *     """
2234  *     if (maj, min, rev) >= (1, 10, 0):             # <<<<<<<<<<<<<<
2235  *         return int(maj * 1000000 + min * 10000 + rev * 100)
2236  *     else:
2237  */
2238   __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2239   __Pyx_GOTREF(__pyx_t_1);
2240   __Pyx_INCREF(__pyx_v_maj);
2241   __Pyx_GIVEREF(__pyx_v_maj);
2242   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_maj);
2243   __Pyx_INCREF(__pyx_v_min);
2244   __Pyx_GIVEREF(__pyx_v_min);
2245   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_min);
2246   __Pyx_INCREF(__pyx_v_rev);
2247   __Pyx_GIVEREF(__pyx_v_rev);
2248   PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_rev);
2249   __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_tuple_, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
2250   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2251   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 80, __pyx_L1_error)
2252   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2253   if (__pyx_t_3) {
2254 
2255     /* "fiona/_env.pyx":81
2256  *     """
2257  *     if (maj, min, rev) >= (1, 10, 0):
2258  *         return int(maj * 1000000 + min * 10000 + rev * 100)             # <<<<<<<<<<<<<<
2259  *     else:
2260  *         return int(maj * 1000 + min * 100 + rev * 10)
2261  */
2262     __Pyx_XDECREF(__pyx_r);
2263     __pyx_t_2 = PyNumber_Multiply(__pyx_v_maj, __pyx_int_1000000); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
2264     __Pyx_GOTREF(__pyx_t_2);
2265     __pyx_t_1 = PyNumber_Multiply(__pyx_v_min, __pyx_int_10000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
2266     __Pyx_GOTREF(__pyx_t_1);
2267     __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
2268     __Pyx_GOTREF(__pyx_t_4);
2269     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2270     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2271     __pyx_t_1 = PyNumber_Multiply(__pyx_v_rev, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
2272     __Pyx_GOTREF(__pyx_t_1);
2273     __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
2274     __Pyx_GOTREF(__pyx_t_2);
2275     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2276     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2277     __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
2278     __Pyx_GOTREF(__pyx_t_1);
2279     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2280     __pyx_r = __pyx_t_1;
2281     __pyx_t_1 = 0;
2282     goto __pyx_L0;
2283 
2284     /* "fiona/_env.pyx":80
2285  *
2286  *     """
2287  *     if (maj, min, rev) >= (1, 10, 0):             # <<<<<<<<<<<<<<
2288  *         return int(maj * 1000000 + min * 10000 + rev * 100)
2289  *     else:
2290  */
2291   }
2292 
2293   /* "fiona/_env.pyx":83
2294  *         return int(maj * 1000000 + min * 10000 + rev * 100)
2295  *     else:
2296  *         return int(maj * 1000 + min * 100 + rev * 10)             # <<<<<<<<<<<<<<
2297  *
2298  *
2299  */
2300   /*else*/ {
2301     __Pyx_XDECREF(__pyx_r);
2302     __pyx_t_1 = PyNumber_Multiply(__pyx_v_maj, __pyx_int_1000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2303     __Pyx_GOTREF(__pyx_t_1);
2304     __pyx_t_2 = PyNumber_Multiply(__pyx_v_min, __pyx_int_100); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2305     __Pyx_GOTREF(__pyx_t_2);
2306     __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
2307     __Pyx_GOTREF(__pyx_t_4);
2308     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2309     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2310     __pyx_t_2 = PyNumber_Multiply(__pyx_v_rev, __pyx_int_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2311     __Pyx_GOTREF(__pyx_t_2);
2312     __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2313     __Pyx_GOTREF(__pyx_t_1);
2314     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2315     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2316     __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2317     __Pyx_GOTREF(__pyx_t_2);
2318     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2319     __pyx_r = __pyx_t_2;
2320     __pyx_t_2 = 0;
2321     goto __pyx_L0;
2322   }
2323 
2324   /* "fiona/_env.pyx":74
2325  *
2326  *
2327  * def calc_gdal_version_num(maj, min, rev):             # <<<<<<<<<<<<<<
2328  *     """Calculates the internal gdal version number based on major, minor and revision
2329  *
2330  */
2331 
2332   /* function exit code */
2333   __pyx_L1_error:;
2334   __Pyx_XDECREF(__pyx_t_1);
2335   __Pyx_XDECREF(__pyx_t_2);
2336   __Pyx_XDECREF(__pyx_t_4);
2337   __Pyx_AddTraceback("fiona._env.calc_gdal_version_num", __pyx_clineno, __pyx_lineno, __pyx_filename);
2338   __pyx_r = NULL;
2339   __pyx_L0:;
2340   __Pyx_XGIVEREF(__pyx_r);
2341   __Pyx_RefNannyFinishContext();
2342   return __pyx_r;
2343 }
2344 
2345 /* "fiona/_env.pyx":86
2346  *
2347  *
2348  * def get_gdal_version_num():             # <<<<<<<<<<<<<<
2349  *     """Return current internal version number of gdal"""
2350  *     return int(GDALVersionInfo("VERSION_NUM"))
2351  */
2352 
2353 /* Python wrapper */
2354 static PyObject *__pyx_pw_5fiona_4_env_3get_gdal_version_num(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2355 static char __pyx_doc_5fiona_4_env_2get_gdal_version_num[] = "Return current internal version number of gdal";
2356 static PyMethodDef __pyx_mdef_5fiona_4_env_3get_gdal_version_num = {"get_gdal_version_num", (PyCFunction)__pyx_pw_5fiona_4_env_3get_gdal_version_num, METH_NOARGS, __pyx_doc_5fiona_4_env_2get_gdal_version_num};
__pyx_pw_5fiona_4_env_3get_gdal_version_num(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2357 static PyObject *__pyx_pw_5fiona_4_env_3get_gdal_version_num(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2358   PyObject *__pyx_r = 0;
2359   __Pyx_RefNannyDeclarations
2360   __Pyx_RefNannySetupContext("get_gdal_version_num (wrapper)", 0);
2361   __pyx_r = __pyx_pf_5fiona_4_env_2get_gdal_version_num(__pyx_self);
2362 
2363   /* function exit code */
2364   __Pyx_RefNannyFinishContext();
2365   return __pyx_r;
2366 }
2367 
__pyx_pf_5fiona_4_env_2get_gdal_version_num(CYTHON_UNUSED PyObject * __pyx_self)2368 static PyObject *__pyx_pf_5fiona_4_env_2get_gdal_version_num(CYTHON_UNUSED PyObject *__pyx_self) {
2369   PyObject *__pyx_r = NULL;
2370   __Pyx_RefNannyDeclarations
2371   PyObject *__pyx_t_1 = NULL;
2372   PyObject *__pyx_t_2 = NULL;
2373   int __pyx_lineno = 0;
2374   const char *__pyx_filename = NULL;
2375   int __pyx_clineno = 0;
2376   __Pyx_RefNannySetupContext("get_gdal_version_num", 0);
2377 
2378   /* "fiona/_env.pyx":88
2379  * def get_gdal_version_num():
2380  *     """Return current internal version number of gdal"""
2381  *     return int(GDALVersionInfo("VERSION_NUM"))             # <<<<<<<<<<<<<<
2382  *
2383  *
2384  */
2385   __Pyx_XDECREF(__pyx_r);
2386   __pyx_t_1 = __Pyx_PyUnicode_FromString(GDALVersionInfo(((char const *)"VERSION_NUM"))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
2387   __Pyx_GOTREF(__pyx_t_1);
2388   __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
2389   __Pyx_GOTREF(__pyx_t_2);
2390   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2391   __pyx_r = __pyx_t_2;
2392   __pyx_t_2 = 0;
2393   goto __pyx_L0;
2394 
2395   /* "fiona/_env.pyx":86
2396  *
2397  *
2398  * def get_gdal_version_num():             # <<<<<<<<<<<<<<
2399  *     """Return current internal version number of gdal"""
2400  *     return int(GDALVersionInfo("VERSION_NUM"))
2401  */
2402 
2403   /* function exit code */
2404   __pyx_L1_error:;
2405   __Pyx_XDECREF(__pyx_t_1);
2406   __Pyx_XDECREF(__pyx_t_2);
2407   __Pyx_AddTraceback("fiona._env.get_gdal_version_num", __pyx_clineno, __pyx_lineno, __pyx_filename);
2408   __pyx_r = NULL;
2409   __pyx_L0:;
2410   __Pyx_XGIVEREF(__pyx_r);
2411   __Pyx_RefNannyFinishContext();
2412   return __pyx_r;
2413 }
2414 
2415 /* "fiona/_env.pyx":91
2416  *
2417  *
2418  * def get_gdal_release_name():             # <<<<<<<<<<<<<<
2419  *     """Return release name of gdal"""
2420  *     cdef const char *name_c = NULL
2421  */
2422 
2423 /* Python wrapper */
2424 static PyObject *__pyx_pw_5fiona_4_env_5get_gdal_release_name(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2425 static char __pyx_doc_5fiona_4_env_4get_gdal_release_name[] = "Return release name of gdal";
2426 static PyMethodDef __pyx_mdef_5fiona_4_env_5get_gdal_release_name = {"get_gdal_release_name", (PyCFunction)__pyx_pw_5fiona_4_env_5get_gdal_release_name, METH_NOARGS, __pyx_doc_5fiona_4_env_4get_gdal_release_name};
__pyx_pw_5fiona_4_env_5get_gdal_release_name(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2427 static PyObject *__pyx_pw_5fiona_4_env_5get_gdal_release_name(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2428   PyObject *__pyx_r = 0;
2429   __Pyx_RefNannyDeclarations
2430   __Pyx_RefNannySetupContext("get_gdal_release_name (wrapper)", 0);
2431   __pyx_r = __pyx_pf_5fiona_4_env_4get_gdal_release_name(__pyx_self);
2432 
2433   /* function exit code */
2434   __Pyx_RefNannyFinishContext();
2435   return __pyx_r;
2436 }
2437 
__pyx_pf_5fiona_4_env_4get_gdal_release_name(CYTHON_UNUSED PyObject * __pyx_self)2438 static PyObject *__pyx_pf_5fiona_4_env_4get_gdal_release_name(CYTHON_UNUSED PyObject *__pyx_self) {
2439   char const *__pyx_v_name_c;
2440   char const *__pyx_v_name;
2441   PyObject *__pyx_r = NULL;
2442   __Pyx_RefNannyDeclarations
2443   PyObject *__pyx_t_1 = NULL;
2444   int __pyx_lineno = 0;
2445   const char *__pyx_filename = NULL;
2446   int __pyx_clineno = 0;
2447   __Pyx_RefNannySetupContext("get_gdal_release_name", 0);
2448 
2449   /* "fiona/_env.pyx":93
2450  * def get_gdal_release_name():
2451  *     """Return release name of gdal"""
2452  *     cdef const char *name_c = NULL             # <<<<<<<<<<<<<<
2453  *     name_c = GDALVersionInfo("RELEASE_NAME")
2454  *     name = name_c
2455  */
2456   __pyx_v_name_c = NULL;
2457 
2458   /* "fiona/_env.pyx":94
2459  *     """Return release name of gdal"""
2460  *     cdef const char *name_c = NULL
2461  *     name_c = GDALVersionInfo("RELEASE_NAME")             # <<<<<<<<<<<<<<
2462  *     name = name_c
2463  *     return name
2464  */
2465   __pyx_v_name_c = GDALVersionInfo(((char const *)"RELEASE_NAME"));
2466 
2467   /* "fiona/_env.pyx":95
2468  *     cdef const char *name_c = NULL
2469  *     name_c = GDALVersionInfo("RELEASE_NAME")
2470  *     name = name_c             # <<<<<<<<<<<<<<
2471  *     return name
2472  *
2473  */
2474   __pyx_v_name = __pyx_v_name_c;
2475 
2476   /* "fiona/_env.pyx":96
2477  *     name_c = GDALVersionInfo("RELEASE_NAME")
2478  *     name = name_c
2479  *     return name             # <<<<<<<<<<<<<<
2480  *
2481  *
2482  */
2483   __Pyx_XDECREF(__pyx_r);
2484   __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2485   __Pyx_GOTREF(__pyx_t_1);
2486   __pyx_r = __pyx_t_1;
2487   __pyx_t_1 = 0;
2488   goto __pyx_L0;
2489 
2490   /* "fiona/_env.pyx":91
2491  *
2492  *
2493  * def get_gdal_release_name():             # <<<<<<<<<<<<<<
2494  *     """Return release name of gdal"""
2495  *     cdef const char *name_c = NULL
2496  */
2497 
2498   /* function exit code */
2499   __pyx_L1_error:;
2500   __Pyx_XDECREF(__pyx_t_1);
2501   __Pyx_AddTraceback("fiona._env.get_gdal_release_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
2502   __pyx_r = NULL;
2503   __pyx_L0:;
2504   __Pyx_XGIVEREF(__pyx_r);
2505   __Pyx_RefNannyFinishContext();
2506   return __pyx_r;
2507 }
2508 
2509 /* "fiona/_env.pyx":102
2510  *
2511  *
2512  * def get_gdal_version_tuple():             # <<<<<<<<<<<<<<
2513  *     """
2514  *     Calculates gdal version tuple from gdal's internal version number.
2515  */
2516 
2517 /* Python wrapper */
2518 static PyObject *__pyx_pw_5fiona_4_env_7get_gdal_version_tuple(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2519 static char __pyx_doc_5fiona_4_env_6get_gdal_version_tuple[] = "\n    Calculates gdal version tuple from gdal's internal version number.\n\n    GDAL Version Information macro changed with GDAL version 1.10.0 (April 2013)\n    ";
2520 static PyMethodDef __pyx_mdef_5fiona_4_env_7get_gdal_version_tuple = {"get_gdal_version_tuple", (PyCFunction)__pyx_pw_5fiona_4_env_7get_gdal_version_tuple, METH_NOARGS, __pyx_doc_5fiona_4_env_6get_gdal_version_tuple};
__pyx_pw_5fiona_4_env_7get_gdal_version_tuple(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2521 static PyObject *__pyx_pw_5fiona_4_env_7get_gdal_version_tuple(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2522   PyObject *__pyx_r = 0;
2523   __Pyx_RefNannyDeclarations
2524   __Pyx_RefNannySetupContext("get_gdal_version_tuple (wrapper)", 0);
2525   __pyx_r = __pyx_pf_5fiona_4_env_6get_gdal_version_tuple(__pyx_self);
2526 
2527   /* function exit code */
2528   __Pyx_RefNannyFinishContext();
2529   return __pyx_r;
2530 }
2531 
__pyx_pf_5fiona_4_env_6get_gdal_version_tuple(CYTHON_UNUSED PyObject * __pyx_self)2532 static PyObject *__pyx_pf_5fiona_4_env_6get_gdal_version_tuple(CYTHON_UNUSED PyObject *__pyx_self) {
2533   PyObject *__pyx_v_gdal_version_num = NULL;
2534   PyObject *__pyx_v_major = NULL;
2535   PyObject *__pyx_v_minor = NULL;
2536   PyObject *__pyx_v_revision = NULL;
2537   PyObject *__pyx_r = NULL;
2538   __Pyx_RefNannyDeclarations
2539   PyObject *__pyx_t_1 = NULL;
2540   PyObject *__pyx_t_2 = NULL;
2541   PyObject *__pyx_t_3 = NULL;
2542   int __pyx_t_4;
2543   int __pyx_t_5;
2544   PyObject *__pyx_t_6 = NULL;
2545   int __pyx_lineno = 0;
2546   const char *__pyx_filename = NULL;
2547   int __pyx_clineno = 0;
2548   __Pyx_RefNannySetupContext("get_gdal_version_tuple", 0);
2549 
2550   /* "fiona/_env.pyx":108
2551  *     GDAL Version Information macro changed with GDAL version 1.10.0 (April 2013)
2552  *     """
2553  *     gdal_version_num = get_gdal_version_num()             # <<<<<<<<<<<<<<
2554  *
2555  *     if gdal_version_num >= calc_gdal_version_num(1, 10, 0):
2556  */
2557   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_gdal_version_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
2558   __Pyx_GOTREF(__pyx_t_2);
2559   __pyx_t_3 = NULL;
2560   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2561     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2562     if (likely(__pyx_t_3)) {
2563       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2564       __Pyx_INCREF(__pyx_t_3);
2565       __Pyx_INCREF(function);
2566       __Pyx_DECREF_SET(__pyx_t_2, function);
2567     }
2568   }
2569   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
2570   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2571   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
2572   __Pyx_GOTREF(__pyx_t_1);
2573   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2574   __pyx_v_gdal_version_num = __pyx_t_1;
2575   __pyx_t_1 = 0;
2576 
2577   /* "fiona/_env.pyx":110
2578  *     gdal_version_num = get_gdal_version_num()
2579  *
2580  *     if gdal_version_num >= calc_gdal_version_num(1, 10, 0):             # <<<<<<<<<<<<<<
2581  *         major = gdal_version_num // 1000000
2582  *         minor = (gdal_version_num - (major * 1000000)) // 10000
2583  */
2584   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_calc_gdal_version_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
2585   __Pyx_GOTREF(__pyx_t_1);
2586   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
2587   __Pyx_GOTREF(__pyx_t_2);
2588   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2589   __pyx_t_1 = PyObject_RichCompare(__pyx_v_gdal_version_num, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
2590   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2591   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
2592   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2593   if (__pyx_t_4) {
2594 
2595     /* "fiona/_env.pyx":111
2596  *
2597  *     if gdal_version_num >= calc_gdal_version_num(1, 10, 0):
2598  *         major = gdal_version_num // 1000000             # <<<<<<<<<<<<<<
2599  *         minor = (gdal_version_num - (major * 1000000)) // 10000
2600  *         revision = (gdal_version_num - (major * 1000000) - (minor * 10000)) // 100
2601  */
2602     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_v_gdal_version_num, __pyx_int_1000000, 0xF4240, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
2603     __Pyx_GOTREF(__pyx_t_1);
2604     __pyx_v_major = __pyx_t_1;
2605     __pyx_t_1 = 0;
2606 
2607     /* "fiona/_env.pyx":112
2608  *     if gdal_version_num >= calc_gdal_version_num(1, 10, 0):
2609  *         major = gdal_version_num // 1000000
2610  *         minor = (gdal_version_num - (major * 1000000)) // 10000             # <<<<<<<<<<<<<<
2611  *         revision = (gdal_version_num - (major * 1000000) - (minor * 10000)) // 100
2612  *         return GDALVersion(major, minor, revision)
2613  */
2614     __pyx_t_1 = PyNumber_Multiply(__pyx_v_major, __pyx_int_1000000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
2615     __Pyx_GOTREF(__pyx_t_1);
2616     __pyx_t_2 = PyNumber_Subtract(__pyx_v_gdal_version_num, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
2617     __Pyx_GOTREF(__pyx_t_2);
2618     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2619     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_2, __pyx_int_10000, 0x2710, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
2620     __Pyx_GOTREF(__pyx_t_1);
2621     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2622     __pyx_v_minor = __pyx_t_1;
2623     __pyx_t_1 = 0;
2624 
2625     /* "fiona/_env.pyx":113
2626  *         major = gdal_version_num // 1000000
2627  *         minor = (gdal_version_num - (major * 1000000)) // 10000
2628  *         revision = (gdal_version_num - (major * 1000000) - (minor * 10000)) // 100             # <<<<<<<<<<<<<<
2629  *         return GDALVersion(major, minor, revision)
2630  *     else:
2631  */
2632     __pyx_t_1 = PyNumber_Multiply(__pyx_v_major, __pyx_int_1000000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
2633     __Pyx_GOTREF(__pyx_t_1);
2634     __pyx_t_2 = PyNumber_Subtract(__pyx_v_gdal_version_num, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
2635     __Pyx_GOTREF(__pyx_t_2);
2636     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2637     __pyx_t_1 = PyNumber_Multiply(__pyx_v_minor, __pyx_int_10000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
2638     __Pyx_GOTREF(__pyx_t_1);
2639     __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
2640     __Pyx_GOTREF(__pyx_t_3);
2641     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2642     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2643     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_3, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
2644     __Pyx_GOTREF(__pyx_t_1);
2645     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2646     __pyx_v_revision = __pyx_t_1;
2647     __pyx_t_1 = 0;
2648 
2649     /* "fiona/_env.pyx":114
2650  *         minor = (gdal_version_num - (major * 1000000)) // 10000
2651  *         revision = (gdal_version_num - (major * 1000000) - (minor * 10000)) // 100
2652  *         return GDALVersion(major, minor, revision)             # <<<<<<<<<<<<<<
2653  *     else:
2654  *         major = gdal_version_num // 1000
2655  */
2656     __Pyx_XDECREF(__pyx_r);
2657     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_GDALVersion); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
2658     __Pyx_GOTREF(__pyx_t_3);
2659     __pyx_t_2 = NULL;
2660     __pyx_t_5 = 0;
2661     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2662       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2663       if (likely(__pyx_t_2)) {
2664         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2665         __Pyx_INCREF(__pyx_t_2);
2666         __Pyx_INCREF(function);
2667         __Pyx_DECREF_SET(__pyx_t_3, function);
2668         __pyx_t_5 = 1;
2669       }
2670     }
2671     #if CYTHON_FAST_PYCALL
2672     if (PyFunction_Check(__pyx_t_3)) {
2673       PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_major, __pyx_v_minor, __pyx_v_revision};
2674       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
2675       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2676       __Pyx_GOTREF(__pyx_t_1);
2677     } else
2678     #endif
2679     #if CYTHON_FAST_PYCCALL
2680     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2681       PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_major, __pyx_v_minor, __pyx_v_revision};
2682       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
2683       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2684       __Pyx_GOTREF(__pyx_t_1);
2685     } else
2686     #endif
2687     {
2688       __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error)
2689       __Pyx_GOTREF(__pyx_t_6);
2690       if (__pyx_t_2) {
2691         __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
2692       }
2693       __Pyx_INCREF(__pyx_v_major);
2694       __Pyx_GIVEREF(__pyx_v_major);
2695       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_major);
2696       __Pyx_INCREF(__pyx_v_minor);
2697       __Pyx_GIVEREF(__pyx_v_minor);
2698       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_minor);
2699       __Pyx_INCREF(__pyx_v_revision);
2700       __Pyx_GIVEREF(__pyx_v_revision);
2701       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_revision);
2702       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
2703       __Pyx_GOTREF(__pyx_t_1);
2704       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2705     }
2706     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2707     __pyx_r = __pyx_t_1;
2708     __pyx_t_1 = 0;
2709     goto __pyx_L0;
2710 
2711     /* "fiona/_env.pyx":110
2712  *     gdal_version_num = get_gdal_version_num()
2713  *
2714  *     if gdal_version_num >= calc_gdal_version_num(1, 10, 0):             # <<<<<<<<<<<<<<
2715  *         major = gdal_version_num // 1000000
2716  *         minor = (gdal_version_num - (major * 1000000)) // 10000
2717  */
2718   }
2719 
2720   /* "fiona/_env.pyx":116
2721  *         return GDALVersion(major, minor, revision)
2722  *     else:
2723  *         major = gdal_version_num // 1000             # <<<<<<<<<<<<<<
2724  *         minor = (gdal_version_num - (major * 1000)) // 100
2725  *         revision = (gdal_version_num - (major * 1000) - (minor * 100)) // 10
2726  */
2727   /*else*/ {
2728     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_v_gdal_version_num, __pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
2729     __Pyx_GOTREF(__pyx_t_1);
2730     __pyx_v_major = __pyx_t_1;
2731     __pyx_t_1 = 0;
2732 
2733     /* "fiona/_env.pyx":117
2734  *     else:
2735  *         major = gdal_version_num // 1000
2736  *         minor = (gdal_version_num - (major * 1000)) // 100             # <<<<<<<<<<<<<<
2737  *         revision = (gdal_version_num - (major * 1000) - (minor * 100)) // 10
2738  *         return GDALVersion(major, minor, revision)
2739  */
2740     __pyx_t_1 = PyNumber_Multiply(__pyx_v_major, __pyx_int_1000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
2741     __Pyx_GOTREF(__pyx_t_1);
2742     __pyx_t_3 = PyNumber_Subtract(__pyx_v_gdal_version_num, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
2743     __Pyx_GOTREF(__pyx_t_3);
2744     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2745     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_3, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
2746     __Pyx_GOTREF(__pyx_t_1);
2747     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2748     __pyx_v_minor = __pyx_t_1;
2749     __pyx_t_1 = 0;
2750 
2751     /* "fiona/_env.pyx":118
2752  *         major = gdal_version_num // 1000
2753  *         minor = (gdal_version_num - (major * 1000)) // 100
2754  *         revision = (gdal_version_num - (major * 1000) - (minor * 100)) // 10             # <<<<<<<<<<<<<<
2755  *         return GDALVersion(major, minor, revision)
2756  *
2757  */
2758     __pyx_t_1 = PyNumber_Multiply(__pyx_v_major, __pyx_int_1000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
2759     __Pyx_GOTREF(__pyx_t_1);
2760     __pyx_t_3 = PyNumber_Subtract(__pyx_v_gdal_version_num, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
2761     __Pyx_GOTREF(__pyx_t_3);
2762     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2763     __pyx_t_1 = PyNumber_Multiply(__pyx_v_minor, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
2764     __Pyx_GOTREF(__pyx_t_1);
2765     __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error)
2766     __Pyx_GOTREF(__pyx_t_6);
2767     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2768     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2769     __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_6, __pyx_int_10, 10, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
2770     __Pyx_GOTREF(__pyx_t_1);
2771     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2772     __pyx_v_revision = __pyx_t_1;
2773     __pyx_t_1 = 0;
2774 
2775     /* "fiona/_env.pyx":119
2776  *         minor = (gdal_version_num - (major * 1000)) // 100
2777  *         revision = (gdal_version_num - (major * 1000) - (minor * 100)) // 10
2778  *         return GDALVersion(major, minor, revision)             # <<<<<<<<<<<<<<
2779  *
2780  *
2781  */
2782     __Pyx_XDECREF(__pyx_r);
2783     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_GDALVersion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 119, __pyx_L1_error)
2784     __Pyx_GOTREF(__pyx_t_6);
2785     __pyx_t_3 = NULL;
2786     __pyx_t_5 = 0;
2787     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
2788       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
2789       if (likely(__pyx_t_3)) {
2790         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2791         __Pyx_INCREF(__pyx_t_3);
2792         __Pyx_INCREF(function);
2793         __Pyx_DECREF_SET(__pyx_t_6, function);
2794         __pyx_t_5 = 1;
2795       }
2796     }
2797     #if CYTHON_FAST_PYCALL
2798     if (PyFunction_Check(__pyx_t_6)) {
2799       PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_major, __pyx_v_minor, __pyx_v_revision};
2800       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
2801       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2802       __Pyx_GOTREF(__pyx_t_1);
2803     } else
2804     #endif
2805     #if CYTHON_FAST_PYCCALL
2806     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
2807       PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_major, __pyx_v_minor, __pyx_v_revision};
2808       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
2809       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2810       __Pyx_GOTREF(__pyx_t_1);
2811     } else
2812     #endif
2813     {
2814       __pyx_t_2 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error)
2815       __Pyx_GOTREF(__pyx_t_2);
2816       if (__pyx_t_3) {
2817         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
2818       }
2819       __Pyx_INCREF(__pyx_v_major);
2820       __Pyx_GIVEREF(__pyx_v_major);
2821       PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_v_major);
2822       __Pyx_INCREF(__pyx_v_minor);
2823       __Pyx_GIVEREF(__pyx_v_minor);
2824       PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_minor);
2825       __Pyx_INCREF(__pyx_v_revision);
2826       __Pyx_GIVEREF(__pyx_v_revision);
2827       PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_5, __pyx_v_revision);
2828       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
2829       __Pyx_GOTREF(__pyx_t_1);
2830       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2831     }
2832     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2833     __pyx_r = __pyx_t_1;
2834     __pyx_t_1 = 0;
2835     goto __pyx_L0;
2836   }
2837 
2838   /* "fiona/_env.pyx":102
2839  *
2840  *
2841  * def get_gdal_version_tuple():             # <<<<<<<<<<<<<<
2842  *     """
2843  *     Calculates gdal version tuple from gdal's internal version number.
2844  */
2845 
2846   /* function exit code */
2847   __pyx_L1_error:;
2848   __Pyx_XDECREF(__pyx_t_1);
2849   __Pyx_XDECREF(__pyx_t_2);
2850   __Pyx_XDECREF(__pyx_t_3);
2851   __Pyx_XDECREF(__pyx_t_6);
2852   __Pyx_AddTraceback("fiona._env.get_gdal_version_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
2853   __pyx_r = NULL;
2854   __pyx_L0:;
2855   __Pyx_XDECREF(__pyx_v_gdal_version_num);
2856   __Pyx_XDECREF(__pyx_v_major);
2857   __Pyx_XDECREF(__pyx_v_minor);
2858   __Pyx_XDECREF(__pyx_v_revision);
2859   __Pyx_XGIVEREF(__pyx_r);
2860   __Pyx_RefNannyFinishContext();
2861   return __pyx_r;
2862 }
2863 
2864 /* "fiona/_env.pyx":122
2865  *
2866  *
2867  * def get_proj_version_tuple():             # <<<<<<<<<<<<<<
2868  *     """
2869  *     Returns proj version tuple for gdal >= 3.0.1, otherwise None
2870  */
2871 
2872 /* Python wrapper */
2873 static PyObject *__pyx_pw_5fiona_4_env_9get_proj_version_tuple(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2874 static char __pyx_doc_5fiona_4_env_8get_proj_version_tuple[] = "\n    Returns proj version tuple for gdal >= 3.0.1, otherwise None\n    ";
2875 static PyMethodDef __pyx_mdef_5fiona_4_env_9get_proj_version_tuple = {"get_proj_version_tuple", (PyCFunction)__pyx_pw_5fiona_4_env_9get_proj_version_tuple, METH_NOARGS, __pyx_doc_5fiona_4_env_8get_proj_version_tuple};
__pyx_pw_5fiona_4_env_9get_proj_version_tuple(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2876 static PyObject *__pyx_pw_5fiona_4_env_9get_proj_version_tuple(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2877   PyObject *__pyx_r = 0;
2878   __Pyx_RefNannyDeclarations
2879   __Pyx_RefNannySetupContext("get_proj_version_tuple (wrapper)", 0);
2880   __pyx_r = __pyx_pf_5fiona_4_env_8get_proj_version_tuple(__pyx_self);
2881 
2882   /* function exit code */
2883   __Pyx_RefNannyFinishContext();
2884   return __pyx_r;
2885 }
2886 
__pyx_pf_5fiona_4_env_8get_proj_version_tuple(CYTHON_UNUSED PyObject * __pyx_self)2887 static PyObject *__pyx_pf_5fiona_4_env_8get_proj_version_tuple(CYTHON_UNUSED PyObject *__pyx_self) {
2888   int __pyx_v_major;
2889   int __pyx_v_minor;
2890   int __pyx_v_patch;
2891   PyObject *__pyx_v_gdal_version_num = NULL;
2892   CYTHON_UNUSED PyObject *__pyx_v_proj_version = NULL;
2893   PyObject *__pyx_r = NULL;
2894   __Pyx_RefNannyDeclarations
2895   PyObject *__pyx_t_1 = NULL;
2896   PyObject *__pyx_t_2 = NULL;
2897   PyObject *__pyx_t_3 = NULL;
2898   int __pyx_t_4;
2899   PyObject *__pyx_t_5 = NULL;
2900   int __pyx_lineno = 0;
2901   const char *__pyx_filename = NULL;
2902   int __pyx_clineno = 0;
2903   __Pyx_RefNannySetupContext("get_proj_version_tuple", 0);
2904 
2905   /* "fiona/_env.pyx":129
2906  *     cdef int minor
2907  *     cdef int patch
2908  *     gdal_version_num = get_gdal_version_num()             # <<<<<<<<<<<<<<
2909  *     if gdal_version_num < calc_gdal_version_num(3, 0, 1):
2910  *         proj_version = None
2911  */
2912   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_gdal_version_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)
2913   __Pyx_GOTREF(__pyx_t_2);
2914   __pyx_t_3 = NULL;
2915   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2916     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2917     if (likely(__pyx_t_3)) {
2918       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2919       __Pyx_INCREF(__pyx_t_3);
2920       __Pyx_INCREF(function);
2921       __Pyx_DECREF_SET(__pyx_t_2, function);
2922     }
2923   }
2924   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
2925   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2926   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
2927   __Pyx_GOTREF(__pyx_t_1);
2928   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2929   __pyx_v_gdal_version_num = __pyx_t_1;
2930   __pyx_t_1 = 0;
2931 
2932   /* "fiona/_env.pyx":130
2933  *     cdef int patch
2934  *     gdal_version_num = get_gdal_version_num()
2935  *     if gdal_version_num < calc_gdal_version_num(3, 0, 1):             # <<<<<<<<<<<<<<
2936  *         proj_version = None
2937  *     else:
2938  */
2939   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_calc_gdal_version_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
2940   __Pyx_GOTREF(__pyx_t_1);
2941   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
2942   __Pyx_GOTREF(__pyx_t_2);
2943   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2944   __pyx_t_1 = PyObject_RichCompare(__pyx_v_gdal_version_num, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
2945   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2946   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 130, __pyx_L1_error)
2947   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2948   if (__pyx_t_4) {
2949 
2950     /* "fiona/_env.pyx":131
2951  *     gdal_version_num = get_gdal_version_num()
2952  *     if gdal_version_num < calc_gdal_version_num(3, 0, 1):
2953  *         proj_version = None             # <<<<<<<<<<<<<<
2954  *     else:
2955  *         get_proj_version(&major, &minor, &patch)
2956  */
2957     __Pyx_INCREF(Py_None);
2958     __pyx_v_proj_version = Py_None;
2959 
2960     /* "fiona/_env.pyx":130
2961  *     cdef int patch
2962  *     gdal_version_num = get_gdal_version_num()
2963  *     if gdal_version_num < calc_gdal_version_num(3, 0, 1):             # <<<<<<<<<<<<<<
2964  *         proj_version = None
2965  *     else:
2966  */
2967     goto __pyx_L3;
2968   }
2969 
2970   /* "fiona/_env.pyx":133
2971  *         proj_version = None
2972  *     else:
2973  *         get_proj_version(&major, &minor, &patch)             # <<<<<<<<<<<<<<
2974  *         return (major, minor, patch)
2975  *
2976  */
2977   /*else*/ {
2978     __pyx_f_5fiona_5_shim_get_proj_version((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patch));
2979 
2980     /* "fiona/_env.pyx":134
2981  *     else:
2982  *         get_proj_version(&major, &minor, &patch)
2983  *         return (major, minor, patch)             # <<<<<<<<<<<<<<
2984  *
2985  *
2986  */
2987     __Pyx_XDECREF(__pyx_r);
2988     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_major); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
2989     __Pyx_GOTREF(__pyx_t_1);
2990     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
2991     __Pyx_GOTREF(__pyx_t_2);
2992     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
2993     __Pyx_GOTREF(__pyx_t_3);
2994     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error)
2995     __Pyx_GOTREF(__pyx_t_5);
2996     __Pyx_GIVEREF(__pyx_t_1);
2997     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
2998     __Pyx_GIVEREF(__pyx_t_2);
2999     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
3000     __Pyx_GIVEREF(__pyx_t_3);
3001     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
3002     __pyx_t_1 = 0;
3003     __pyx_t_2 = 0;
3004     __pyx_t_3 = 0;
3005     __pyx_r = __pyx_t_5;
3006     __pyx_t_5 = 0;
3007     goto __pyx_L0;
3008   }
3009   __pyx_L3:;
3010 
3011   /* "fiona/_env.pyx":122
3012  *
3013  *
3014  * def get_proj_version_tuple():             # <<<<<<<<<<<<<<
3015  *     """
3016  *     Returns proj version tuple for gdal >= 3.0.1, otherwise None
3017  */
3018 
3019   /* function exit code */
3020   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3021   goto __pyx_L0;
3022   __pyx_L1_error:;
3023   __Pyx_XDECREF(__pyx_t_1);
3024   __Pyx_XDECREF(__pyx_t_2);
3025   __Pyx_XDECREF(__pyx_t_3);
3026   __Pyx_XDECREF(__pyx_t_5);
3027   __Pyx_AddTraceback("fiona._env.get_proj_version_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
3028   __pyx_r = NULL;
3029   __pyx_L0:;
3030   __Pyx_XDECREF(__pyx_v_gdal_version_num);
3031   __Pyx_XDECREF(__pyx_v_proj_version);
3032   __Pyx_XGIVEREF(__pyx_r);
3033   __Pyx_RefNannyFinishContext();
3034   return __pyx_r;
3035 }
3036 
3037 /* "fiona/_env.pyx":137
3038  *
3039  *
3040  * cdef void log_error(CPLErr err_class, int err_no, const char* msg) with gil:             # <<<<<<<<<<<<<<
3041  *     """Send CPL debug messages and warnings to Python's logger."""
3042  *     log = logging.getLogger(__name__)
3043  */
3044 
__pyx_f_5fiona_4_env_log_error(CPLErr __pyx_v_err_class,int __pyx_v_err_no,char const * __pyx_v_msg)3045 static void __pyx_f_5fiona_4_env_log_error(CPLErr __pyx_v_err_class, int __pyx_v_err_no, char const *__pyx_v_msg) {
3046   PyObject *__pyx_v_log = NULL;
3047   __Pyx_RefNannyDeclarations
3048   PyObject *__pyx_t_1 = NULL;
3049   PyObject *__pyx_t_2 = NULL;
3050   PyObject *__pyx_t_3 = NULL;
3051   PyObject *__pyx_t_4 = NULL;
3052   int __pyx_t_5;
3053   int __pyx_t_6;
3054   PyObject *__pyx_t_7 = NULL;
3055   int __pyx_t_8;
3056   PyObject *__pyx_t_9 = NULL;
3057   int __pyx_lineno = 0;
3058   const char *__pyx_filename = NULL;
3059   int __pyx_clineno = 0;
3060   #ifdef WITH_THREAD
3061   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
3062   #endif
3063   __Pyx_RefNannySetupContext("log_error", 0);
3064 
3065   /* "fiona/_env.pyx":139
3066  * cdef void log_error(CPLErr err_class, int err_no, const char* msg) with gil:
3067  *     """Send CPL debug messages and warnings to Python's logger."""
3068  *     log = logging.getLogger(__name__)             # <<<<<<<<<<<<<<
3069  *     if err_no in code_map:
3070  *         log.log(level_map[err_class], "%s", msg)
3071  */
3072   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
3073   __Pyx_GOTREF(__pyx_t_2);
3074   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
3075   __Pyx_GOTREF(__pyx_t_3);
3076   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3077   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
3078   __Pyx_GOTREF(__pyx_t_2);
3079   __pyx_t_4 = NULL;
3080   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3081     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3082     if (likely(__pyx_t_4)) {
3083       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3084       __Pyx_INCREF(__pyx_t_4);
3085       __Pyx_INCREF(function);
3086       __Pyx_DECREF_SET(__pyx_t_3, function);
3087     }
3088   }
3089   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
3090   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3091   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3092   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
3093   __Pyx_GOTREF(__pyx_t_1);
3094   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3095   __pyx_v_log = __pyx_t_1;
3096   __pyx_t_1 = 0;
3097 
3098   /* "fiona/_env.pyx":140
3099  *     """Send CPL debug messages and warnings to Python's logger."""
3100  *     log = logging.getLogger(__name__)
3101  *     if err_no in code_map:             # <<<<<<<<<<<<<<
3102  *         log.log(level_map[err_class], "%s", msg)
3103  *     else:
3104  */
3105   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_err_no); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
3106   __Pyx_GOTREF(__pyx_t_1);
3107   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_code_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error)
3108   __Pyx_GOTREF(__pyx_t_3);
3109   __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 140, __pyx_L1_error)
3110   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3111   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3112   __pyx_t_6 = (__pyx_t_5 != 0);
3113   if (__pyx_t_6) {
3114 
3115     /* "fiona/_env.pyx":141
3116  *     log = logging.getLogger(__name__)
3117  *     if err_no in code_map:
3118  *         log.log(level_map[err_class], "%s", msg)             # <<<<<<<<<<<<<<
3119  *     else:
3120  *         log.info("Unknown error number %r.", err_no)
3121  */
3122     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_log, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
3123     __Pyx_GOTREF(__pyx_t_1);
3124     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_level_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
3125     __Pyx_GOTREF(__pyx_t_2);
3126     __pyx_t_4 = __Pyx_PyInt_From_CPLErr(__pyx_v_err_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3127     __Pyx_GOTREF(__pyx_t_4);
3128     __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error)
3129     __Pyx_GOTREF(__pyx_t_7);
3130     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3131     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3132     __pyx_t_4 = __Pyx_PyUnicode_FromString(__pyx_v_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3133     __Pyx_GOTREF(__pyx_t_4);
3134     __pyx_t_2 = NULL;
3135     __pyx_t_8 = 0;
3136     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3137       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
3138       if (likely(__pyx_t_2)) {
3139         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3140         __Pyx_INCREF(__pyx_t_2);
3141         __Pyx_INCREF(function);
3142         __Pyx_DECREF_SET(__pyx_t_1, function);
3143         __pyx_t_8 = 1;
3144       }
3145     }
3146     #if CYTHON_FAST_PYCALL
3147     if (PyFunction_Check(__pyx_t_1)) {
3148       PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_7, __pyx_kp_u_s, __pyx_t_4};
3149       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
3150       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3151       __Pyx_GOTREF(__pyx_t_3);
3152       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3153       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3154     } else
3155     #endif
3156     #if CYTHON_FAST_PYCCALL
3157     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3158       PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_7, __pyx_kp_u_s, __pyx_t_4};
3159       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
3160       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3161       __Pyx_GOTREF(__pyx_t_3);
3162       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3163       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3164     } else
3165     #endif
3166     {
3167       __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
3168       __Pyx_GOTREF(__pyx_t_9);
3169       if (__pyx_t_2) {
3170         __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
3171       }
3172       __Pyx_GIVEREF(__pyx_t_7);
3173       PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_7);
3174       __Pyx_INCREF(__pyx_kp_u_s);
3175       __Pyx_GIVEREF(__pyx_kp_u_s);
3176       PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_kp_u_s);
3177       __Pyx_GIVEREF(__pyx_t_4);
3178       PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4);
3179       __pyx_t_7 = 0;
3180       __pyx_t_4 = 0;
3181       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
3182       __Pyx_GOTREF(__pyx_t_3);
3183       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3184     }
3185     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3186     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3187 
3188     /* "fiona/_env.pyx":140
3189  *     """Send CPL debug messages and warnings to Python's logger."""
3190  *     log = logging.getLogger(__name__)
3191  *     if err_no in code_map:             # <<<<<<<<<<<<<<
3192  *         log.log(level_map[err_class], "%s", msg)
3193  *     else:
3194  */
3195     goto __pyx_L3;
3196   }
3197 
3198   /* "fiona/_env.pyx":143
3199  *         log.log(level_map[err_class], "%s", msg)
3200  *     else:
3201  *         log.info("Unknown error number %r.", err_no)             # <<<<<<<<<<<<<<
3202  *
3203  *
3204  */
3205   /*else*/ {
3206     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_log, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
3207     __Pyx_GOTREF(__pyx_t_1);
3208     __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_err_no); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __pyx_L1_error)
3209     __Pyx_GOTREF(__pyx_t_9);
3210     __pyx_t_4 = NULL;
3211     __pyx_t_8 = 0;
3212     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3213       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
3214       if (likely(__pyx_t_4)) {
3215         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3216         __Pyx_INCREF(__pyx_t_4);
3217         __Pyx_INCREF(function);
3218         __Pyx_DECREF_SET(__pyx_t_1, function);
3219         __pyx_t_8 = 1;
3220       }
3221     }
3222     #if CYTHON_FAST_PYCALL
3223     if (PyFunction_Check(__pyx_t_1)) {
3224       PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Unknown_error_number_r, __pyx_t_9};
3225       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
3226       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3227       __Pyx_GOTREF(__pyx_t_3);
3228       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3229     } else
3230     #endif
3231     #if CYTHON_FAST_PYCCALL
3232     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3233       PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Unknown_error_number_r, __pyx_t_9};
3234       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
3235       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3236       __Pyx_GOTREF(__pyx_t_3);
3237       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3238     } else
3239     #endif
3240     {
3241       __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
3242       __Pyx_GOTREF(__pyx_t_7);
3243       if (__pyx_t_4) {
3244         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
3245       }
3246       __Pyx_INCREF(__pyx_kp_u_Unknown_error_number_r);
3247       __Pyx_GIVEREF(__pyx_kp_u_Unknown_error_number_r);
3248       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_kp_u_Unknown_error_number_r);
3249       __Pyx_GIVEREF(__pyx_t_9);
3250       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
3251       __pyx_t_9 = 0;
3252       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
3253       __Pyx_GOTREF(__pyx_t_3);
3254       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3255     }
3256     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3257     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3258   }
3259   __pyx_L3:;
3260 
3261   /* "fiona/_env.pyx":137
3262  *
3263  *
3264  * cdef void log_error(CPLErr err_class, int err_no, const char* msg) with gil:             # <<<<<<<<<<<<<<
3265  *     """Send CPL debug messages and warnings to Python's logger."""
3266  *     log = logging.getLogger(__name__)
3267  */
3268 
3269   /* function exit code */
3270   goto __pyx_L0;
3271   __pyx_L1_error:;
3272   __Pyx_XDECREF(__pyx_t_1);
3273   __Pyx_XDECREF(__pyx_t_2);
3274   __Pyx_XDECREF(__pyx_t_3);
3275   __Pyx_XDECREF(__pyx_t_4);
3276   __Pyx_XDECREF(__pyx_t_7);
3277   __Pyx_XDECREF(__pyx_t_9);
3278   __Pyx_WriteUnraisable("fiona._env.log_error", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3279   __pyx_L0:;
3280   __Pyx_XDECREF(__pyx_v_log);
3281   __Pyx_RefNannyFinishContext();
3282   #ifdef WITH_THREAD
3283   __Pyx_PyGILState_Release(__pyx_gilstate_save);
3284   #endif
3285 }
3286 
3287 /* "fiona/_env.pyx":153
3288  *         log_error(err_class, err_no, msg)
3289  * ELSE:
3290  *     cdef void logging_error_handler(CPLErr err_class, int err_no,             # <<<<<<<<<<<<<<
3291  *                                     const char* msg) with gil:
3292  *         log_error(err_class, err_no, msg)
3293  */
3294 
__pyx_f_5fiona_4_env_logging_error_handler(CPLErr __pyx_v_err_class,int __pyx_v_err_no,char const * __pyx_v_msg)3295 static void __pyx_f_5fiona_4_env_logging_error_handler(CPLErr __pyx_v_err_class, int __pyx_v_err_no, char const *__pyx_v_msg) {
3296   __Pyx_RefNannyDeclarations
3297   #ifdef WITH_THREAD
3298   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
3299   #endif
3300   __Pyx_RefNannySetupContext("logging_error_handler", 0);
3301 
3302   /* "fiona/_env.pyx":155
3303  *     cdef void logging_error_handler(CPLErr err_class, int err_no,
3304  *                                     const char* msg) with gil:
3305  *         log_error(err_class, err_no, msg)             # <<<<<<<<<<<<<<
3306  *
3307  *
3308  */
3309   __pyx_f_5fiona_4_env_log_error(__pyx_v_err_class, __pyx_v_err_no, __pyx_v_msg);
3310 
3311   /* "fiona/_env.pyx":153
3312  *         log_error(err_class, err_no, msg)
3313  * ELSE:
3314  *     cdef void logging_error_handler(CPLErr err_class, int err_no,             # <<<<<<<<<<<<<<
3315  *                                     const char* msg) with gil:
3316  *         log_error(err_class, err_no, msg)
3317  */
3318 
3319   /* function exit code */
3320   __Pyx_RefNannyFinishContext();
3321   #ifdef WITH_THREAD
3322   __Pyx_PyGILState_Release(__pyx_gilstate_save);
3323   #endif
3324 }
3325 
3326 /* "fiona/_env.pyx":158
3327  *
3328  *
3329  * def driver_count():             # <<<<<<<<<<<<<<
3330  *     """Return the count of all drivers"""
3331  *     return GDALGetDriverCount() + OGRGetDriverCount()
3332  */
3333 
3334 /* Python wrapper */
3335 static PyObject *__pyx_pw_5fiona_4_env_11driver_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3336 static char __pyx_doc_5fiona_4_env_10driver_count[] = "Return the count of all drivers";
3337 static PyMethodDef __pyx_mdef_5fiona_4_env_11driver_count = {"driver_count", (PyCFunction)__pyx_pw_5fiona_4_env_11driver_count, METH_NOARGS, __pyx_doc_5fiona_4_env_10driver_count};
__pyx_pw_5fiona_4_env_11driver_count(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)3338 static PyObject *__pyx_pw_5fiona_4_env_11driver_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3339   PyObject *__pyx_r = 0;
3340   __Pyx_RefNannyDeclarations
3341   __Pyx_RefNannySetupContext("driver_count (wrapper)", 0);
3342   __pyx_r = __pyx_pf_5fiona_4_env_10driver_count(__pyx_self);
3343 
3344   /* function exit code */
3345   __Pyx_RefNannyFinishContext();
3346   return __pyx_r;
3347 }
3348 
__pyx_pf_5fiona_4_env_10driver_count(CYTHON_UNUSED PyObject * __pyx_self)3349 static PyObject *__pyx_pf_5fiona_4_env_10driver_count(CYTHON_UNUSED PyObject *__pyx_self) {
3350   PyObject *__pyx_r = NULL;
3351   __Pyx_RefNannyDeclarations
3352   PyObject *__pyx_t_1 = NULL;
3353   int __pyx_lineno = 0;
3354   const char *__pyx_filename = NULL;
3355   int __pyx_clineno = 0;
3356   __Pyx_RefNannySetupContext("driver_count", 0);
3357 
3358   /* "fiona/_env.pyx":160
3359  * def driver_count():
3360  *     """Return the count of all drivers"""
3361  *     return GDALGetDriverCount() + OGRGetDriverCount()             # <<<<<<<<<<<<<<
3362  *
3363  *
3364  */
3365   __Pyx_XDECREF(__pyx_r);
3366   __pyx_t_1 = __Pyx_PyInt_From_int((GDALGetDriverCount() + OGRGetDriverCount())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3367   __Pyx_GOTREF(__pyx_t_1);
3368   __pyx_r = __pyx_t_1;
3369   __pyx_t_1 = 0;
3370   goto __pyx_L0;
3371 
3372   /* "fiona/_env.pyx":158
3373  *
3374  *
3375  * def driver_count():             # <<<<<<<<<<<<<<
3376  *     """Return the count of all drivers"""
3377  *     return GDALGetDriverCount() + OGRGetDriverCount()
3378  */
3379 
3380   /* function exit code */
3381   __pyx_L1_error:;
3382   __Pyx_XDECREF(__pyx_t_1);
3383   __Pyx_AddTraceback("fiona._env.driver_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
3384   __pyx_r = NULL;
3385   __pyx_L0:;
3386   __Pyx_XGIVEREF(__pyx_r);
3387   __Pyx_RefNannyFinishContext();
3388   return __pyx_r;
3389 }
3390 
3391 /* "fiona/_env.pyx":163
3392  *
3393  *
3394  * cpdef get_gdal_config(key, normalize=True):             # <<<<<<<<<<<<<<
3395  *     """Get the value of a GDAL configuration option.  When requesting
3396  *     ``GDAL_CACHEMAX`` the value is returned unaltered.
3397  */
3398 
3399 static PyObject *__pyx_pw_5fiona_4_env_13get_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_5fiona_4_env_get_gdal_config(PyObject * __pyx_v_key,CYTHON_UNUSED int __pyx_skip_dispatch,struct __pyx_opt_args_5fiona_4_env_get_gdal_config * __pyx_optional_args)3400 static PyObject *__pyx_f_5fiona_4_env_get_gdal_config(PyObject *__pyx_v_key, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5fiona_4_env_get_gdal_config *__pyx_optional_args) {
3401   PyObject *__pyx_v_normalize = ((PyObject *)Py_True);
3402   char const *__pyx_v_val;
3403   PyObject *__pyx_r = NULL;
3404   __Pyx_RefNannyDeclarations
3405   PyObject *__pyx_t_1 = NULL;
3406   PyObject *__pyx_t_2 = NULL;
3407   PyObject *__pyx_t_3 = NULL;
3408   int __pyx_t_4;
3409   char const *__pyx_t_5;
3410   int __pyx_t_6;
3411   int __pyx_lineno = 0;
3412   const char *__pyx_filename = NULL;
3413   int __pyx_clineno = 0;
3414   __Pyx_RefNannySetupContext("get_gdal_config", 0);
3415   if (__pyx_optional_args) {
3416     if (__pyx_optional_args->__pyx_n > 0) {
3417       __pyx_v_normalize = __pyx_optional_args->normalize;
3418     }
3419   }
3420   __Pyx_INCREF(__pyx_v_key);
3421 
3422   /* "fiona/_env.pyx":174
3423  *         Convert values of ``"ON"'`` and ``"OFF"`` to ``True`` and ``False``.
3424  *     """
3425  *     key = key.encode('utf-8')             # <<<<<<<<<<<<<<
3426  *
3427  *     # GDAL_CACHEMAX is a special case
3428  */
3429   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
3430   __Pyx_GOTREF(__pyx_t_2);
3431   __pyx_t_3 = NULL;
3432   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3433     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3434     if (likely(__pyx_t_3)) {
3435       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3436       __Pyx_INCREF(__pyx_t_3);
3437       __Pyx_INCREF(function);
3438       __Pyx_DECREF_SET(__pyx_t_2, function);
3439     }
3440   }
3441   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
3442   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3443   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
3444   __Pyx_GOTREF(__pyx_t_1);
3445   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3446   __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1);
3447   __pyx_t_1 = 0;
3448 
3449   /* "fiona/_env.pyx":177
3450  *
3451  *     # GDAL_CACHEMAX is a special case
3452  *     if key.lower() == b'gdal_cachemax':             # <<<<<<<<<<<<<<
3453  *         if is_64bit:
3454  *             return GDALGetCacheMax64()
3455  */
3456   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
3457   __Pyx_GOTREF(__pyx_t_2);
3458   __pyx_t_3 = NULL;
3459   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3460     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3461     if (likely(__pyx_t_3)) {
3462       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3463       __Pyx_INCREF(__pyx_t_3);
3464       __Pyx_INCREF(function);
3465       __Pyx_DECREF_SET(__pyx_t_2, function);
3466     }
3467   }
3468   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3469   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3470   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
3471   __Pyx_GOTREF(__pyx_t_1);
3472   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3473   __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_gdal_cachemax, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 177, __pyx_L1_error)
3474   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3475   if (__pyx_t_4) {
3476 
3477     /* "fiona/_env.pyx":178
3478  *     # GDAL_CACHEMAX is a special case
3479  *     if key.lower() == b'gdal_cachemax':
3480  *         if is_64bit:             # <<<<<<<<<<<<<<
3481  *             return GDALGetCacheMax64()
3482  *         else:
3483  */
3484     __pyx_t_4 = (__pyx_v_5fiona_4_env_is_64bit != 0);
3485     if (__pyx_t_4) {
3486 
3487       /* "fiona/_env.pyx":179
3488  *     if key.lower() == b'gdal_cachemax':
3489  *         if is_64bit:
3490  *             return GDALGetCacheMax64()             # <<<<<<<<<<<<<<
3491  *         else:
3492  *             return GDALGetCacheMax()
3493  */
3494       __Pyx_XDECREF(__pyx_r);
3495       __pyx_t_1 = __Pyx_PyInt_From_GIntBig(GDALGetCacheMax64()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
3496       __Pyx_GOTREF(__pyx_t_1);
3497       __pyx_r = __pyx_t_1;
3498       __pyx_t_1 = 0;
3499       goto __pyx_L0;
3500 
3501       /* "fiona/_env.pyx":178
3502  *     # GDAL_CACHEMAX is a special case
3503  *     if key.lower() == b'gdal_cachemax':
3504  *         if is_64bit:             # <<<<<<<<<<<<<<
3505  *             return GDALGetCacheMax64()
3506  *         else:
3507  */
3508     }
3509 
3510     /* "fiona/_env.pyx":181
3511  *             return GDALGetCacheMax64()
3512  *         else:
3513  *             return GDALGetCacheMax()             # <<<<<<<<<<<<<<
3514  *     else:
3515  *         val = CPLGetConfigOption(<const char *>key, NULL)
3516  */
3517     /*else*/ {
3518       __Pyx_XDECREF(__pyx_r);
3519       __pyx_t_1 = __Pyx_PyInt_From_int(GDALGetCacheMax()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
3520       __Pyx_GOTREF(__pyx_t_1);
3521       __pyx_r = __pyx_t_1;
3522       __pyx_t_1 = 0;
3523       goto __pyx_L0;
3524     }
3525 
3526     /* "fiona/_env.pyx":177
3527  *
3528  *     # GDAL_CACHEMAX is a special case
3529  *     if key.lower() == b'gdal_cachemax':             # <<<<<<<<<<<<<<
3530  *         if is_64bit:
3531  *             return GDALGetCacheMax64()
3532  */
3533   }
3534 
3535   /* "fiona/_env.pyx":183
3536  *             return GDALGetCacheMax()
3537  *     else:
3538  *         val = CPLGetConfigOption(<const char *>key, NULL)             # <<<<<<<<<<<<<<
3539  *
3540  *     if not val:
3541  */
3542   /*else*/ {
3543     __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
3544     __pyx_v_val = CPLGetConfigOption(((char const *)__pyx_t_5), NULL);
3545   }
3546 
3547   /* "fiona/_env.pyx":185
3548  *         val = CPLGetConfigOption(<const char *>key, NULL)
3549  *
3550  *     if not val:             # <<<<<<<<<<<<<<
3551  *         return None
3552  *     elif not normalize:
3553  */
3554   __pyx_t_4 = ((!(__pyx_v_val != 0)) != 0);
3555   if (__pyx_t_4) {
3556 
3557     /* "fiona/_env.pyx":186
3558  *
3559  *     if not val:
3560  *         return None             # <<<<<<<<<<<<<<
3561  *     elif not normalize:
3562  *         return val
3563  */
3564     __Pyx_XDECREF(__pyx_r);
3565     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3566     goto __pyx_L0;
3567 
3568     /* "fiona/_env.pyx":185
3569  *         val = CPLGetConfigOption(<const char *>key, NULL)
3570  *
3571  *     if not val:             # <<<<<<<<<<<<<<
3572  *         return None
3573  *     elif not normalize:
3574  */
3575   }
3576 
3577   /* "fiona/_env.pyx":187
3578  *     if not val:
3579  *         return None
3580  *     elif not normalize:             # <<<<<<<<<<<<<<
3581  *         return val
3582  *     elif val.isdigit():
3583  */
3584   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_normalize); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
3585   __pyx_t_6 = ((!__pyx_t_4) != 0);
3586   if (__pyx_t_6) {
3587 
3588     /* "fiona/_env.pyx":188
3589  *         return None
3590  *     elif not normalize:
3591  *         return val             # <<<<<<<<<<<<<<
3592  *     elif val.isdigit():
3593  *         return int(val)
3594  */
3595     __Pyx_XDECREF(__pyx_r);
3596     __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
3597     __Pyx_GOTREF(__pyx_t_1);
3598     __pyx_r = __pyx_t_1;
3599     __pyx_t_1 = 0;
3600     goto __pyx_L0;
3601 
3602     /* "fiona/_env.pyx":187
3603  *     if not val:
3604  *         return None
3605  *     elif not normalize:             # <<<<<<<<<<<<<<
3606  *         return val
3607  *     elif val.isdigit():
3608  */
3609   }
3610 
3611   /* "fiona/_env.pyx":189
3612  *     elif not normalize:
3613  *         return val
3614  *     elif val.isdigit():             # <<<<<<<<<<<<<<
3615  *         return int(val)
3616  *     else:
3617  */
3618   __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
3619   __Pyx_GOTREF(__pyx_t_2);
3620   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
3621   __Pyx_GOTREF(__pyx_t_3);
3622   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3623   __pyx_t_2 = NULL;
3624   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3625     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3626     if (likely(__pyx_t_2)) {
3627       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3628       __Pyx_INCREF(__pyx_t_2);
3629       __Pyx_INCREF(function);
3630       __Pyx_DECREF_SET(__pyx_t_3, function);
3631     }
3632   }
3633   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
3634   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3635   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
3636   __Pyx_GOTREF(__pyx_t_1);
3637   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3638   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
3639   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3640   if (__pyx_t_6) {
3641 
3642     /* "fiona/_env.pyx":190
3643  *         return val
3644  *     elif val.isdigit():
3645  *         return int(val)             # <<<<<<<<<<<<<<
3646  *     else:
3647  *         if val == u'ON':
3648  */
3649     __Pyx_XDECREF(__pyx_r);
3650     __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
3651     __Pyx_GOTREF(__pyx_t_1);
3652     __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
3653     __Pyx_GOTREF(__pyx_t_3);
3654     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3655     __pyx_r = __pyx_t_3;
3656     __pyx_t_3 = 0;
3657     goto __pyx_L0;
3658 
3659     /* "fiona/_env.pyx":189
3660  *     elif not normalize:
3661  *         return val
3662  *     elif val.isdigit():             # <<<<<<<<<<<<<<
3663  *         return int(val)
3664  *     else:
3665  */
3666   }
3667 
3668   /* "fiona/_env.pyx":192
3669  *         return int(val)
3670  *     else:
3671  *         if val == u'ON':             # <<<<<<<<<<<<<<
3672  *             return True
3673  *         elif val == u'OFF':
3674  */
3675   /*else*/ {
3676     __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
3677     __Pyx_GOTREF(__pyx_t_3);
3678     __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_ON, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
3679     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3680     if (__pyx_t_6) {
3681 
3682       /* "fiona/_env.pyx":193
3683  *     else:
3684  *         if val == u'ON':
3685  *             return True             # <<<<<<<<<<<<<<
3686  *         elif val == u'OFF':
3687  *             return False
3688  */
3689       __Pyx_XDECREF(__pyx_r);
3690       __Pyx_INCREF(Py_True);
3691       __pyx_r = Py_True;
3692       goto __pyx_L0;
3693 
3694       /* "fiona/_env.pyx":192
3695  *         return int(val)
3696  *     else:
3697  *         if val == u'ON':             # <<<<<<<<<<<<<<
3698  *             return True
3699  *         elif val == u'OFF':
3700  */
3701     }
3702 
3703     /* "fiona/_env.pyx":194
3704  *         if val == u'ON':
3705  *             return True
3706  *         elif val == u'OFF':             # <<<<<<<<<<<<<<
3707  *             return False
3708  *         else:
3709  */
3710     __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
3711     __Pyx_GOTREF(__pyx_t_3);
3712     __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_OFF, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 194, __pyx_L1_error)
3713     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3714     if (__pyx_t_6) {
3715 
3716       /* "fiona/_env.pyx":195
3717  *             return True
3718  *         elif val == u'OFF':
3719  *             return False             # <<<<<<<<<<<<<<
3720  *         else:
3721  *             return val
3722  */
3723       __Pyx_XDECREF(__pyx_r);
3724       __Pyx_INCREF(Py_False);
3725       __pyx_r = Py_False;
3726       goto __pyx_L0;
3727 
3728       /* "fiona/_env.pyx":194
3729  *         if val == u'ON':
3730  *             return True
3731  *         elif val == u'OFF':             # <<<<<<<<<<<<<<
3732  *             return False
3733  *         else:
3734  */
3735     }
3736 
3737     /* "fiona/_env.pyx":197
3738  *             return False
3739  *         else:
3740  *             return val             # <<<<<<<<<<<<<<
3741  *
3742  *
3743  */
3744     /*else*/ {
3745       __Pyx_XDECREF(__pyx_r);
3746       __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
3747       __Pyx_GOTREF(__pyx_t_3);
3748       __pyx_r = __pyx_t_3;
3749       __pyx_t_3 = 0;
3750       goto __pyx_L0;
3751     }
3752   }
3753 
3754   /* "fiona/_env.pyx":163
3755  *
3756  *
3757  * cpdef get_gdal_config(key, normalize=True):             # <<<<<<<<<<<<<<
3758  *     """Get the value of a GDAL configuration option.  When requesting
3759  *     ``GDAL_CACHEMAX`` the value is returned unaltered.
3760  */
3761 
3762   /* function exit code */
3763   __pyx_L1_error:;
3764   __Pyx_XDECREF(__pyx_t_1);
3765   __Pyx_XDECREF(__pyx_t_2);
3766   __Pyx_XDECREF(__pyx_t_3);
3767   __Pyx_AddTraceback("fiona._env.get_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
3768   __pyx_r = 0;
3769   __pyx_L0:;
3770   __Pyx_XDECREF(__pyx_v_key);
3771   __Pyx_XGIVEREF(__pyx_r);
3772   __Pyx_RefNannyFinishContext();
3773   return __pyx_r;
3774 }
3775 
3776 /* Python wrapper */
3777 static PyObject *__pyx_pw_5fiona_4_env_13get_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3778 static char __pyx_doc_5fiona_4_env_12get_gdal_config[] = "Get the value of a GDAL configuration option.  When requesting\n    ``GDAL_CACHEMAX`` the value is returned unaltered. \n\n    Parameters\n    ----------\n    key : str\n        Name of config option.\n    normalize : bool, optional\n        Convert values of ``\"ON\"'`` and ``\"OFF\"`` to ``True`` and ``False``.\n    ";
__pyx_pw_5fiona_4_env_13get_gdal_config(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3779 static PyObject *__pyx_pw_5fiona_4_env_13get_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3780   PyObject *__pyx_v_key = 0;
3781   PyObject *__pyx_v_normalize = 0;
3782   int __pyx_lineno = 0;
3783   const char *__pyx_filename = NULL;
3784   int __pyx_clineno = 0;
3785   PyObject *__pyx_r = 0;
3786   __Pyx_RefNannyDeclarations
3787   __Pyx_RefNannySetupContext("get_gdal_config (wrapper)", 0);
3788   {
3789     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_normalize,0};
3790     PyObject* values[2] = {0,0};
3791     values[1] = ((PyObject *)Py_True);
3792     if (unlikely(__pyx_kwds)) {
3793       Py_ssize_t kw_args;
3794       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3795       switch (pos_args) {
3796         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3797         CYTHON_FALLTHROUGH;
3798         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3799         CYTHON_FALLTHROUGH;
3800         case  0: break;
3801         default: goto __pyx_L5_argtuple_error;
3802       }
3803       kw_args = PyDict_Size(__pyx_kwds);
3804       switch (pos_args) {
3805         case  0:
3806         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
3807         else goto __pyx_L5_argtuple_error;
3808         CYTHON_FALLTHROUGH;
3809         case  1:
3810         if (kw_args > 0) {
3811           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normalize);
3812           if (value) { values[1] = value; kw_args--; }
3813         }
3814       }
3815       if (unlikely(kw_args > 0)) {
3816         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_gdal_config") < 0)) __PYX_ERR(0, 163, __pyx_L3_error)
3817       }
3818     } else {
3819       switch (PyTuple_GET_SIZE(__pyx_args)) {
3820         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3821         CYTHON_FALLTHROUGH;
3822         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3823         break;
3824         default: goto __pyx_L5_argtuple_error;
3825       }
3826     }
3827     __pyx_v_key = values[0];
3828     __pyx_v_normalize = values[1];
3829   }
3830   goto __pyx_L4_argument_unpacking_done;
3831   __pyx_L5_argtuple_error:;
3832   __Pyx_RaiseArgtupleInvalid("get_gdal_config", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error)
3833   __pyx_L3_error:;
3834   __Pyx_AddTraceback("fiona._env.get_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
3835   __Pyx_RefNannyFinishContext();
3836   return NULL;
3837   __pyx_L4_argument_unpacking_done:;
3838   __pyx_r = __pyx_pf_5fiona_4_env_12get_gdal_config(__pyx_self, __pyx_v_key, __pyx_v_normalize);
3839 
3840   /* function exit code */
3841   __Pyx_RefNannyFinishContext();
3842   return __pyx_r;
3843 }
3844 
__pyx_pf_5fiona_4_env_12get_gdal_config(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_key,PyObject * __pyx_v_normalize)3845 static PyObject *__pyx_pf_5fiona_4_env_12get_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_normalize) {
3846   PyObject *__pyx_r = NULL;
3847   __Pyx_RefNannyDeclarations
3848   PyObject *__pyx_t_1 = NULL;
3849   struct __pyx_opt_args_5fiona_4_env_get_gdal_config __pyx_t_2;
3850   int __pyx_lineno = 0;
3851   const char *__pyx_filename = NULL;
3852   int __pyx_clineno = 0;
3853   __Pyx_RefNannySetupContext("get_gdal_config", 0);
3854   __Pyx_XDECREF(__pyx_r);
3855   __pyx_t_2.__pyx_n = 1;
3856   __pyx_t_2.normalize = __pyx_v_normalize;
3857   __pyx_t_1 = __pyx_f_5fiona_4_env_get_gdal_config(__pyx_v_key, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
3858   __Pyx_GOTREF(__pyx_t_1);
3859   __pyx_r = __pyx_t_1;
3860   __pyx_t_1 = 0;
3861   goto __pyx_L0;
3862 
3863   /* function exit code */
3864   __pyx_L1_error:;
3865   __Pyx_XDECREF(__pyx_t_1);
3866   __Pyx_AddTraceback("fiona._env.get_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
3867   __pyx_r = NULL;
3868   __pyx_L0:;
3869   __Pyx_XGIVEREF(__pyx_r);
3870   __Pyx_RefNannyFinishContext();
3871   return __pyx_r;
3872 }
3873 
3874 /* "fiona/_env.pyx":200
3875  *
3876  *
3877  * cpdef set_gdal_config(key, val, normalize=True):             # <<<<<<<<<<<<<<
3878  *     """Set a GDAL configuration option's value.
3879  *
3880  */
3881 
3882 static PyObject *__pyx_pw_5fiona_4_env_15set_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_5fiona_4_env_set_gdal_config(PyObject * __pyx_v_key,PyObject * __pyx_v_val,CYTHON_UNUSED int __pyx_skip_dispatch,struct __pyx_opt_args_5fiona_4_env_set_gdal_config * __pyx_optional_args)3883 static PyObject *__pyx_f_5fiona_4_env_set_gdal_config(PyObject *__pyx_v_key, PyObject *__pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5fiona_4_env_set_gdal_config *__pyx_optional_args) {
3884   PyObject *__pyx_v_normalize = ((PyObject *)Py_True);
3885   PyObject *__pyx_r = NULL;
3886   __Pyx_RefNannyDeclarations
3887   PyObject *__pyx_t_1 = NULL;
3888   PyObject *__pyx_t_2 = NULL;
3889   PyObject *__pyx_t_3 = NULL;
3890   int __pyx_t_4;
3891   GIntBig __pyx_t_5;
3892   int __pyx_t_6;
3893   int __pyx_t_7;
3894   int __pyx_t_8;
3895   char const *__pyx_t_9;
3896   char const *__pyx_t_10;
3897   char const *__pyx_t_11;
3898   char const *__pyx_t_12;
3899   int __pyx_lineno = 0;
3900   const char *__pyx_filename = NULL;
3901   int __pyx_clineno = 0;
3902   __Pyx_RefNannySetupContext("set_gdal_config", 0);
3903   if (__pyx_optional_args) {
3904     if (__pyx_optional_args->__pyx_n > 0) {
3905       __pyx_v_normalize = __pyx_optional_args->normalize;
3906     }
3907   }
3908   __Pyx_INCREF(__pyx_v_key);
3909   __Pyx_INCREF(__pyx_v_val);
3910 
3911   /* "fiona/_env.pyx":210
3912  *         Convert ``True`` to `"ON"` and ``False`` to `"OFF"``.
3913  *     """
3914  *     key = key.encode('utf-8')             # <<<<<<<<<<<<<<
3915  *
3916  *     # GDAL_CACHEMAX is a special case
3917  */
3918   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
3919   __Pyx_GOTREF(__pyx_t_2);
3920   __pyx_t_3 = NULL;
3921   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3922     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3923     if (likely(__pyx_t_3)) {
3924       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3925       __Pyx_INCREF(__pyx_t_3);
3926       __Pyx_INCREF(function);
3927       __Pyx_DECREF_SET(__pyx_t_2, function);
3928     }
3929   }
3930   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
3931   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3932   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
3933   __Pyx_GOTREF(__pyx_t_1);
3934   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3935   __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1);
3936   __pyx_t_1 = 0;
3937 
3938   /* "fiona/_env.pyx":213
3939  *
3940  *     # GDAL_CACHEMAX is a special case
3941  *     if key.lower() == b'gdal_cachemax':             # <<<<<<<<<<<<<<
3942  *         if is_64bit:
3943  *             GDALSetCacheMax64(val)
3944  */
3945   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
3946   __Pyx_GOTREF(__pyx_t_2);
3947   __pyx_t_3 = NULL;
3948   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3949     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3950     if (likely(__pyx_t_3)) {
3951       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3952       __Pyx_INCREF(__pyx_t_3);
3953       __Pyx_INCREF(function);
3954       __Pyx_DECREF_SET(__pyx_t_2, function);
3955     }
3956   }
3957   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3958   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3959   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
3960   __Pyx_GOTREF(__pyx_t_1);
3961   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3962   __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_gdal_cachemax, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
3963   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3964   if (__pyx_t_4) {
3965 
3966     /* "fiona/_env.pyx":214
3967  *     # GDAL_CACHEMAX is a special case
3968  *     if key.lower() == b'gdal_cachemax':
3969  *         if is_64bit:             # <<<<<<<<<<<<<<
3970  *             GDALSetCacheMax64(val)
3971  *         else:
3972  */
3973     __pyx_t_4 = (__pyx_v_5fiona_4_env_is_64bit != 0);
3974     if (__pyx_t_4) {
3975 
3976       /* "fiona/_env.pyx":215
3977  *     if key.lower() == b'gdal_cachemax':
3978  *         if is_64bit:
3979  *             GDALSetCacheMax64(val)             # <<<<<<<<<<<<<<
3980  *         else:
3981  *             GDALSetCacheMax(val)
3982  */
3983       __pyx_t_5 = __Pyx_PyInt_As_GIntBig(__pyx_v_val); if (unlikely((__pyx_t_5 == ((GIntBig)-1)) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error)
3984       GDALSetCacheMax64(__pyx_t_5);
3985 
3986       /* "fiona/_env.pyx":214
3987  *     # GDAL_CACHEMAX is a special case
3988  *     if key.lower() == b'gdal_cachemax':
3989  *         if is_64bit:             # <<<<<<<<<<<<<<
3990  *             GDALSetCacheMax64(val)
3991  *         else:
3992  */
3993       goto __pyx_L4;
3994     }
3995 
3996     /* "fiona/_env.pyx":217
3997  *             GDALSetCacheMax64(val)
3998  *         else:
3999  *             GDALSetCacheMax(val)             # <<<<<<<<<<<<<<
4000  *         return
4001  *     elif normalize and isinstance(val, bool):
4002  */
4003     /*else*/ {
4004       __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_val); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
4005       GDALSetCacheMax(__pyx_t_6);
4006     }
4007     __pyx_L4:;
4008 
4009     /* "fiona/_env.pyx":218
4010  *         else:
4011  *             GDALSetCacheMax(val)
4012  *         return             # <<<<<<<<<<<<<<
4013  *     elif normalize and isinstance(val, bool):
4014  *         val = ('ON' if val and val else 'OFF').encode('utf-8')
4015  */
4016     __Pyx_XDECREF(__pyx_r);
4017     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4018     goto __pyx_L0;
4019 
4020     /* "fiona/_env.pyx":213
4021  *
4022  *     # GDAL_CACHEMAX is a special case
4023  *     if key.lower() == b'gdal_cachemax':             # <<<<<<<<<<<<<<
4024  *         if is_64bit:
4025  *             GDALSetCacheMax64(val)
4026  */
4027   }
4028 
4029   /* "fiona/_env.pyx":219
4030  *             GDALSetCacheMax(val)
4031  *         return
4032  *     elif normalize and isinstance(val, bool):             # <<<<<<<<<<<<<<
4033  *         val = ('ON' if val and val else 'OFF').encode('utf-8')
4034  *     else:
4035  */
4036   __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_normalize); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
4037   if (__pyx_t_7) {
4038   } else {
4039     __pyx_t_4 = __pyx_t_7;
4040     goto __pyx_L5_bool_binop_done;
4041   }
4042   __pyx_t_1 = ((PyObject*)&PyBool_Type);
4043   __Pyx_INCREF(__pyx_t_1);
4044   __pyx_t_7 = PyObject_IsInstance(__pyx_v_val, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 219, __pyx_L1_error)
4045   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4046   __pyx_t_8 = (__pyx_t_7 != 0);
4047   __pyx_t_4 = __pyx_t_8;
4048   __pyx_L5_bool_binop_done:;
4049   if (__pyx_t_4) {
4050 
4051     /* "fiona/_env.pyx":220
4052  *         return
4053  *     elif normalize and isinstance(val, bool):
4054  *         val = ('ON' if val and val else 'OFF').encode('utf-8')             # <<<<<<<<<<<<<<
4055  *     else:
4056  *         # Value could be an int
4057  */
4058     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
4059     if (__pyx_t_8) {
4060     } else {
4061       __pyx_t_4 = __pyx_t_8;
4062       goto __pyx_L7_bool_binop_done;
4063     }
4064     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
4065     __pyx_t_4 = __pyx_t_8;
4066     __pyx_L7_bool_binop_done:;
4067     if (__pyx_t_4) {
4068       __Pyx_INCREF(__pyx_n_u_ON);
4069       __pyx_t_1 = __pyx_n_u_ON;
4070     } else {
4071       __Pyx_INCREF(__pyx_n_u_OFF);
4072       __pyx_t_1 = __pyx_n_u_OFF;
4073     }
4074     if (unlikely(__pyx_t_1 == Py_None)) {
4075       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
4076       __PYX_ERR(0, 220, __pyx_L1_error)
4077     }
4078     __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
4079     __Pyx_GOTREF(__pyx_t_2);
4080     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4081     __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_2);
4082     __pyx_t_2 = 0;
4083 
4084     /* "fiona/_env.pyx":219
4085  *             GDALSetCacheMax(val)
4086  *         return
4087  *     elif normalize and isinstance(val, bool):             # <<<<<<<<<<<<<<
4088  *         val = ('ON' if val and val else 'OFF').encode('utf-8')
4089  *     else:
4090  */
4091     goto __pyx_L3;
4092   }
4093 
4094   /* "fiona/_env.pyx":223
4095  *     else:
4096  *         # Value could be an int
4097  *         val = str(val).encode('utf-8')             # <<<<<<<<<<<<<<
4098  *
4099  *     if isinstance(threading.current_thread(), threading._MainThread):
4100  */
4101   /*else*/ {
4102     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_val); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
4103     __Pyx_GOTREF(__pyx_t_2);
4104     __pyx_t_1 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
4105     __Pyx_GOTREF(__pyx_t_1);
4106     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4107     __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_1);
4108     __pyx_t_1 = 0;
4109   }
4110   __pyx_L3:;
4111 
4112   /* "fiona/_env.pyx":225
4113  *         val = str(val).encode('utf-8')
4114  *
4115  *     if isinstance(threading.current_thread(), threading._MainThread):             # <<<<<<<<<<<<<<
4116  *         CPLSetConfigOption(<const char *>key, <const char *>val)
4117  *     else:
4118  */
4119   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
4120   __Pyx_GOTREF(__pyx_t_2);
4121   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
4122   __Pyx_GOTREF(__pyx_t_3);
4123   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4124   __pyx_t_2 = NULL;
4125   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4126     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
4127     if (likely(__pyx_t_2)) {
4128       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4129       __Pyx_INCREF(__pyx_t_2);
4130       __Pyx_INCREF(function);
4131       __Pyx_DECREF_SET(__pyx_t_3, function);
4132     }
4133   }
4134   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4135   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4136   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
4137   __Pyx_GOTREF(__pyx_t_1);
4138   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4139   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
4140   __Pyx_GOTREF(__pyx_t_3);
4141   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_MainThread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
4142   __Pyx_GOTREF(__pyx_t_2);
4143   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4144   __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 225, __pyx_L1_error)
4145   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4146   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4147   __pyx_t_8 = (__pyx_t_4 != 0);
4148   if (__pyx_t_8) {
4149 
4150     /* "fiona/_env.pyx":226
4151  *
4152  *     if isinstance(threading.current_thread(), threading._MainThread):
4153  *         CPLSetConfigOption(<const char *>key, <const char *>val)             # <<<<<<<<<<<<<<
4154  *     else:
4155  *         CPLSetThreadLocalConfigOption(<const char *>key, <const char *>val)
4156  */
4157     __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error)
4158     __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_val); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error)
4159     CPLSetConfigOption(((char const *)__pyx_t_9), ((char const *)__pyx_t_10));
4160 
4161     /* "fiona/_env.pyx":225
4162  *         val = str(val).encode('utf-8')
4163  *
4164  *     if isinstance(threading.current_thread(), threading._MainThread):             # <<<<<<<<<<<<<<
4165  *         CPLSetConfigOption(<const char *>key, <const char *>val)
4166  *     else:
4167  */
4168     goto __pyx_L9;
4169   }
4170 
4171   /* "fiona/_env.pyx":228
4172  *         CPLSetConfigOption(<const char *>key, <const char *>val)
4173  *     else:
4174  *         CPLSetThreadLocalConfigOption(<const char *>key, <const char *>val)             # <<<<<<<<<<<<<<
4175  *
4176  *
4177  */
4178   /*else*/ {
4179     __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error)
4180     __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_val); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error)
4181     CPLSetThreadLocalConfigOption(((char const *)__pyx_t_11), ((char const *)__pyx_t_12));
4182   }
4183   __pyx_L9:;
4184 
4185   /* "fiona/_env.pyx":200
4186  *
4187  *
4188  * cpdef set_gdal_config(key, val, normalize=True):             # <<<<<<<<<<<<<<
4189  *     """Set a GDAL configuration option's value.
4190  *
4191  */
4192 
4193   /* function exit code */
4194   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4195   goto __pyx_L0;
4196   __pyx_L1_error:;
4197   __Pyx_XDECREF(__pyx_t_1);
4198   __Pyx_XDECREF(__pyx_t_2);
4199   __Pyx_XDECREF(__pyx_t_3);
4200   __Pyx_AddTraceback("fiona._env.set_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
4201   __pyx_r = 0;
4202   __pyx_L0:;
4203   __Pyx_XDECREF(__pyx_v_key);
4204   __Pyx_XDECREF(__pyx_v_val);
4205   __Pyx_XGIVEREF(__pyx_r);
4206   __Pyx_RefNannyFinishContext();
4207   return __pyx_r;
4208 }
4209 
4210 /* Python wrapper */
4211 static PyObject *__pyx_pw_5fiona_4_env_15set_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4212 static char __pyx_doc_5fiona_4_env_14set_gdal_config[] = "Set a GDAL configuration option's value.\n\n    Parameters\n    ----------\n    key : str\n        Name of config option.\n    normalize : bool, optional\n        Convert ``True`` to `\"ON\"` and ``False`` to `\"OFF\"``.\n    ";
__pyx_pw_5fiona_4_env_15set_gdal_config(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4213 static PyObject *__pyx_pw_5fiona_4_env_15set_gdal_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4214   PyObject *__pyx_v_key = 0;
4215   PyObject *__pyx_v_val = 0;
4216   PyObject *__pyx_v_normalize = 0;
4217   int __pyx_lineno = 0;
4218   const char *__pyx_filename = NULL;
4219   int __pyx_clineno = 0;
4220   PyObject *__pyx_r = 0;
4221   __Pyx_RefNannyDeclarations
4222   __Pyx_RefNannySetupContext("set_gdal_config (wrapper)", 0);
4223   {
4224     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_val,&__pyx_n_s_normalize,0};
4225     PyObject* values[3] = {0,0,0};
4226     values[2] = ((PyObject *)Py_True);
4227     if (unlikely(__pyx_kwds)) {
4228       Py_ssize_t kw_args;
4229       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4230       switch (pos_args) {
4231         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4232         CYTHON_FALLTHROUGH;
4233         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4234         CYTHON_FALLTHROUGH;
4235         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4236         CYTHON_FALLTHROUGH;
4237         case  0: break;
4238         default: goto __pyx_L5_argtuple_error;
4239       }
4240       kw_args = PyDict_Size(__pyx_kwds);
4241       switch (pos_args) {
4242         case  0:
4243         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
4244         else goto __pyx_L5_argtuple_error;
4245         CYTHON_FALLTHROUGH;
4246         case  1:
4247         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
4248         else {
4249           __Pyx_RaiseArgtupleInvalid("set_gdal_config", 0, 2, 3, 1); __PYX_ERR(0, 200, __pyx_L3_error)
4250         }
4251         CYTHON_FALLTHROUGH;
4252         case  2:
4253         if (kw_args > 0) {
4254           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normalize);
4255           if (value) { values[2] = value; kw_args--; }
4256         }
4257       }
4258       if (unlikely(kw_args > 0)) {
4259         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_gdal_config") < 0)) __PYX_ERR(0, 200, __pyx_L3_error)
4260       }
4261     } else {
4262       switch (PyTuple_GET_SIZE(__pyx_args)) {
4263         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4264         CYTHON_FALLTHROUGH;
4265         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4266         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4267         break;
4268         default: goto __pyx_L5_argtuple_error;
4269       }
4270     }
4271     __pyx_v_key = values[0];
4272     __pyx_v_val = values[1];
4273     __pyx_v_normalize = values[2];
4274   }
4275   goto __pyx_L4_argument_unpacking_done;
4276   __pyx_L5_argtuple_error:;
4277   __Pyx_RaiseArgtupleInvalid("set_gdal_config", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 200, __pyx_L3_error)
4278   __pyx_L3_error:;
4279   __Pyx_AddTraceback("fiona._env.set_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
4280   __Pyx_RefNannyFinishContext();
4281   return NULL;
4282   __pyx_L4_argument_unpacking_done:;
4283   __pyx_r = __pyx_pf_5fiona_4_env_14set_gdal_config(__pyx_self, __pyx_v_key, __pyx_v_val, __pyx_v_normalize);
4284 
4285   /* function exit code */
4286   __Pyx_RefNannyFinishContext();
4287   return __pyx_r;
4288 }
4289 
__pyx_pf_5fiona_4_env_14set_gdal_config(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_key,PyObject * __pyx_v_val,PyObject * __pyx_v_normalize)4290 static PyObject *__pyx_pf_5fiona_4_env_14set_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_val, PyObject *__pyx_v_normalize) {
4291   PyObject *__pyx_r = NULL;
4292   __Pyx_RefNannyDeclarations
4293   PyObject *__pyx_t_1 = NULL;
4294   struct __pyx_opt_args_5fiona_4_env_set_gdal_config __pyx_t_2;
4295   int __pyx_lineno = 0;
4296   const char *__pyx_filename = NULL;
4297   int __pyx_clineno = 0;
4298   __Pyx_RefNannySetupContext("set_gdal_config", 0);
4299   __Pyx_XDECREF(__pyx_r);
4300   __pyx_t_2.__pyx_n = 1;
4301   __pyx_t_2.normalize = __pyx_v_normalize;
4302   __pyx_t_1 = __pyx_f_5fiona_4_env_set_gdal_config(__pyx_v_key, __pyx_v_val, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
4303   __Pyx_GOTREF(__pyx_t_1);
4304   __pyx_r = __pyx_t_1;
4305   __pyx_t_1 = 0;
4306   goto __pyx_L0;
4307 
4308   /* function exit code */
4309   __pyx_L1_error:;
4310   __Pyx_XDECREF(__pyx_t_1);
4311   __Pyx_AddTraceback("fiona._env.set_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
4312   __pyx_r = NULL;
4313   __pyx_L0:;
4314   __Pyx_XGIVEREF(__pyx_r);
4315   __Pyx_RefNannyFinishContext();
4316   return __pyx_r;
4317 }
4318 
4319 /* "fiona/_env.pyx":231
4320  *
4321  *
4322  * cpdef del_gdal_config(key):             # <<<<<<<<<<<<<<
4323  *     """Delete a GDAL configuration option.
4324  *
4325  */
4326 
4327 static PyObject *__pyx_pw_5fiona_4_env_17del_gdal_config(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/
__pyx_f_5fiona_4_env_del_gdal_config(PyObject * __pyx_v_key,CYTHON_UNUSED int __pyx_skip_dispatch)4328 static PyObject *__pyx_f_5fiona_4_env_del_gdal_config(PyObject *__pyx_v_key, CYTHON_UNUSED int __pyx_skip_dispatch) {
4329   PyObject *__pyx_r = NULL;
4330   __Pyx_RefNannyDeclarations
4331   PyObject *__pyx_t_1 = NULL;
4332   PyObject *__pyx_t_2 = NULL;
4333   PyObject *__pyx_t_3 = NULL;
4334   int __pyx_t_4;
4335   int __pyx_t_5;
4336   char const *__pyx_t_6;
4337   char const *__pyx_t_7;
4338   int __pyx_lineno = 0;
4339   const char *__pyx_filename = NULL;
4340   int __pyx_clineno = 0;
4341   __Pyx_RefNannySetupContext("del_gdal_config", 0);
4342   __Pyx_INCREF(__pyx_v_key);
4343 
4344   /* "fiona/_env.pyx":239
4345  *         Name of config option.
4346  *     """
4347  *     key = key.encode('utf-8')             # <<<<<<<<<<<<<<
4348  *     if isinstance(threading.current_thread(), threading._MainThread):
4349  *         CPLSetConfigOption(<const char *>key, NULL)
4350  */
4351   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
4352   __Pyx_GOTREF(__pyx_t_2);
4353   __pyx_t_3 = NULL;
4354   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4355     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4356     if (likely(__pyx_t_3)) {
4357       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4358       __Pyx_INCREF(__pyx_t_3);
4359       __Pyx_INCREF(function);
4360       __Pyx_DECREF_SET(__pyx_t_2, function);
4361     }
4362   }
4363   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
4364   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4365   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
4366   __Pyx_GOTREF(__pyx_t_1);
4367   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4368   __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1);
4369   __pyx_t_1 = 0;
4370 
4371   /* "fiona/_env.pyx":240
4372  *     """
4373  *     key = key.encode('utf-8')
4374  *     if isinstance(threading.current_thread(), threading._MainThread):             # <<<<<<<<<<<<<<
4375  *         CPLSetConfigOption(<const char *>key, NULL)
4376  *     else:
4377  */
4378   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
4379   __Pyx_GOTREF(__pyx_t_2);
4380   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
4381   __Pyx_GOTREF(__pyx_t_3);
4382   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4383   __pyx_t_2 = NULL;
4384   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4385     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
4386     if (likely(__pyx_t_2)) {
4387       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4388       __Pyx_INCREF(__pyx_t_2);
4389       __Pyx_INCREF(function);
4390       __Pyx_DECREF_SET(__pyx_t_3, function);
4391     }
4392   }
4393   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4394   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4395   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
4396   __Pyx_GOTREF(__pyx_t_1);
4397   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4398   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
4399   __Pyx_GOTREF(__pyx_t_3);
4400   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_MainThread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
4401   __Pyx_GOTREF(__pyx_t_2);
4402   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4403   __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 240, __pyx_L1_error)
4404   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4405   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4406   __pyx_t_5 = (__pyx_t_4 != 0);
4407   if (__pyx_t_5) {
4408 
4409     /* "fiona/_env.pyx":241
4410  *     key = key.encode('utf-8')
4411  *     if isinstance(threading.current_thread(), threading._MainThread):
4412  *         CPLSetConfigOption(<const char *>key, NULL)             # <<<<<<<<<<<<<<
4413  *     else:
4414  *         CPLSetThreadLocalConfigOption(<const char *>key, NULL)
4415  */
4416     __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error)
4417     CPLSetConfigOption(((char const *)__pyx_t_6), NULL);
4418 
4419     /* "fiona/_env.pyx":240
4420  *     """
4421  *     key = key.encode('utf-8')
4422  *     if isinstance(threading.current_thread(), threading._MainThread):             # <<<<<<<<<<<<<<
4423  *         CPLSetConfigOption(<const char *>key, NULL)
4424  *     else:
4425  */
4426     goto __pyx_L3;
4427   }
4428 
4429   /* "fiona/_env.pyx":243
4430  *         CPLSetConfigOption(<const char *>key, NULL)
4431  *     else:
4432  *         CPLSetThreadLocalConfigOption(<const char *>key, NULL)             # <<<<<<<<<<<<<<
4433  *
4434  *
4435  */
4436   /*else*/ {
4437     __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error)
4438     CPLSetThreadLocalConfigOption(((char const *)__pyx_t_7), NULL);
4439   }
4440   __pyx_L3:;
4441 
4442   /* "fiona/_env.pyx":231
4443  *
4444  *
4445  * cpdef del_gdal_config(key):             # <<<<<<<<<<<<<<
4446  *     """Delete a GDAL configuration option.
4447  *
4448  */
4449 
4450   /* function exit code */
4451   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4452   goto __pyx_L0;
4453   __pyx_L1_error:;
4454   __Pyx_XDECREF(__pyx_t_1);
4455   __Pyx_XDECREF(__pyx_t_2);
4456   __Pyx_XDECREF(__pyx_t_3);
4457   __Pyx_AddTraceback("fiona._env.del_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
4458   __pyx_r = 0;
4459   __pyx_L0:;
4460   __Pyx_XDECREF(__pyx_v_key);
4461   __Pyx_XGIVEREF(__pyx_r);
4462   __Pyx_RefNannyFinishContext();
4463   return __pyx_r;
4464 }
4465 
4466 /* Python wrapper */
4467 static PyObject *__pyx_pw_5fiona_4_env_17del_gdal_config(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/
4468 static char __pyx_doc_5fiona_4_env_16del_gdal_config[] = "Delete a GDAL configuration option.\n\n    Parameters\n    ----------\n    key : str\n        Name of config option.\n    ";
__pyx_pw_5fiona_4_env_17del_gdal_config(PyObject * __pyx_self,PyObject * __pyx_v_key)4469 static PyObject *__pyx_pw_5fiona_4_env_17del_gdal_config(PyObject *__pyx_self, PyObject *__pyx_v_key) {
4470   PyObject *__pyx_r = 0;
4471   __Pyx_RefNannyDeclarations
4472   __Pyx_RefNannySetupContext("del_gdal_config (wrapper)", 0);
4473   __pyx_r = __pyx_pf_5fiona_4_env_16del_gdal_config(__pyx_self, ((PyObject *)__pyx_v_key));
4474 
4475   /* function exit code */
4476   __Pyx_RefNannyFinishContext();
4477   return __pyx_r;
4478 }
4479 
__pyx_pf_5fiona_4_env_16del_gdal_config(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_key)4480 static PyObject *__pyx_pf_5fiona_4_env_16del_gdal_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key) {
4481   PyObject *__pyx_r = NULL;
4482   __Pyx_RefNannyDeclarations
4483   PyObject *__pyx_t_1 = NULL;
4484   int __pyx_lineno = 0;
4485   const char *__pyx_filename = NULL;
4486   int __pyx_clineno = 0;
4487   __Pyx_RefNannySetupContext("del_gdal_config", 0);
4488   __Pyx_XDECREF(__pyx_r);
4489   __pyx_t_1 = __pyx_f_5fiona_4_env_del_gdal_config(__pyx_v_key, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
4490   __Pyx_GOTREF(__pyx_t_1);
4491   __pyx_r = __pyx_t_1;
4492   __pyx_t_1 = 0;
4493   goto __pyx_L0;
4494 
4495   /* function exit code */
4496   __pyx_L1_error:;
4497   __Pyx_XDECREF(__pyx_t_1);
4498   __Pyx_AddTraceback("fiona._env.del_gdal_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
4499   __pyx_r = NULL;
4500   __pyx_L0:;
4501   __Pyx_XGIVEREF(__pyx_r);
4502   __Pyx_RefNannyFinishContext();
4503   return __pyx_r;
4504 }
4505 
4506 /* "fiona/_env.pyx":249
4507  *     """Configuration option management"""
4508  *
4509  *     def __init__(self, **options):             # <<<<<<<<<<<<<<
4510  *         self.options = options.copy()
4511  *         self.update_config_options(**self.options)
4512  */
4513 
4514 /* Python wrapper */
4515 static int __pyx_pw_5fiona_4_env_9ConfigEnv_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4516 static int __pyx_pw_5fiona_4_env_9ConfigEnv_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4517   PyObject *__pyx_v_options = 0;
4518   int __pyx_r;
4519   __Pyx_RefNannyDeclarations
4520   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4521   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
4522     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
4523   if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
4524   __pyx_v_options = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_options)) return -1;
4525   __Pyx_GOTREF(__pyx_v_options);
4526   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv___init__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self), __pyx_v_options);
4527 
4528   /* function exit code */
4529   __Pyx_XDECREF(__pyx_v_options);
4530   __Pyx_RefNannyFinishContext();
4531   return __pyx_r;
4532 }
4533 
__pyx_pf_5fiona_4_env_9ConfigEnv___init__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self,PyObject * __pyx_v_options)4534 static int __pyx_pf_5fiona_4_env_9ConfigEnv___init__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_options) {
4535   int __pyx_r;
4536   __Pyx_RefNannyDeclarations
4537   PyObject *__pyx_t_1 = NULL;
4538   PyObject *__pyx_t_2 = NULL;
4539   PyObject *__pyx_t_3 = NULL;
4540   int __pyx_lineno = 0;
4541   const char *__pyx_filename = NULL;
4542   int __pyx_clineno = 0;
4543   __Pyx_RefNannySetupContext("__init__", 0);
4544 
4545   /* "fiona/_env.pyx":250
4546  *
4547  *     def __init__(self, **options):
4548  *         self.options = options.copy()             # <<<<<<<<<<<<<<
4549  *         self.update_config_options(**self.options)
4550  *
4551  */
4552   __pyx_t_1 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
4553   __Pyx_GOTREF(__pyx_t_1);
4554   __Pyx_GIVEREF(__pyx_t_1);
4555   __Pyx_GOTREF(__pyx_v_self->options);
4556   __Pyx_DECREF(__pyx_v_self->options);
4557   __pyx_v_self->options = __pyx_t_1;
4558   __pyx_t_1 = 0;
4559 
4560   /* "fiona/_env.pyx":251
4561  *     def __init__(self, **options):
4562  *         self.options = options.copy()
4563  *         self.update_config_options(**self.options)             # <<<<<<<<<<<<<<
4564  *
4565  *     def update_config_options(self, **kwargs):
4566  */
4567   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_config_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
4568   __Pyx_GOTREF(__pyx_t_1);
4569   if (unlikely(__pyx_v_self->options == Py_None)) {
4570     PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
4571     __PYX_ERR(0, 251, __pyx_L1_error)
4572   }
4573   if (likely(PyDict_CheckExact(__pyx_v_self->options))) {
4574     __pyx_t_2 = PyDict_Copy(__pyx_v_self->options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
4575     __Pyx_GOTREF(__pyx_t_2);
4576   } else {
4577     __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
4578     __Pyx_GOTREF(__pyx_t_2);
4579   }
4580   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
4581   __Pyx_GOTREF(__pyx_t_3);
4582   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4583   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4584   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4585 
4586   /* "fiona/_env.pyx":249
4587  *     """Configuration option management"""
4588  *
4589  *     def __init__(self, **options):             # <<<<<<<<<<<<<<
4590  *         self.options = options.copy()
4591  *         self.update_config_options(**self.options)
4592  */
4593 
4594   /* function exit code */
4595   __pyx_r = 0;
4596   goto __pyx_L0;
4597   __pyx_L1_error:;
4598   __Pyx_XDECREF(__pyx_t_1);
4599   __Pyx_XDECREF(__pyx_t_2);
4600   __Pyx_XDECREF(__pyx_t_3);
4601   __Pyx_AddTraceback("fiona._env.ConfigEnv.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4602   __pyx_r = -1;
4603   __pyx_L0:;
4604   __Pyx_RefNannyFinishContext();
4605   return __pyx_r;
4606 }
4607 
4608 /* "fiona/_env.pyx":253
4609  *         self.update_config_options(**self.options)
4610  *
4611  *     def update_config_options(self, **kwargs):             # <<<<<<<<<<<<<<
4612  *         """Update GDAL config options."""
4613  *         for key, val in kwargs.items():
4614  */
4615 
4616 /* Python wrapper */
4617 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_3update_config_options(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4618 static char __pyx_doc_5fiona_4_env_9ConfigEnv_2update_config_options[] = "Update GDAL config options.";
__pyx_pw_5fiona_4_env_9ConfigEnv_3update_config_options(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4619 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_3update_config_options(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4620   PyObject *__pyx_v_kwargs = 0;
4621   PyObject *__pyx_r = 0;
4622   __Pyx_RefNannyDeclarations
4623   __Pyx_RefNannySetupContext("update_config_options (wrapper)", 0);
4624   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
4625     __Pyx_RaiseArgtupleInvalid("update_config_options", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
4626   if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "update_config_options", 1))) return NULL;
4627   __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
4628   __Pyx_GOTREF(__pyx_v_kwargs);
4629   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_2update_config_options(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self), __pyx_v_kwargs);
4630 
4631   /* function exit code */
4632   __Pyx_XDECREF(__pyx_v_kwargs);
4633   __Pyx_RefNannyFinishContext();
4634   return __pyx_r;
4635 }
4636 
__pyx_pf_5fiona_4_env_9ConfigEnv_2update_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self,PyObject * __pyx_v_kwargs)4637 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_2update_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_kwargs) {
4638   PyObject *__pyx_v_key = NULL;
4639   PyObject *__pyx_v_val = NULL;
4640   PyObject *__pyx_r = NULL;
4641   __Pyx_RefNannyDeclarations
4642   PyObject *__pyx_t_1 = NULL;
4643   Py_ssize_t __pyx_t_2;
4644   Py_ssize_t __pyx_t_3;
4645   int __pyx_t_4;
4646   PyObject *__pyx_t_5 = NULL;
4647   PyObject *__pyx_t_6 = NULL;
4648   int __pyx_t_7;
4649   int __pyx_lineno = 0;
4650   const char *__pyx_filename = NULL;
4651   int __pyx_clineno = 0;
4652   __Pyx_RefNannySetupContext("update_config_options", 0);
4653 
4654   /* "fiona/_env.pyx":255
4655  *     def update_config_options(self, **kwargs):
4656  *         """Update GDAL config options."""
4657  *         for key, val in kwargs.items():             # <<<<<<<<<<<<<<
4658  *             set_gdal_config(key, val)
4659  *             self.options[key] = val
4660  */
4661   __pyx_t_2 = 0;
4662   __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
4663   __Pyx_GOTREF(__pyx_t_5);
4664   __Pyx_XDECREF(__pyx_t_1);
4665   __pyx_t_1 = __pyx_t_5;
4666   __pyx_t_5 = 0;
4667   while (1) {
4668     __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
4669     if (unlikely(__pyx_t_7 == 0)) break;
4670     if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 255, __pyx_L1_error)
4671     __Pyx_GOTREF(__pyx_t_5);
4672     __Pyx_GOTREF(__pyx_t_6);
4673     __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
4674     __pyx_t_5 = 0;
4675     __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_6);
4676     __pyx_t_6 = 0;
4677 
4678     /* "fiona/_env.pyx":256
4679  *         """Update GDAL config options."""
4680  *         for key, val in kwargs.items():
4681  *             set_gdal_config(key, val)             # <<<<<<<<<<<<<<
4682  *             self.options[key] = val
4683  *
4684  */
4685     __pyx_t_6 = __pyx_f_5fiona_4_env_set_gdal_config(__pyx_v_key, __pyx_v_val, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error)
4686     __Pyx_GOTREF(__pyx_t_6);
4687     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4688 
4689     /* "fiona/_env.pyx":257
4690  *         for key, val in kwargs.items():
4691  *             set_gdal_config(key, val)
4692  *             self.options[key] = val             # <<<<<<<<<<<<<<
4693  *
4694  *     def clear_config_options(self):
4695  */
4696     if (unlikely(PyObject_SetItem(__pyx_v_self->options, __pyx_v_key, __pyx_v_val) < 0)) __PYX_ERR(0, 257, __pyx_L1_error)
4697   }
4698   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4699 
4700   /* "fiona/_env.pyx":253
4701  *         self.update_config_options(**self.options)
4702  *
4703  *     def update_config_options(self, **kwargs):             # <<<<<<<<<<<<<<
4704  *         """Update GDAL config options."""
4705  *         for key, val in kwargs.items():
4706  */
4707 
4708   /* function exit code */
4709   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4710   goto __pyx_L0;
4711   __pyx_L1_error:;
4712   __Pyx_XDECREF(__pyx_t_1);
4713   __Pyx_XDECREF(__pyx_t_5);
4714   __Pyx_XDECREF(__pyx_t_6);
4715   __Pyx_AddTraceback("fiona._env.ConfigEnv.update_config_options", __pyx_clineno, __pyx_lineno, __pyx_filename);
4716   __pyx_r = NULL;
4717   __pyx_L0:;
4718   __Pyx_XDECREF(__pyx_v_key);
4719   __Pyx_XDECREF(__pyx_v_val);
4720   __Pyx_XGIVEREF(__pyx_r);
4721   __Pyx_RefNannyFinishContext();
4722   return __pyx_r;
4723 }
4724 
4725 /* "fiona/_env.pyx":259
4726  *             self.options[key] = val
4727  *
4728  *     def clear_config_options(self):             # <<<<<<<<<<<<<<
4729  *         """Clear GDAL config options."""
4730  *         while self.options:
4731  */
4732 
4733 /* Python wrapper */
4734 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_5clear_config_options(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4735 static char __pyx_doc_5fiona_4_env_9ConfigEnv_4clear_config_options[] = "Clear GDAL config options.";
__pyx_pw_5fiona_4_env_9ConfigEnv_5clear_config_options(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4736 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_5clear_config_options(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4737   PyObject *__pyx_r = 0;
4738   __Pyx_RefNannyDeclarations
4739   __Pyx_RefNannySetupContext("clear_config_options (wrapper)", 0);
4740   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_4clear_config_options(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self));
4741 
4742   /* function exit code */
4743   __Pyx_RefNannyFinishContext();
4744   return __pyx_r;
4745 }
4746 
__pyx_pf_5fiona_4_env_9ConfigEnv_4clear_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self)4747 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_4clear_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self) {
4748   PyObject *__pyx_v_key = NULL;
4749   CYTHON_UNUSED PyObject *__pyx_v_val = NULL;
4750   PyObject *__pyx_r = NULL;
4751   __Pyx_RefNannyDeclarations
4752   int __pyx_t_1;
4753   PyObject *__pyx_t_2 = NULL;
4754   PyObject *__pyx_t_3 = NULL;
4755   PyObject *__pyx_t_4 = NULL;
4756   PyObject *__pyx_t_5 = NULL;
4757   PyObject *(*__pyx_t_6)(PyObject *);
4758   int __pyx_lineno = 0;
4759   const char *__pyx_filename = NULL;
4760   int __pyx_clineno = 0;
4761   __Pyx_RefNannySetupContext("clear_config_options", 0);
4762 
4763   /* "fiona/_env.pyx":261
4764  *     def clear_config_options(self):
4765  *         """Clear GDAL config options."""
4766  *         while self.options:             # <<<<<<<<<<<<<<
4767  *             key, val = self.options.popitem()
4768  *             del_gdal_config(key)
4769  */
4770   while (1) {
4771     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->options); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 261, __pyx_L1_error)
4772     if (!__pyx_t_1) break;
4773 
4774     /* "fiona/_env.pyx":262
4775  *         """Clear GDAL config options."""
4776  *         while self.options:
4777  *             key, val = self.options.popitem()             # <<<<<<<<<<<<<<
4778  *             del_gdal_config(key)
4779  *
4780  */
4781     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->options, __pyx_n_s_popitem); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
4782     __Pyx_GOTREF(__pyx_t_3);
4783     __pyx_t_4 = NULL;
4784     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4785       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4786       if (likely(__pyx_t_4)) {
4787         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4788         __Pyx_INCREF(__pyx_t_4);
4789         __Pyx_INCREF(function);
4790         __Pyx_DECREF_SET(__pyx_t_3, function);
4791       }
4792     }
4793     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4794     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4795     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
4796     __Pyx_GOTREF(__pyx_t_2);
4797     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4798     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
4799       PyObject* sequence = __pyx_t_2;
4800       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4801       if (unlikely(size != 2)) {
4802         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4803         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4804         __PYX_ERR(0, 262, __pyx_L1_error)
4805       }
4806       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4807       if (likely(PyTuple_CheckExact(sequence))) {
4808         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
4809         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
4810       } else {
4811         __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
4812         __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
4813       }
4814       __Pyx_INCREF(__pyx_t_3);
4815       __Pyx_INCREF(__pyx_t_4);
4816       #else
4817       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
4818       __Pyx_GOTREF(__pyx_t_3);
4819       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error)
4820       __Pyx_GOTREF(__pyx_t_4);
4821       #endif
4822       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4823     } else {
4824       Py_ssize_t index = -1;
4825       __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
4826       __Pyx_GOTREF(__pyx_t_5);
4827       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4828       __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
4829       index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
4830       __Pyx_GOTREF(__pyx_t_3);
4831       index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
4832       __Pyx_GOTREF(__pyx_t_4);
4833       if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 262, __pyx_L1_error)
4834       __pyx_t_6 = NULL;
4835       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4836       goto __pyx_L6_unpacking_done;
4837       __pyx_L5_unpacking_failed:;
4838       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4839       __pyx_t_6 = NULL;
4840       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4841       __PYX_ERR(0, 262, __pyx_L1_error)
4842       __pyx_L6_unpacking_done:;
4843     }
4844     __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
4845     __pyx_t_3 = 0;
4846     __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_4);
4847     __pyx_t_4 = 0;
4848 
4849     /* "fiona/_env.pyx":263
4850  *         while self.options:
4851  *             key, val = self.options.popitem()
4852  *             del_gdal_config(key)             # <<<<<<<<<<<<<<
4853  *
4854  *     def get_config_options(self):
4855  */
4856     __pyx_t_2 = __pyx_f_5fiona_4_env_del_gdal_config(__pyx_v_key, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
4857     __Pyx_GOTREF(__pyx_t_2);
4858     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4859   }
4860 
4861   /* "fiona/_env.pyx":259
4862  *             self.options[key] = val
4863  *
4864  *     def clear_config_options(self):             # <<<<<<<<<<<<<<
4865  *         """Clear GDAL config options."""
4866  *         while self.options:
4867  */
4868 
4869   /* function exit code */
4870   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4871   goto __pyx_L0;
4872   __pyx_L1_error:;
4873   __Pyx_XDECREF(__pyx_t_2);
4874   __Pyx_XDECREF(__pyx_t_3);
4875   __Pyx_XDECREF(__pyx_t_4);
4876   __Pyx_XDECREF(__pyx_t_5);
4877   __Pyx_AddTraceback("fiona._env.ConfigEnv.clear_config_options", __pyx_clineno, __pyx_lineno, __pyx_filename);
4878   __pyx_r = NULL;
4879   __pyx_L0:;
4880   __Pyx_XDECREF(__pyx_v_key);
4881   __Pyx_XDECREF(__pyx_v_val);
4882   __Pyx_XGIVEREF(__pyx_r);
4883   __Pyx_RefNannyFinishContext();
4884   return __pyx_r;
4885 }
4886 
4887 /* "fiona/_env.pyx":265
4888  *             del_gdal_config(key)
4889  *
4890  *     def get_config_options(self):             # <<<<<<<<<<<<<<
4891  *         return {k: get_gdal_config(k) for k in self.options}
4892  *
4893  */
4894 
4895 /* Python wrapper */
4896 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_7get_config_options(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_7get_config_options(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4897 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_7get_config_options(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4898   PyObject *__pyx_r = 0;
4899   __Pyx_RefNannyDeclarations
4900   __Pyx_RefNannySetupContext("get_config_options (wrapper)", 0);
4901   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_6get_config_options(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self));
4902 
4903   /* function exit code */
4904   __Pyx_RefNannyFinishContext();
4905   return __pyx_r;
4906 }
4907 
__pyx_pf_5fiona_4_env_9ConfigEnv_6get_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self)4908 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_6get_config_options(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self) {
4909   PyObject *__pyx_7genexpr__pyx_v_k = NULL;
4910   PyObject *__pyx_r = NULL;
4911   __Pyx_RefNannyDeclarations
4912   PyObject *__pyx_t_1 = NULL;
4913   PyObject *__pyx_t_2 = NULL;
4914   Py_ssize_t __pyx_t_3;
4915   PyObject *(*__pyx_t_4)(PyObject *);
4916   PyObject *__pyx_t_5 = NULL;
4917   int __pyx_lineno = 0;
4918   const char *__pyx_filename = NULL;
4919   int __pyx_clineno = 0;
4920   __Pyx_RefNannySetupContext("get_config_options", 0);
4921 
4922   /* "fiona/_env.pyx":266
4923  *
4924  *     def get_config_options(self):
4925  *         return {k: get_gdal_config(k) for k in self.options}             # <<<<<<<<<<<<<<
4926  *
4927  *
4928  */
4929   __Pyx_XDECREF(__pyx_r);
4930   { /* enter inner scope */
4931     __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L5_error)
4932     __Pyx_GOTREF(__pyx_t_1);
4933     if (likely(PyList_CheckExact(__pyx_v_self->options)) || PyTuple_CheckExact(__pyx_v_self->options)) {
4934       __pyx_t_2 = __pyx_v_self->options; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
4935       __pyx_t_4 = NULL;
4936     } else {
4937       __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L5_error)
4938       __Pyx_GOTREF(__pyx_t_2);
4939       __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L5_error)
4940     }
4941     for (;;) {
4942       if (likely(!__pyx_t_4)) {
4943         if (likely(PyList_CheckExact(__pyx_t_2))) {
4944           if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
4945           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4946           __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 266, __pyx_L5_error)
4947           #else
4948           __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L5_error)
4949           __Pyx_GOTREF(__pyx_t_5);
4950           #endif
4951         } else {
4952           if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
4953           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4954           __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 266, __pyx_L5_error)
4955           #else
4956           __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L5_error)
4957           __Pyx_GOTREF(__pyx_t_5);
4958           #endif
4959         }
4960       } else {
4961         __pyx_t_5 = __pyx_t_4(__pyx_t_2);
4962         if (unlikely(!__pyx_t_5)) {
4963           PyObject* exc_type = PyErr_Occurred();
4964           if (exc_type) {
4965             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4966             else __PYX_ERR(0, 266, __pyx_L5_error)
4967           }
4968           break;
4969         }
4970         __Pyx_GOTREF(__pyx_t_5);
4971       }
4972       __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_5);
4973       __pyx_t_5 = 0;
4974       __pyx_t_5 = __pyx_f_5fiona_4_env_get_gdal_config(__pyx_7genexpr__pyx_v_k, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L5_error)
4975       __Pyx_GOTREF(__pyx_t_5);
4976       if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 266, __pyx_L5_error)
4977       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4978     }
4979     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4980     __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0;
4981     goto __pyx_L8_exit_scope;
4982     __pyx_L5_error:;
4983     __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0;
4984     goto __pyx_L1_error;
4985     __pyx_L8_exit_scope:;
4986   } /* exit inner scope */
4987   __pyx_r = __pyx_t_1;
4988   __pyx_t_1 = 0;
4989   goto __pyx_L0;
4990 
4991   /* "fiona/_env.pyx":265
4992  *             del_gdal_config(key)
4993  *
4994  *     def get_config_options(self):             # <<<<<<<<<<<<<<
4995  *         return {k: get_gdal_config(k) for k in self.options}
4996  *
4997  */
4998 
4999   /* function exit code */
5000   __pyx_L1_error:;
5001   __Pyx_XDECREF(__pyx_t_1);
5002   __Pyx_XDECREF(__pyx_t_2);
5003   __Pyx_XDECREF(__pyx_t_5);
5004   __Pyx_AddTraceback("fiona._env.ConfigEnv.get_config_options", __pyx_clineno, __pyx_lineno, __pyx_filename);
5005   __pyx_r = NULL;
5006   __pyx_L0:;
5007   __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k);
5008   __Pyx_XGIVEREF(__pyx_r);
5009   __Pyx_RefNannyFinishContext();
5010   return __pyx_r;
5011 }
5012 
5013 /* "fiona/_env.pxd":2
5014  * cdef class ConfigEnv(object):
5015  *     cdef public object options             # <<<<<<<<<<<<<<
5016  *
5017  *
5018  */
5019 
5020 /* Python wrapper */
5021 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_7options_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_7options_1__get__(PyObject * __pyx_v_self)5022 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_7options_1__get__(PyObject *__pyx_v_self) {
5023   PyObject *__pyx_r = 0;
5024   __Pyx_RefNannyDeclarations
5025   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5026   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_7options___get__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self));
5027 
5028   /* function exit code */
5029   __Pyx_RefNannyFinishContext();
5030   return __pyx_r;
5031 }
5032 
__pyx_pf_5fiona_4_env_9ConfigEnv_7options___get__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self)5033 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_7options___get__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self) {
5034   PyObject *__pyx_r = NULL;
5035   __Pyx_RefNannyDeclarations
5036   __Pyx_RefNannySetupContext("__get__", 0);
5037   __Pyx_XDECREF(__pyx_r);
5038   __Pyx_INCREF(__pyx_v_self->options);
5039   __pyx_r = __pyx_v_self->options;
5040   goto __pyx_L0;
5041 
5042   /* function exit code */
5043   __pyx_L0:;
5044   __Pyx_XGIVEREF(__pyx_r);
5045   __Pyx_RefNannyFinishContext();
5046   return __pyx_r;
5047 }
5048 
5049 /* Python wrapper */
5050 static int __pyx_pw_5fiona_4_env_9ConfigEnv_7options_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_7options_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)5051 static int __pyx_pw_5fiona_4_env_9ConfigEnv_7options_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5052   int __pyx_r;
5053   __Pyx_RefNannyDeclarations
5054   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
5055   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_7options_2__set__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self), ((PyObject *)__pyx_v_value));
5056 
5057   /* function exit code */
5058   __Pyx_RefNannyFinishContext();
5059   return __pyx_r;
5060 }
5061 
__pyx_pf_5fiona_4_env_9ConfigEnv_7options_2__set__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self,PyObject * __pyx_v_value)5062 static int __pyx_pf_5fiona_4_env_9ConfigEnv_7options_2__set__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v_value) {
5063   int __pyx_r;
5064   __Pyx_RefNannyDeclarations
5065   __Pyx_RefNannySetupContext("__set__", 0);
5066   __Pyx_INCREF(__pyx_v_value);
5067   __Pyx_GIVEREF(__pyx_v_value);
5068   __Pyx_GOTREF(__pyx_v_self->options);
5069   __Pyx_DECREF(__pyx_v_self->options);
5070   __pyx_v_self->options = __pyx_v_value;
5071 
5072   /* function exit code */
5073   __pyx_r = 0;
5074   __Pyx_RefNannyFinishContext();
5075   return __pyx_r;
5076 }
5077 
5078 /* Python wrapper */
5079 static int __pyx_pw_5fiona_4_env_9ConfigEnv_7options_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_7options_5__del__(PyObject * __pyx_v_self)5080 static int __pyx_pw_5fiona_4_env_9ConfigEnv_7options_5__del__(PyObject *__pyx_v_self) {
5081   int __pyx_r;
5082   __Pyx_RefNannyDeclarations
5083   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
5084   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_7options_4__del__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self));
5085 
5086   /* function exit code */
5087   __Pyx_RefNannyFinishContext();
5088   return __pyx_r;
5089 }
5090 
__pyx_pf_5fiona_4_env_9ConfigEnv_7options_4__del__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self)5091 static int __pyx_pf_5fiona_4_env_9ConfigEnv_7options_4__del__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self) {
5092   int __pyx_r;
5093   __Pyx_RefNannyDeclarations
5094   __Pyx_RefNannySetupContext("__del__", 0);
5095   __Pyx_INCREF(Py_None);
5096   __Pyx_GIVEREF(Py_None);
5097   __Pyx_GOTREF(__pyx_v_self->options);
5098   __Pyx_DECREF(__pyx_v_self->options);
5099   __pyx_v_self->options = Py_None;
5100 
5101   /* function exit code */
5102   __pyx_r = 0;
5103   __Pyx_RefNannyFinishContext();
5104   return __pyx_r;
5105 }
5106 
5107 /* "(tree fragment)":1
5108  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5109  *     cdef tuple state
5110  *     cdef object _dict
5111  */
5112 
5113 /* Python wrapper */
5114 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5115 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5116   PyObject *__pyx_r = 0;
5117   __Pyx_RefNannyDeclarations
5118   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5119   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_8__reduce_cython__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self));
5120 
5121   /* function exit code */
5122   __Pyx_RefNannyFinishContext();
5123   return __pyx_r;
5124 }
5125 
__pyx_pf_5fiona_4_env_9ConfigEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self)5126 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self) {
5127   PyObject *__pyx_v_state = 0;
5128   PyObject *__pyx_v__dict = 0;
5129   int __pyx_v_use_setstate;
5130   PyObject *__pyx_r = NULL;
5131   __Pyx_RefNannyDeclarations
5132   PyObject *__pyx_t_1 = NULL;
5133   int __pyx_t_2;
5134   int __pyx_t_3;
5135   PyObject *__pyx_t_4 = NULL;
5136   PyObject *__pyx_t_5 = NULL;
5137   int __pyx_lineno = 0;
5138   const char *__pyx_filename = NULL;
5139   int __pyx_clineno = 0;
5140   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5141 
5142   /* "(tree fragment)":5
5143  *     cdef object _dict
5144  *     cdef bint use_setstate
5145  *     state = (self.options,)             # <<<<<<<<<<<<<<
5146  *     _dict = getattr(self, '__dict__', None)
5147  *     if _dict is not None:
5148  */
5149   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
5150   __Pyx_GOTREF(__pyx_t_1);
5151   __Pyx_INCREF(__pyx_v_self->options);
5152   __Pyx_GIVEREF(__pyx_v_self->options);
5153   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->options);
5154   __pyx_v_state = ((PyObject*)__pyx_t_1);
5155   __pyx_t_1 = 0;
5156 
5157   /* "(tree fragment)":6
5158  *     cdef bint use_setstate
5159  *     state = (self.options,)
5160  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
5161  *     if _dict is not None:
5162  *         state += (_dict,)
5163  */
5164   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
5165   __Pyx_GOTREF(__pyx_t_1);
5166   __pyx_v__dict = __pyx_t_1;
5167   __pyx_t_1 = 0;
5168 
5169   /* "(tree fragment)":7
5170  *     state = (self.options,)
5171  *     _dict = getattr(self, '__dict__', None)
5172  *     if _dict is not None:             # <<<<<<<<<<<<<<
5173  *         state += (_dict,)
5174  *         use_setstate = True
5175  */
5176   __pyx_t_2 = (__pyx_v__dict != Py_None);
5177   __pyx_t_3 = (__pyx_t_2 != 0);
5178   if (__pyx_t_3) {
5179 
5180     /* "(tree fragment)":8
5181  *     _dict = getattr(self, '__dict__', None)
5182  *     if _dict is not None:
5183  *         state += (_dict,)             # <<<<<<<<<<<<<<
5184  *         use_setstate = True
5185  *     else:
5186  */
5187     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
5188     __Pyx_GOTREF(__pyx_t_1);
5189     __Pyx_INCREF(__pyx_v__dict);
5190     __Pyx_GIVEREF(__pyx_v__dict);
5191     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
5192     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
5193     __Pyx_GOTREF(__pyx_t_4);
5194     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5195     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
5196     __pyx_t_4 = 0;
5197 
5198     /* "(tree fragment)":9
5199  *     if _dict is not None:
5200  *         state += (_dict,)
5201  *         use_setstate = True             # <<<<<<<<<<<<<<
5202  *     else:
5203  *         use_setstate = self.options is not None
5204  */
5205     __pyx_v_use_setstate = 1;
5206 
5207     /* "(tree fragment)":7
5208  *     state = (self.options,)
5209  *     _dict = getattr(self, '__dict__', None)
5210  *     if _dict is not None:             # <<<<<<<<<<<<<<
5211  *         state += (_dict,)
5212  *         use_setstate = True
5213  */
5214     goto __pyx_L3;
5215   }
5216 
5217   /* "(tree fragment)":11
5218  *         use_setstate = True
5219  *     else:
5220  *         use_setstate = self.options is not None             # <<<<<<<<<<<<<<
5221  *     if use_setstate:
5222  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, None), state
5223  */
5224   /*else*/ {
5225     __pyx_t_3 = (__pyx_v_self->options != Py_None);
5226     __pyx_v_use_setstate = __pyx_t_3;
5227   }
5228   __pyx_L3:;
5229 
5230   /* "(tree fragment)":12
5231  *     else:
5232  *         use_setstate = self.options is not None
5233  *     if use_setstate:             # <<<<<<<<<<<<<<
5234  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, None), state
5235  *     else:
5236  */
5237   __pyx_t_3 = (__pyx_v_use_setstate != 0);
5238   if (__pyx_t_3) {
5239 
5240     /* "(tree fragment)":13
5241  *         use_setstate = self.options is not None
5242  *     if use_setstate:
5243  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, None), state             # <<<<<<<<<<<<<<
5244  *     else:
5245  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, state)
5246  */
5247     __Pyx_XDECREF(__pyx_r);
5248     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ConfigEnv); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
5249     __Pyx_GOTREF(__pyx_t_4);
5250     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
5251     __Pyx_GOTREF(__pyx_t_1);
5252     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5253     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5254     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5255     __Pyx_INCREF(__pyx_int_155035226);
5256     __Pyx_GIVEREF(__pyx_int_155035226);
5257     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_155035226);
5258     __Pyx_INCREF(Py_None);
5259     __Pyx_GIVEREF(Py_None);
5260     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
5261     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
5262     __Pyx_GOTREF(__pyx_t_5);
5263     __Pyx_GIVEREF(__pyx_t_4);
5264     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
5265     __Pyx_GIVEREF(__pyx_t_1);
5266     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
5267     __Pyx_INCREF(__pyx_v_state);
5268     __Pyx_GIVEREF(__pyx_v_state);
5269     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
5270     __pyx_t_4 = 0;
5271     __pyx_t_1 = 0;
5272     __pyx_r = __pyx_t_5;
5273     __pyx_t_5 = 0;
5274     goto __pyx_L0;
5275 
5276     /* "(tree fragment)":12
5277  *     else:
5278  *         use_setstate = self.options is not None
5279  *     if use_setstate:             # <<<<<<<<<<<<<<
5280  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, None), state
5281  *     else:
5282  */
5283   }
5284 
5285   /* "(tree fragment)":15
5286  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, None), state
5287  *     else:
5288  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, state)             # <<<<<<<<<<<<<<
5289  * def __setstate_cython__(self, __pyx_state):
5290  *     __pyx_unpickle_ConfigEnv__set_state(self, __pyx_state)
5291  */
5292   /*else*/ {
5293     __Pyx_XDECREF(__pyx_r);
5294     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ConfigEnv); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
5295     __Pyx_GOTREF(__pyx_t_5);
5296     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
5297     __Pyx_GOTREF(__pyx_t_1);
5298     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5299     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5300     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5301     __Pyx_INCREF(__pyx_int_155035226);
5302     __Pyx_GIVEREF(__pyx_int_155035226);
5303     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_155035226);
5304     __Pyx_INCREF(__pyx_v_state);
5305     __Pyx_GIVEREF(__pyx_v_state);
5306     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
5307     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
5308     __Pyx_GOTREF(__pyx_t_4);
5309     __Pyx_GIVEREF(__pyx_t_5);
5310     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
5311     __Pyx_GIVEREF(__pyx_t_1);
5312     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
5313     __pyx_t_5 = 0;
5314     __pyx_t_1 = 0;
5315     __pyx_r = __pyx_t_4;
5316     __pyx_t_4 = 0;
5317     goto __pyx_L0;
5318   }
5319 
5320   /* "(tree fragment)":1
5321  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5322  *     cdef tuple state
5323  *     cdef object _dict
5324  */
5325 
5326   /* function exit code */
5327   __pyx_L1_error:;
5328   __Pyx_XDECREF(__pyx_t_1);
5329   __Pyx_XDECREF(__pyx_t_4);
5330   __Pyx_XDECREF(__pyx_t_5);
5331   __Pyx_AddTraceback("fiona._env.ConfigEnv.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5332   __pyx_r = NULL;
5333   __pyx_L0:;
5334   __Pyx_XDECREF(__pyx_v_state);
5335   __Pyx_XDECREF(__pyx_v__dict);
5336   __Pyx_XGIVEREF(__pyx_r);
5337   __Pyx_RefNannyFinishContext();
5338   return __pyx_r;
5339 }
5340 
5341 /* "(tree fragment)":16
5342  *     else:
5343  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, state)
5344  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5345  *     __pyx_unpickle_ConfigEnv__set_state(self, __pyx_state)
5346  */
5347 
5348 /* Python wrapper */
5349 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_5fiona_4_env_9ConfigEnv_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5350 static PyObject *__pyx_pw_5fiona_4_env_9ConfigEnv_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5351   PyObject *__pyx_r = 0;
5352   __Pyx_RefNannyDeclarations
5353   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5354   __pyx_r = __pyx_pf_5fiona_4_env_9ConfigEnv_10__setstate_cython__(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5355 
5356   /* function exit code */
5357   __Pyx_RefNannyFinishContext();
5358   return __pyx_r;
5359 }
5360 
__pyx_pf_5fiona_4_env_9ConfigEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v_self,PyObject * __pyx_v___pyx_state)5361 static PyObject *__pyx_pf_5fiona_4_env_9ConfigEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5362   PyObject *__pyx_r = NULL;
5363   __Pyx_RefNannyDeclarations
5364   PyObject *__pyx_t_1 = NULL;
5365   int __pyx_lineno = 0;
5366   const char *__pyx_filename = NULL;
5367   int __pyx_clineno = 0;
5368   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5369 
5370   /* "(tree fragment)":17
5371  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, state)
5372  * def __setstate_cython__(self, __pyx_state):
5373  *     __pyx_unpickle_ConfigEnv__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
5374  */
5375   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
5376   __pyx_t_1 = __pyx_f_5fiona_4_env___pyx_unpickle_ConfigEnv__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
5377   __Pyx_GOTREF(__pyx_t_1);
5378   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5379 
5380   /* "(tree fragment)":16
5381  *     else:
5382  *         return __pyx_unpickle_ConfigEnv, (type(self), 0x93da65a, state)
5383  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5384  *     __pyx_unpickle_ConfigEnv__set_state(self, __pyx_state)
5385  */
5386 
5387   /* function exit code */
5388   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5389   goto __pyx_L0;
5390   __pyx_L1_error:;
5391   __Pyx_XDECREF(__pyx_t_1);
5392   __Pyx_AddTraceback("fiona._env.ConfigEnv.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5393   __pyx_r = NULL;
5394   __pyx_L0:;
5395   __Pyx_XGIVEREF(__pyx_r);
5396   __Pyx_RefNannyFinishContext();
5397   return __pyx_r;
5398 }
5399 
5400 /* "fiona/_env.pyx":275
5401  *
5402  *     """
5403  *     def find_file(self, basename):             # <<<<<<<<<<<<<<
5404  *         """Returns path of a GDAL data file or None
5405  *
5406  */
5407 
5408 /* Python wrapper */
5409 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_1find_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5410 static char __pyx_doc_5fiona_4_env_14GDALDataFinder_find_file[] = "Returns path of a GDAL data file or None\n\n        Parameters\n        ----------\n        basename : str\n            Basename of a data file such as \"header.dxf\"\n\n        Returns\n        -------\n        str (on success) or None (on failure)\n\n        ";
5411 static PyMethodDef __pyx_mdef_5fiona_4_env_14GDALDataFinder_1find_file = {"find_file", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14GDALDataFinder_1find_file, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14GDALDataFinder_find_file};
__pyx_pw_5fiona_4_env_14GDALDataFinder_1find_file(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5412 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_1find_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5413   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
5414   PyObject *__pyx_v_basename = 0;
5415   int __pyx_lineno = 0;
5416   const char *__pyx_filename = NULL;
5417   int __pyx_clineno = 0;
5418   PyObject *__pyx_r = 0;
5419   __Pyx_RefNannyDeclarations
5420   __Pyx_RefNannySetupContext("find_file (wrapper)", 0);
5421   {
5422     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_basename,0};
5423     PyObject* values[2] = {0,0};
5424     if (unlikely(__pyx_kwds)) {
5425       Py_ssize_t kw_args;
5426       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5427       switch (pos_args) {
5428         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5429         CYTHON_FALLTHROUGH;
5430         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5431         CYTHON_FALLTHROUGH;
5432         case  0: break;
5433         default: goto __pyx_L5_argtuple_error;
5434       }
5435       kw_args = PyDict_Size(__pyx_kwds);
5436       switch (pos_args) {
5437         case  0:
5438         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5439         else goto __pyx_L5_argtuple_error;
5440         CYTHON_FALLTHROUGH;
5441         case  1:
5442         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_basename)) != 0)) kw_args--;
5443         else {
5444           __Pyx_RaiseArgtupleInvalid("find_file", 1, 2, 2, 1); __PYX_ERR(0, 275, __pyx_L3_error)
5445         }
5446       }
5447       if (unlikely(kw_args > 0)) {
5448         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_file") < 0)) __PYX_ERR(0, 275, __pyx_L3_error)
5449       }
5450     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5451       goto __pyx_L5_argtuple_error;
5452     } else {
5453       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5454       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5455     }
5456     __pyx_v_self = values[0];
5457     __pyx_v_basename = values[1];
5458   }
5459   goto __pyx_L4_argument_unpacking_done;
5460   __pyx_L5_argtuple_error:;
5461   __Pyx_RaiseArgtupleInvalid("find_file", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 275, __pyx_L3_error)
5462   __pyx_L3_error:;
5463   __Pyx_AddTraceback("fiona._env.GDALDataFinder.find_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
5464   __Pyx_RefNannyFinishContext();
5465   return NULL;
5466   __pyx_L4_argument_unpacking_done:;
5467   __pyx_r = __pyx_pf_5fiona_4_env_14GDALDataFinder_find_file(__pyx_self, __pyx_v_self, __pyx_v_basename);
5468 
5469   /* function exit code */
5470   __Pyx_RefNannyFinishContext();
5471   return __pyx_r;
5472 }
5473 
__pyx_pf_5fiona_4_env_14GDALDataFinder_find_file(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_basename)5474 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_find_file(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_basename) {
5475   char const *__pyx_v_path_c;
5476   PyObject *__pyx_v_basename_b = NULL;
5477   char const *__pyx_v_path;
5478   PyObject *__pyx_r = NULL;
5479   __Pyx_RefNannyDeclarations
5480   PyObject *__pyx_t_1 = NULL;
5481   PyObject *__pyx_t_2 = NULL;
5482   PyObject *__pyx_t_3 = NULL;
5483   char const *__pyx_t_4;
5484   int __pyx_t_5;
5485   int __pyx_lineno = 0;
5486   const char *__pyx_filename = NULL;
5487   int __pyx_clineno = 0;
5488   __Pyx_RefNannySetupContext("find_file", 0);
5489 
5490   /* "fiona/_env.pyx":288
5491  *
5492  *         """
5493  *         cdef const char *path_c = NULL             # <<<<<<<<<<<<<<
5494  *         basename_b = basename.encode('utf-8')
5495  *         path_c = CPLFindFile("gdal", <const char *>basename_b)
5496  */
5497   __pyx_v_path_c = NULL;
5498 
5499   /* "fiona/_env.pyx":289
5500  *         """
5501  *         cdef const char *path_c = NULL
5502  *         basename_b = basename.encode('utf-8')             # <<<<<<<<<<<<<<
5503  *         path_c = CPLFindFile("gdal", <const char *>basename_b)
5504  *         if path_c == NULL:
5505  */
5506   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_basename, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
5507   __Pyx_GOTREF(__pyx_t_2);
5508   __pyx_t_3 = NULL;
5509   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5510     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5511     if (likely(__pyx_t_3)) {
5512       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5513       __Pyx_INCREF(__pyx_t_3);
5514       __Pyx_INCREF(function);
5515       __Pyx_DECREF_SET(__pyx_t_2, function);
5516     }
5517   }
5518   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
5519   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5520   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
5521   __Pyx_GOTREF(__pyx_t_1);
5522   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5523   __pyx_v_basename_b = __pyx_t_1;
5524   __pyx_t_1 = 0;
5525 
5526   /* "fiona/_env.pyx":290
5527  *         cdef const char *path_c = NULL
5528  *         basename_b = basename.encode('utf-8')
5529  *         path_c = CPLFindFile("gdal", <const char *>basename_b)             # <<<<<<<<<<<<<<
5530  *         if path_c == NULL:
5531  *             return None
5532  */
5533   __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_basename_b); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
5534   __pyx_v_path_c = CPLFindFile(((char const *)"gdal"), ((char const *)__pyx_t_4));
5535 
5536   /* "fiona/_env.pyx":291
5537  *         basename_b = basename.encode('utf-8')
5538  *         path_c = CPLFindFile("gdal", <const char *>basename_b)
5539  *         if path_c == NULL:             # <<<<<<<<<<<<<<
5540  *             return None
5541  *         else:
5542  */
5543   __pyx_t_5 = ((__pyx_v_path_c == NULL) != 0);
5544   if (__pyx_t_5) {
5545 
5546     /* "fiona/_env.pyx":292
5547  *         path_c = CPLFindFile("gdal", <const char *>basename_b)
5548  *         if path_c == NULL:
5549  *             return None             # <<<<<<<<<<<<<<
5550  *         else:
5551  *             path = path_c
5552  */
5553     __Pyx_XDECREF(__pyx_r);
5554     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5555     goto __pyx_L0;
5556 
5557     /* "fiona/_env.pyx":291
5558  *         basename_b = basename.encode('utf-8')
5559  *         path_c = CPLFindFile("gdal", <const char *>basename_b)
5560  *         if path_c == NULL:             # <<<<<<<<<<<<<<
5561  *             return None
5562  *         else:
5563  */
5564   }
5565 
5566   /* "fiona/_env.pyx":294
5567  *             return None
5568  *         else:
5569  *             path = path_c             # <<<<<<<<<<<<<<
5570  *             return path
5571  *
5572  */
5573   /*else*/ {
5574     __pyx_v_path = __pyx_v_path_c;
5575 
5576     /* "fiona/_env.pyx":295
5577  *         else:
5578  *             path = path_c
5579  *             return path             # <<<<<<<<<<<<<<
5580  *
5581  *     def search(self, prefix=None):
5582  */
5583     __Pyx_XDECREF(__pyx_r);
5584     __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
5585     __Pyx_GOTREF(__pyx_t_1);
5586     __pyx_r = __pyx_t_1;
5587     __pyx_t_1 = 0;
5588     goto __pyx_L0;
5589   }
5590 
5591   /* "fiona/_env.pyx":275
5592  *
5593  *     """
5594  *     def find_file(self, basename):             # <<<<<<<<<<<<<<
5595  *         """Returns path of a GDAL data file or None
5596  *
5597  */
5598 
5599   /* function exit code */
5600   __pyx_L1_error:;
5601   __Pyx_XDECREF(__pyx_t_1);
5602   __Pyx_XDECREF(__pyx_t_2);
5603   __Pyx_XDECREF(__pyx_t_3);
5604   __Pyx_AddTraceback("fiona._env.GDALDataFinder.find_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
5605   __pyx_r = NULL;
5606   __pyx_L0:;
5607   __Pyx_XDECREF(__pyx_v_basename_b);
5608   __Pyx_XGIVEREF(__pyx_r);
5609   __Pyx_RefNannyFinishContext();
5610   return __pyx_r;
5611 }
5612 
5613 /* "fiona/_env.pyx":297
5614  *             return path
5615  *
5616  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
5617  *         """Returns GDAL data directory
5618  *
5619  */
5620 
5621 /* Python wrapper */
5622 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_3search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5623 static char __pyx_doc_5fiona_4_env_14GDALDataFinder_2search[] = "Returns GDAL data directory\n\n        Note well that os.environ is not consulted.\n\n        Returns\n        -------\n        str or None\n\n        ";
5624 static PyMethodDef __pyx_mdef_5fiona_4_env_14GDALDataFinder_3search = {"search", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14GDALDataFinder_3search, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14GDALDataFinder_2search};
__pyx_pw_5fiona_4_env_14GDALDataFinder_3search(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5625 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_3search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5626   PyObject *__pyx_v_self = 0;
5627   PyObject *__pyx_v_prefix = 0;
5628   int __pyx_lineno = 0;
5629   const char *__pyx_filename = NULL;
5630   int __pyx_clineno = 0;
5631   PyObject *__pyx_r = 0;
5632   __Pyx_RefNannyDeclarations
5633   __Pyx_RefNannySetupContext("search (wrapper)", 0);
5634   {
5635     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
5636     PyObject* values[2] = {0,0};
5637     values[1] = ((PyObject *)((PyObject *)Py_None));
5638     if (unlikely(__pyx_kwds)) {
5639       Py_ssize_t kw_args;
5640       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5641       switch (pos_args) {
5642         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5643         CYTHON_FALLTHROUGH;
5644         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5645         CYTHON_FALLTHROUGH;
5646         case  0: break;
5647         default: goto __pyx_L5_argtuple_error;
5648       }
5649       kw_args = PyDict_Size(__pyx_kwds);
5650       switch (pos_args) {
5651         case  0:
5652         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5653         else goto __pyx_L5_argtuple_error;
5654         CYTHON_FALLTHROUGH;
5655         case  1:
5656         if (kw_args > 0) {
5657           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
5658           if (value) { values[1] = value; kw_args--; }
5659         }
5660       }
5661       if (unlikely(kw_args > 0)) {
5662         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search") < 0)) __PYX_ERR(0, 297, __pyx_L3_error)
5663       }
5664     } else {
5665       switch (PyTuple_GET_SIZE(__pyx_args)) {
5666         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5667         CYTHON_FALLTHROUGH;
5668         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5669         break;
5670         default: goto __pyx_L5_argtuple_error;
5671       }
5672     }
5673     __pyx_v_self = values[0];
5674     __pyx_v_prefix = values[1];
5675   }
5676   goto __pyx_L4_argument_unpacking_done;
5677   __pyx_L5_argtuple_error:;
5678   __Pyx_RaiseArgtupleInvalid("search", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 297, __pyx_L3_error)
5679   __pyx_L3_error:;
5680   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search", __pyx_clineno, __pyx_lineno, __pyx_filename);
5681   __Pyx_RefNannyFinishContext();
5682   return NULL;
5683   __pyx_L4_argument_unpacking_done:;
5684   __pyx_r = __pyx_pf_5fiona_4_env_14GDALDataFinder_2search(__pyx_self, __pyx_v_self, __pyx_v_prefix);
5685 
5686   /* function exit code */
5687   __Pyx_RefNannyFinishContext();
5688   return __pyx_r;
5689 }
5690 
__pyx_pf_5fiona_4_env_14GDALDataFinder_2search(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)5691 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_2search(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
5692   PyObject *__pyx_v_path = NULL;
5693   PyObject *__pyx_r = NULL;
5694   __Pyx_RefNannyDeclarations
5695   PyObject *__pyx_t_1 = NULL;
5696   PyObject *__pyx_t_2 = NULL;
5697   PyObject *__pyx_t_3 = NULL;
5698   int __pyx_t_4;
5699   PyObject *__pyx_t_5 = NULL;
5700   int __pyx_t_6;
5701   PyObject *__pyx_t_7 = NULL;
5702   int __pyx_lineno = 0;
5703   const char *__pyx_filename = NULL;
5704   int __pyx_clineno = 0;
5705   __Pyx_RefNannySetupContext("search", 0);
5706 
5707   /* "fiona/_env.pyx":307
5708  *
5709  *         """
5710  *         path = self.search_wheel(prefix or __file__)             # <<<<<<<<<<<<<<
5711  *         if not path:
5712  *             path = self.search_prefix(prefix or sys.prefix)
5713  */
5714   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_search_wheel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
5715   __Pyx_GOTREF(__pyx_t_2);
5716   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 307, __pyx_L1_error)
5717   if (!__pyx_t_4) {
5718   } else {
5719     __Pyx_INCREF(__pyx_v_prefix);
5720     __pyx_t_3 = __pyx_v_prefix;
5721     goto __pyx_L3_bool_binop_done;
5722   }
5723   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
5724   __Pyx_GOTREF(__pyx_t_5);
5725   __Pyx_INCREF(__pyx_t_5);
5726   __pyx_t_3 = __pyx_t_5;
5727   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5728   __pyx_L3_bool_binop_done:;
5729   __pyx_t_5 = NULL;
5730   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5731     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
5732     if (likely(__pyx_t_5)) {
5733       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5734       __Pyx_INCREF(__pyx_t_5);
5735       __Pyx_INCREF(function);
5736       __Pyx_DECREF_SET(__pyx_t_2, function);
5737     }
5738   }
5739   __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
5740   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5741   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5742   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
5743   __Pyx_GOTREF(__pyx_t_1);
5744   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5745   __pyx_v_path = __pyx_t_1;
5746   __pyx_t_1 = 0;
5747 
5748   /* "fiona/_env.pyx":308
5749  *         """
5750  *         path = self.search_wheel(prefix or __file__)
5751  *         if not path:             # <<<<<<<<<<<<<<
5752  *             path = self.search_prefix(prefix or sys.prefix)
5753  *             if not path:
5754  */
5755   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 308, __pyx_L1_error)
5756   __pyx_t_6 = ((!__pyx_t_4) != 0);
5757   if (__pyx_t_6) {
5758 
5759     /* "fiona/_env.pyx":309
5760  *         path = self.search_wheel(prefix or __file__)
5761  *         if not path:
5762  *             path = self.search_prefix(prefix or sys.prefix)             # <<<<<<<<<<<<<<
5763  *             if not path:
5764  *                 path = self.search_debian(prefix or sys.prefix)
5765  */
5766     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_search_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
5767     __Pyx_GOTREF(__pyx_t_2);
5768     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 309, __pyx_L1_error)
5769     if (!__pyx_t_6) {
5770     } else {
5771       __Pyx_INCREF(__pyx_v_prefix);
5772       __pyx_t_3 = __pyx_v_prefix;
5773       goto __pyx_L6_bool_binop_done;
5774     }
5775     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
5776     __Pyx_GOTREF(__pyx_t_5);
5777     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_prefix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 309, __pyx_L1_error)
5778     __Pyx_GOTREF(__pyx_t_7);
5779     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5780     __Pyx_INCREF(__pyx_t_7);
5781     __pyx_t_3 = __pyx_t_7;
5782     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5783     __pyx_L6_bool_binop_done:;
5784     __pyx_t_7 = NULL;
5785     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5786       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
5787       if (likely(__pyx_t_7)) {
5788         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5789         __Pyx_INCREF(__pyx_t_7);
5790         __Pyx_INCREF(function);
5791         __Pyx_DECREF_SET(__pyx_t_2, function);
5792       }
5793     }
5794     __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
5795     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5796     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5797     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
5798     __Pyx_GOTREF(__pyx_t_1);
5799     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5800     __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
5801     __pyx_t_1 = 0;
5802 
5803     /* "fiona/_env.pyx":310
5804  *         if not path:
5805  *             path = self.search_prefix(prefix or sys.prefix)
5806  *             if not path:             # <<<<<<<<<<<<<<
5807  *                 path = self.search_debian(prefix or sys.prefix)
5808  *         return path
5809  */
5810     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 310, __pyx_L1_error)
5811     __pyx_t_4 = ((!__pyx_t_6) != 0);
5812     if (__pyx_t_4) {
5813 
5814       /* "fiona/_env.pyx":311
5815  *             path = self.search_prefix(prefix or sys.prefix)
5816  *             if not path:
5817  *                 path = self.search_debian(prefix or sys.prefix)             # <<<<<<<<<<<<<<
5818  *         return path
5819  *
5820  */
5821       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_search_debian); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
5822       __Pyx_GOTREF(__pyx_t_2);
5823       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 311, __pyx_L1_error)
5824       if (!__pyx_t_4) {
5825       } else {
5826         __Pyx_INCREF(__pyx_v_prefix);
5827         __pyx_t_3 = __pyx_v_prefix;
5828         goto __pyx_L9_bool_binop_done;
5829       }
5830       __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_sys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L1_error)
5831       __Pyx_GOTREF(__pyx_t_7);
5832       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 311, __pyx_L1_error)
5833       __Pyx_GOTREF(__pyx_t_5);
5834       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5835       __Pyx_INCREF(__pyx_t_5);
5836       __pyx_t_3 = __pyx_t_5;
5837       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5838       __pyx_L9_bool_binop_done:;
5839       __pyx_t_5 = NULL;
5840       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5841         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
5842         if (likely(__pyx_t_5)) {
5843           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5844           __Pyx_INCREF(__pyx_t_5);
5845           __Pyx_INCREF(function);
5846           __Pyx_DECREF_SET(__pyx_t_2, function);
5847         }
5848       }
5849       __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
5850       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5851       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5852       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
5853       __Pyx_GOTREF(__pyx_t_1);
5854       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5855       __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
5856       __pyx_t_1 = 0;
5857 
5858       /* "fiona/_env.pyx":310
5859  *         if not path:
5860  *             path = self.search_prefix(prefix or sys.prefix)
5861  *             if not path:             # <<<<<<<<<<<<<<
5862  *                 path = self.search_debian(prefix or sys.prefix)
5863  *         return path
5864  */
5865     }
5866 
5867     /* "fiona/_env.pyx":308
5868  *         """
5869  *         path = self.search_wheel(prefix or __file__)
5870  *         if not path:             # <<<<<<<<<<<<<<
5871  *             path = self.search_prefix(prefix or sys.prefix)
5872  *             if not path:
5873  */
5874   }
5875 
5876   /* "fiona/_env.pyx":312
5877  *             if not path:
5878  *                 path = self.search_debian(prefix or sys.prefix)
5879  *         return path             # <<<<<<<<<<<<<<
5880  *
5881  *     def search_wheel(self, prefix=None):
5882  */
5883   __Pyx_XDECREF(__pyx_r);
5884   __Pyx_INCREF(__pyx_v_path);
5885   __pyx_r = __pyx_v_path;
5886   goto __pyx_L0;
5887 
5888   /* "fiona/_env.pyx":297
5889  *             return path
5890  *
5891  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
5892  *         """Returns GDAL data directory
5893  *
5894  */
5895 
5896   /* function exit code */
5897   __pyx_L1_error:;
5898   __Pyx_XDECREF(__pyx_t_1);
5899   __Pyx_XDECREF(__pyx_t_2);
5900   __Pyx_XDECREF(__pyx_t_3);
5901   __Pyx_XDECREF(__pyx_t_5);
5902   __Pyx_XDECREF(__pyx_t_7);
5903   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search", __pyx_clineno, __pyx_lineno, __pyx_filename);
5904   __pyx_r = NULL;
5905   __pyx_L0:;
5906   __Pyx_XDECREF(__pyx_v_path);
5907   __Pyx_XGIVEREF(__pyx_r);
5908   __Pyx_RefNannyFinishContext();
5909   return __pyx_r;
5910 }
5911 
5912 /* "fiona/_env.pyx":314
5913  *         return path
5914  *
5915  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
5916  *         """Check wheel location"""
5917  *         if prefix is None:
5918  */
5919 
5920 /* Python wrapper */
5921 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_5search_wheel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5922 static char __pyx_doc_5fiona_4_env_14GDALDataFinder_4search_wheel[] = "Check wheel location";
5923 static PyMethodDef __pyx_mdef_5fiona_4_env_14GDALDataFinder_5search_wheel = {"search_wheel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14GDALDataFinder_5search_wheel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14GDALDataFinder_4search_wheel};
__pyx_pw_5fiona_4_env_14GDALDataFinder_5search_wheel(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5924 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_5search_wheel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5925   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
5926   PyObject *__pyx_v_prefix = 0;
5927   int __pyx_lineno = 0;
5928   const char *__pyx_filename = NULL;
5929   int __pyx_clineno = 0;
5930   PyObject *__pyx_r = 0;
5931   __Pyx_RefNannyDeclarations
5932   __Pyx_RefNannySetupContext("search_wheel (wrapper)", 0);
5933   {
5934     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
5935     PyObject* values[2] = {0,0};
5936     values[1] = ((PyObject *)((PyObject *)Py_None));
5937     if (unlikely(__pyx_kwds)) {
5938       Py_ssize_t kw_args;
5939       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5940       switch (pos_args) {
5941         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5942         CYTHON_FALLTHROUGH;
5943         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5944         CYTHON_FALLTHROUGH;
5945         case  0: break;
5946         default: goto __pyx_L5_argtuple_error;
5947       }
5948       kw_args = PyDict_Size(__pyx_kwds);
5949       switch (pos_args) {
5950         case  0:
5951         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5952         else goto __pyx_L5_argtuple_error;
5953         CYTHON_FALLTHROUGH;
5954         case  1:
5955         if (kw_args > 0) {
5956           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
5957           if (value) { values[1] = value; kw_args--; }
5958         }
5959       }
5960       if (unlikely(kw_args > 0)) {
5961         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search_wheel") < 0)) __PYX_ERR(0, 314, __pyx_L3_error)
5962       }
5963     } else {
5964       switch (PyTuple_GET_SIZE(__pyx_args)) {
5965         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5966         CYTHON_FALLTHROUGH;
5967         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5968         break;
5969         default: goto __pyx_L5_argtuple_error;
5970       }
5971     }
5972     __pyx_v_self = values[0];
5973     __pyx_v_prefix = values[1];
5974   }
5975   goto __pyx_L4_argument_unpacking_done;
5976   __pyx_L5_argtuple_error:;
5977   __Pyx_RaiseArgtupleInvalid("search_wheel", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 314, __pyx_L3_error)
5978   __pyx_L3_error:;
5979   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_wheel", __pyx_clineno, __pyx_lineno, __pyx_filename);
5980   __Pyx_RefNannyFinishContext();
5981   return NULL;
5982   __pyx_L4_argument_unpacking_done:;
5983   __pyx_r = __pyx_pf_5fiona_4_env_14GDALDataFinder_4search_wheel(__pyx_self, __pyx_v_self, __pyx_v_prefix);
5984 
5985   /* function exit code */
5986   __Pyx_RefNannyFinishContext();
5987   return __pyx_r;
5988 }
5989 
__pyx_pf_5fiona_4_env_14GDALDataFinder_4search_wheel(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)5990 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_4search_wheel(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
5991   PyObject *__pyx_v_datadir = NULL;
5992   PyObject *__pyx_r = NULL;
5993   __Pyx_RefNannyDeclarations
5994   int __pyx_t_1;
5995   int __pyx_t_2;
5996   PyObject *__pyx_t_3 = NULL;
5997   PyObject *__pyx_t_4 = NULL;
5998   PyObject *__pyx_t_5 = NULL;
5999   PyObject *__pyx_t_6 = NULL;
6000   PyObject *__pyx_t_7 = NULL;
6001   PyObject *__pyx_t_8 = NULL;
6002   PyObject *__pyx_t_9 = NULL;
6003   int __pyx_t_10;
6004   int __pyx_lineno = 0;
6005   const char *__pyx_filename = NULL;
6006   int __pyx_clineno = 0;
6007   __Pyx_RefNannySetupContext("search_wheel", 0);
6008   __Pyx_INCREF(__pyx_v_prefix);
6009 
6010   /* "fiona/_env.pyx":316
6011  *     def search_wheel(self, prefix=None):
6012  *         """Check wheel location"""
6013  *         if prefix is None:             # <<<<<<<<<<<<<<
6014  *             prefix = __file__
6015  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "gdal_data"))
6016  */
6017   __pyx_t_1 = (__pyx_v_prefix == Py_None);
6018   __pyx_t_2 = (__pyx_t_1 != 0);
6019   if (__pyx_t_2) {
6020 
6021     /* "fiona/_env.pyx":317
6022  *         """Check wheel location"""
6023  *         if prefix is None:
6024  *             prefix = __file__             # <<<<<<<<<<<<<<
6025  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "gdal_data"))
6026  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6027  */
6028     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
6029     __Pyx_GOTREF(__pyx_t_3);
6030     __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_3);
6031     __pyx_t_3 = 0;
6032 
6033     /* "fiona/_env.pyx":316
6034  *     def search_wheel(self, prefix=None):
6035  *         """Check wheel location"""
6036  *         if prefix is None:             # <<<<<<<<<<<<<<
6037  *             prefix = __file__
6038  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "gdal_data"))
6039  */
6040   }
6041 
6042   /* "fiona/_env.pyx":318
6043  *         if prefix is None:
6044  *             prefix = __file__
6045  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "gdal_data"))             # <<<<<<<<<<<<<<
6046  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6047  *
6048  */
6049   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L1_error)
6050   __Pyx_GOTREF(__pyx_t_4);
6051   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
6052   __Pyx_GOTREF(__pyx_t_5);
6053   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6054   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abspath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L1_error)
6055   __Pyx_GOTREF(__pyx_t_4);
6056   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6057   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
6058   __Pyx_GOTREF(__pyx_t_6);
6059   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 318, __pyx_L1_error)
6060   __Pyx_GOTREF(__pyx_t_7);
6061   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6062   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
6063   __Pyx_GOTREF(__pyx_t_6);
6064   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6065   __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 318, __pyx_L1_error)
6066   __Pyx_GOTREF(__pyx_t_8);
6067   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 318, __pyx_L1_error)
6068   __Pyx_GOTREF(__pyx_t_9);
6069   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6070   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dirname); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 318, __pyx_L1_error)
6071   __Pyx_GOTREF(__pyx_t_8);
6072   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6073   __pyx_t_9 = NULL;
6074   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
6075     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
6076     if (likely(__pyx_t_9)) {
6077       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
6078       __Pyx_INCREF(__pyx_t_9);
6079       __Pyx_INCREF(function);
6080       __Pyx_DECREF_SET(__pyx_t_8, function);
6081     }
6082   }
6083   __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_prefix);
6084   __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6085   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 318, __pyx_L1_error)
6086   __Pyx_GOTREF(__pyx_t_7);
6087   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6088   __pyx_t_8 = NULL;
6089   __pyx_t_10 = 0;
6090   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
6091     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
6092     if (likely(__pyx_t_8)) {
6093       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6094       __Pyx_INCREF(__pyx_t_8);
6095       __Pyx_INCREF(function);
6096       __Pyx_DECREF_SET(__pyx_t_6, function);
6097       __pyx_t_10 = 1;
6098     }
6099   }
6100   #if CYTHON_FAST_PYCALL
6101   if (PyFunction_Check(__pyx_t_6)) {
6102     PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_n_u_gdal_data};
6103     __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
6104     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6105     __Pyx_GOTREF(__pyx_t_5);
6106     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6107   } else
6108   #endif
6109   #if CYTHON_FAST_PYCCALL
6110   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
6111     PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_n_u_gdal_data};
6112     __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
6113     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6114     __Pyx_GOTREF(__pyx_t_5);
6115     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6116   } else
6117   #endif
6118   {
6119     __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 318, __pyx_L1_error)
6120     __Pyx_GOTREF(__pyx_t_9);
6121     if (__pyx_t_8) {
6122       __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
6123     }
6124     __Pyx_GIVEREF(__pyx_t_7);
6125     PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_7);
6126     __Pyx_INCREF(__pyx_n_u_gdal_data);
6127     __Pyx_GIVEREF(__pyx_n_u_gdal_data);
6128     PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_n_u_gdal_data);
6129     __pyx_t_7 = 0;
6130     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
6131     __Pyx_GOTREF(__pyx_t_5);
6132     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6133   }
6134   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6135   __pyx_t_6 = NULL;
6136   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
6137     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
6138     if (likely(__pyx_t_6)) {
6139       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6140       __Pyx_INCREF(__pyx_t_6);
6141       __Pyx_INCREF(function);
6142       __Pyx_DECREF_SET(__pyx_t_4, function);
6143     }
6144   }
6145   __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
6146   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6147   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6148   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
6149   __Pyx_GOTREF(__pyx_t_3);
6150   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6151   __pyx_v_datadir = __pyx_t_3;
6152   __pyx_t_3 = 0;
6153 
6154   /* "fiona/_env.pyx":319
6155  *             prefix = __file__
6156  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "gdal_data"))
6157  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None             # <<<<<<<<<<<<<<
6158  *
6159  *     def search_prefix(self, prefix=sys.prefix):
6160  */
6161   __Pyx_XDECREF(__pyx_r);
6162   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
6163   __Pyx_GOTREF(__pyx_t_5);
6164   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
6165   __Pyx_GOTREF(__pyx_t_6);
6166   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6167   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_exists); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
6168   __Pyx_GOTREF(__pyx_t_5);
6169   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6170   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
6171   __Pyx_GOTREF(__pyx_t_9);
6172   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
6173   __Pyx_GOTREF(__pyx_t_7);
6174   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6175   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
6176   __Pyx_GOTREF(__pyx_t_9);
6177   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6178   __pyx_t_7 = NULL;
6179   __pyx_t_10 = 0;
6180   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
6181     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
6182     if (likely(__pyx_t_7)) {
6183       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6184       __Pyx_INCREF(__pyx_t_7);
6185       __Pyx_INCREF(function);
6186       __Pyx_DECREF_SET(__pyx_t_9, function);
6187       __pyx_t_10 = 1;
6188     }
6189   }
6190   #if CYTHON_FAST_PYCALL
6191   if (PyFunction_Check(__pyx_t_9)) {
6192     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6193     __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
6194     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6195     __Pyx_GOTREF(__pyx_t_6);
6196   } else
6197   #endif
6198   #if CYTHON_FAST_PYCCALL
6199   if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
6200     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6201     __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
6202     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6203     __Pyx_GOTREF(__pyx_t_6);
6204   } else
6205   #endif
6206   {
6207     __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error)
6208     __Pyx_GOTREF(__pyx_t_8);
6209     if (__pyx_t_7) {
6210       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
6211     }
6212     __Pyx_INCREF(__pyx_v_datadir);
6213     __Pyx_GIVEREF(__pyx_v_datadir);
6214     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_datadir);
6215     __Pyx_INCREF(__pyx_kp_u_header_dxf);
6216     __Pyx_GIVEREF(__pyx_kp_u_header_dxf);
6217     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_kp_u_header_dxf);
6218     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
6219     __Pyx_GOTREF(__pyx_t_6);
6220     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6221   }
6222   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6223   __pyx_t_9 = NULL;
6224   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6225     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
6226     if (likely(__pyx_t_9)) {
6227       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6228       __Pyx_INCREF(__pyx_t_9);
6229       __Pyx_INCREF(function);
6230       __Pyx_DECREF_SET(__pyx_t_5, function);
6231     }
6232   }
6233   __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
6234   __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6235   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6236   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
6237   __Pyx_GOTREF(__pyx_t_4);
6238   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6239   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 319, __pyx_L1_error)
6240   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6241   if (__pyx_t_2) {
6242     __Pyx_INCREF(__pyx_v_datadir);
6243     __pyx_t_3 = __pyx_v_datadir;
6244   } else {
6245     __Pyx_INCREF(Py_None);
6246     __pyx_t_3 = Py_None;
6247   }
6248   __pyx_r = __pyx_t_3;
6249   __pyx_t_3 = 0;
6250   goto __pyx_L0;
6251 
6252   /* "fiona/_env.pyx":314
6253  *         return path
6254  *
6255  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
6256  *         """Check wheel location"""
6257  *         if prefix is None:
6258  */
6259 
6260   /* function exit code */
6261   __pyx_L1_error:;
6262   __Pyx_XDECREF(__pyx_t_3);
6263   __Pyx_XDECREF(__pyx_t_4);
6264   __Pyx_XDECREF(__pyx_t_5);
6265   __Pyx_XDECREF(__pyx_t_6);
6266   __Pyx_XDECREF(__pyx_t_7);
6267   __Pyx_XDECREF(__pyx_t_8);
6268   __Pyx_XDECREF(__pyx_t_9);
6269   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_wheel", __pyx_clineno, __pyx_lineno, __pyx_filename);
6270   __pyx_r = NULL;
6271   __pyx_L0:;
6272   __Pyx_XDECREF(__pyx_v_datadir);
6273   __Pyx_XDECREF(__pyx_v_prefix);
6274   __Pyx_XGIVEREF(__pyx_r);
6275   __Pyx_RefNannyFinishContext();
6276   return __pyx_r;
6277 }
6278 
6279 /* "fiona/_env.pyx":321
6280  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6281  *
6282  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
6283  *         """Check sys.prefix location"""
6284  *         datadir = os.path.join(prefix, 'share', 'gdal')
6285  */
6286 
__pyx_pf_5fiona_4_env_24__defaults__(CYTHON_UNUSED PyObject * __pyx_self)6287 static PyObject *__pyx_pf_5fiona_4_env_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
6288   PyObject *__pyx_r = NULL;
6289   __Pyx_RefNannyDeclarations
6290   PyObject *__pyx_t_1 = NULL;
6291   PyObject *__pyx_t_2 = NULL;
6292   int __pyx_lineno = 0;
6293   const char *__pyx_filename = NULL;
6294   int __pyx_clineno = 0;
6295   __Pyx_RefNannySetupContext("__defaults__", 0);
6296   __Pyx_XDECREF(__pyx_r);
6297   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
6298   __Pyx_GOTREF(__pyx_t_1);
6299   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_prefix);
6300   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_prefix);
6301   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_prefix);
6302   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
6303   __Pyx_GOTREF(__pyx_t_2);
6304   __Pyx_GIVEREF(__pyx_t_1);
6305   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6306   __Pyx_INCREF(Py_None);
6307   __Pyx_GIVEREF(Py_None);
6308   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
6309   __pyx_t_1 = 0;
6310   __pyx_r = __pyx_t_2;
6311   __pyx_t_2 = 0;
6312   goto __pyx_L0;
6313 
6314   /* function exit code */
6315   __pyx_L1_error:;
6316   __Pyx_XDECREF(__pyx_t_1);
6317   __Pyx_XDECREF(__pyx_t_2);
6318   __Pyx_AddTraceback("fiona._env.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6319   __pyx_r = NULL;
6320   __pyx_L0:;
6321   __Pyx_XGIVEREF(__pyx_r);
6322   __Pyx_RefNannyFinishContext();
6323   return __pyx_r;
6324 }
6325 
6326 /* Python wrapper */
6327 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_7search_prefix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6328 static char __pyx_doc_5fiona_4_env_14GDALDataFinder_6search_prefix[] = "Check sys.prefix location";
6329 static PyMethodDef __pyx_mdef_5fiona_4_env_14GDALDataFinder_7search_prefix = {"search_prefix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14GDALDataFinder_7search_prefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14GDALDataFinder_6search_prefix};
__pyx_pw_5fiona_4_env_14GDALDataFinder_7search_prefix(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6330 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_7search_prefix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6331   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
6332   PyObject *__pyx_v_prefix = 0;
6333   int __pyx_lineno = 0;
6334   const char *__pyx_filename = NULL;
6335   int __pyx_clineno = 0;
6336   PyObject *__pyx_r = 0;
6337   __Pyx_RefNannyDeclarations
6338   __Pyx_RefNannySetupContext("search_prefix (wrapper)", 0);
6339   {
6340     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
6341     PyObject* values[2] = {0,0};
6342     __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
6343     values[1] = __pyx_dynamic_args->__pyx_arg_prefix;
6344     if (unlikely(__pyx_kwds)) {
6345       Py_ssize_t kw_args;
6346       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6347       switch (pos_args) {
6348         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6349         CYTHON_FALLTHROUGH;
6350         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6351         CYTHON_FALLTHROUGH;
6352         case  0: break;
6353         default: goto __pyx_L5_argtuple_error;
6354       }
6355       kw_args = PyDict_Size(__pyx_kwds);
6356       switch (pos_args) {
6357         case  0:
6358         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
6359         else goto __pyx_L5_argtuple_error;
6360         CYTHON_FALLTHROUGH;
6361         case  1:
6362         if (kw_args > 0) {
6363           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
6364           if (value) { values[1] = value; kw_args--; }
6365         }
6366       }
6367       if (unlikely(kw_args > 0)) {
6368         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search_prefix") < 0)) __PYX_ERR(0, 321, __pyx_L3_error)
6369       }
6370     } else {
6371       switch (PyTuple_GET_SIZE(__pyx_args)) {
6372         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6373         CYTHON_FALLTHROUGH;
6374         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6375         break;
6376         default: goto __pyx_L5_argtuple_error;
6377       }
6378     }
6379     __pyx_v_self = values[0];
6380     __pyx_v_prefix = values[1];
6381   }
6382   goto __pyx_L4_argument_unpacking_done;
6383   __pyx_L5_argtuple_error:;
6384   __Pyx_RaiseArgtupleInvalid("search_prefix", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 321, __pyx_L3_error)
6385   __pyx_L3_error:;
6386   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
6387   __Pyx_RefNannyFinishContext();
6388   return NULL;
6389   __pyx_L4_argument_unpacking_done:;
6390   __pyx_r = __pyx_pf_5fiona_4_env_14GDALDataFinder_6search_prefix(__pyx_self, __pyx_v_self, __pyx_v_prefix);
6391 
6392   /* function exit code */
6393   __Pyx_RefNannyFinishContext();
6394   return __pyx_r;
6395 }
6396 
__pyx_pf_5fiona_4_env_14GDALDataFinder_6search_prefix(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)6397 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_6search_prefix(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
6398   PyObject *__pyx_v_datadir = NULL;
6399   PyObject *__pyx_r = NULL;
6400   __Pyx_RefNannyDeclarations
6401   PyObject *__pyx_t_1 = NULL;
6402   PyObject *__pyx_t_2 = NULL;
6403   PyObject *__pyx_t_3 = NULL;
6404   int __pyx_t_4;
6405   PyObject *__pyx_t_5 = NULL;
6406   PyObject *__pyx_t_6 = NULL;
6407   PyObject *__pyx_t_7 = NULL;
6408   PyObject *__pyx_t_8 = NULL;
6409   int __pyx_t_9;
6410   int __pyx_lineno = 0;
6411   const char *__pyx_filename = NULL;
6412   int __pyx_clineno = 0;
6413   __Pyx_RefNannySetupContext("search_prefix", 0);
6414 
6415   /* "fiona/_env.pyx":323
6416  *     def search_prefix(self, prefix=sys.prefix):
6417  *         """Check sys.prefix location"""
6418  *         datadir = os.path.join(prefix, 'share', 'gdal')             # <<<<<<<<<<<<<<
6419  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6420  *
6421  */
6422   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
6423   __Pyx_GOTREF(__pyx_t_2);
6424   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
6425   __Pyx_GOTREF(__pyx_t_3);
6426   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6427   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
6428   __Pyx_GOTREF(__pyx_t_2);
6429   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6430   __pyx_t_3 = NULL;
6431   __pyx_t_4 = 0;
6432   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6433     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6434     if (likely(__pyx_t_3)) {
6435       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6436       __Pyx_INCREF(__pyx_t_3);
6437       __Pyx_INCREF(function);
6438       __Pyx_DECREF_SET(__pyx_t_2, function);
6439       __pyx_t_4 = 1;
6440     }
6441   }
6442   #if CYTHON_FAST_PYCALL
6443   if (PyFunction_Check(__pyx_t_2)) {
6444     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_gdal};
6445     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
6446     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6447     __Pyx_GOTREF(__pyx_t_1);
6448   } else
6449   #endif
6450   #if CYTHON_FAST_PYCCALL
6451   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
6452     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_gdal};
6453     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
6454     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6455     __Pyx_GOTREF(__pyx_t_1);
6456   } else
6457   #endif
6458   {
6459     __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
6460     __Pyx_GOTREF(__pyx_t_5);
6461     if (__pyx_t_3) {
6462       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
6463     }
6464     __Pyx_INCREF(__pyx_v_prefix);
6465     __Pyx_GIVEREF(__pyx_v_prefix);
6466     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_prefix);
6467     __Pyx_INCREF(__pyx_n_u_share);
6468     __Pyx_GIVEREF(__pyx_n_u_share);
6469     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_share);
6470     __Pyx_INCREF(__pyx_n_u_gdal);
6471     __Pyx_GIVEREF(__pyx_n_u_gdal);
6472     PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_n_u_gdal);
6473     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
6474     __Pyx_GOTREF(__pyx_t_1);
6475     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6476   }
6477   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6478   __pyx_v_datadir = __pyx_t_1;
6479   __pyx_t_1 = 0;
6480 
6481   /* "fiona/_env.pyx":324
6482  *         """Check sys.prefix location"""
6483  *         datadir = os.path.join(prefix, 'share', 'gdal')
6484  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None             # <<<<<<<<<<<<<<
6485  *
6486  *     def search_debian(self, prefix=sys.prefix):
6487  */
6488   __Pyx_XDECREF(__pyx_r);
6489   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L1_error)
6490   __Pyx_GOTREF(__pyx_t_5);
6491   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
6492   __Pyx_GOTREF(__pyx_t_3);
6493   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6494   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L1_error)
6495   __Pyx_GOTREF(__pyx_t_5);
6496   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6497   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 324, __pyx_L1_error)
6498   __Pyx_GOTREF(__pyx_t_6);
6499   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error)
6500   __Pyx_GOTREF(__pyx_t_7);
6501   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6502   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 324, __pyx_L1_error)
6503   __Pyx_GOTREF(__pyx_t_6);
6504   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6505   __pyx_t_7 = NULL;
6506   __pyx_t_4 = 0;
6507   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
6508     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
6509     if (likely(__pyx_t_7)) {
6510       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6511       __Pyx_INCREF(__pyx_t_7);
6512       __Pyx_INCREF(function);
6513       __Pyx_DECREF_SET(__pyx_t_6, function);
6514       __pyx_t_4 = 1;
6515     }
6516   }
6517   #if CYTHON_FAST_PYCALL
6518   if (PyFunction_Check(__pyx_t_6)) {
6519     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6520     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
6521     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6522     __Pyx_GOTREF(__pyx_t_3);
6523   } else
6524   #endif
6525   #if CYTHON_FAST_PYCCALL
6526   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
6527     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6528     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
6529     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6530     __Pyx_GOTREF(__pyx_t_3);
6531   } else
6532   #endif
6533   {
6534     __pyx_t_8 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error)
6535     __Pyx_GOTREF(__pyx_t_8);
6536     if (__pyx_t_7) {
6537       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
6538     }
6539     __Pyx_INCREF(__pyx_v_datadir);
6540     __Pyx_GIVEREF(__pyx_v_datadir);
6541     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_datadir);
6542     __Pyx_INCREF(__pyx_kp_u_header_dxf);
6543     __Pyx_GIVEREF(__pyx_kp_u_header_dxf);
6544     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_kp_u_header_dxf);
6545     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
6546     __Pyx_GOTREF(__pyx_t_3);
6547     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6548   }
6549   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6550   __pyx_t_6 = NULL;
6551   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6552     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6553     if (likely(__pyx_t_6)) {
6554       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6555       __Pyx_INCREF(__pyx_t_6);
6556       __Pyx_INCREF(function);
6557       __Pyx_DECREF_SET(__pyx_t_5, function);
6558     }
6559   }
6560   __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
6561   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6562   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6563   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
6564   __Pyx_GOTREF(__pyx_t_2);
6565   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6566   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 324, __pyx_L1_error)
6567   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6568   if (__pyx_t_9) {
6569     __Pyx_INCREF(__pyx_v_datadir);
6570     __pyx_t_1 = __pyx_v_datadir;
6571   } else {
6572     __Pyx_INCREF(Py_None);
6573     __pyx_t_1 = Py_None;
6574   }
6575   __pyx_r = __pyx_t_1;
6576   __pyx_t_1 = 0;
6577   goto __pyx_L0;
6578 
6579   /* "fiona/_env.pyx":321
6580  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6581  *
6582  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
6583  *         """Check sys.prefix location"""
6584  *         datadir = os.path.join(prefix, 'share', 'gdal')
6585  */
6586 
6587   /* function exit code */
6588   __pyx_L1_error:;
6589   __Pyx_XDECREF(__pyx_t_1);
6590   __Pyx_XDECREF(__pyx_t_2);
6591   __Pyx_XDECREF(__pyx_t_3);
6592   __Pyx_XDECREF(__pyx_t_5);
6593   __Pyx_XDECREF(__pyx_t_6);
6594   __Pyx_XDECREF(__pyx_t_7);
6595   __Pyx_XDECREF(__pyx_t_8);
6596   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
6597   __pyx_r = NULL;
6598   __pyx_L0:;
6599   __Pyx_XDECREF(__pyx_v_datadir);
6600   __Pyx_XGIVEREF(__pyx_r);
6601   __Pyx_RefNannyFinishContext();
6602   return __pyx_r;
6603 }
6604 
6605 /* "fiona/_env.pyx":326
6606  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6607  *
6608  *     def search_debian(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
6609  *         """Check Debian locations"""
6610  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
6611  */
6612 
__pyx_pf_5fiona_4_env_26__defaults__(CYTHON_UNUSED PyObject * __pyx_self)6613 static PyObject *__pyx_pf_5fiona_4_env_26__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
6614   PyObject *__pyx_r = NULL;
6615   __Pyx_RefNannyDeclarations
6616   PyObject *__pyx_t_1 = NULL;
6617   PyObject *__pyx_t_2 = NULL;
6618   int __pyx_lineno = 0;
6619   const char *__pyx_filename = NULL;
6620   int __pyx_clineno = 0;
6621   __Pyx_RefNannySetupContext("__defaults__", 0);
6622   __Pyx_XDECREF(__pyx_r);
6623   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
6624   __Pyx_GOTREF(__pyx_t_1);
6625   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_prefix);
6626   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_prefix);
6627   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_prefix);
6628   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error)
6629   __Pyx_GOTREF(__pyx_t_2);
6630   __Pyx_GIVEREF(__pyx_t_1);
6631   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6632   __Pyx_INCREF(Py_None);
6633   __Pyx_GIVEREF(Py_None);
6634   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
6635   __pyx_t_1 = 0;
6636   __pyx_r = __pyx_t_2;
6637   __pyx_t_2 = 0;
6638   goto __pyx_L0;
6639 
6640   /* function exit code */
6641   __pyx_L1_error:;
6642   __Pyx_XDECREF(__pyx_t_1);
6643   __Pyx_XDECREF(__pyx_t_2);
6644   __Pyx_AddTraceback("fiona._env.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6645   __pyx_r = NULL;
6646   __pyx_L0:;
6647   __Pyx_XGIVEREF(__pyx_r);
6648   __Pyx_RefNannyFinishContext();
6649   return __pyx_r;
6650 }
6651 
6652 /* Python wrapper */
6653 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_9search_debian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6654 static char __pyx_doc_5fiona_4_env_14GDALDataFinder_8search_debian[] = "Check Debian locations";
6655 static PyMethodDef __pyx_mdef_5fiona_4_env_14GDALDataFinder_9search_debian = {"search_debian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14GDALDataFinder_9search_debian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14GDALDataFinder_8search_debian};
__pyx_pw_5fiona_4_env_14GDALDataFinder_9search_debian(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6656 static PyObject *__pyx_pw_5fiona_4_env_14GDALDataFinder_9search_debian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6657   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
6658   PyObject *__pyx_v_prefix = 0;
6659   int __pyx_lineno = 0;
6660   const char *__pyx_filename = NULL;
6661   int __pyx_clineno = 0;
6662   PyObject *__pyx_r = 0;
6663   __Pyx_RefNannyDeclarations
6664   __Pyx_RefNannySetupContext("search_debian (wrapper)", 0);
6665   {
6666     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
6667     PyObject* values[2] = {0,0};
6668     __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
6669     values[1] = __pyx_dynamic_args->__pyx_arg_prefix;
6670     if (unlikely(__pyx_kwds)) {
6671       Py_ssize_t kw_args;
6672       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6673       switch (pos_args) {
6674         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6675         CYTHON_FALLTHROUGH;
6676         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6677         CYTHON_FALLTHROUGH;
6678         case  0: break;
6679         default: goto __pyx_L5_argtuple_error;
6680       }
6681       kw_args = PyDict_Size(__pyx_kwds);
6682       switch (pos_args) {
6683         case  0:
6684         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
6685         else goto __pyx_L5_argtuple_error;
6686         CYTHON_FALLTHROUGH;
6687         case  1:
6688         if (kw_args > 0) {
6689           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
6690           if (value) { values[1] = value; kw_args--; }
6691         }
6692       }
6693       if (unlikely(kw_args > 0)) {
6694         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search_debian") < 0)) __PYX_ERR(0, 326, __pyx_L3_error)
6695       }
6696     } else {
6697       switch (PyTuple_GET_SIZE(__pyx_args)) {
6698         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6699         CYTHON_FALLTHROUGH;
6700         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6701         break;
6702         default: goto __pyx_L5_argtuple_error;
6703       }
6704     }
6705     __pyx_v_self = values[0];
6706     __pyx_v_prefix = values[1];
6707   }
6708   goto __pyx_L4_argument_unpacking_done;
6709   __pyx_L5_argtuple_error:;
6710   __Pyx_RaiseArgtupleInvalid("search_debian", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 326, __pyx_L3_error)
6711   __pyx_L3_error:;
6712   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_debian", __pyx_clineno, __pyx_lineno, __pyx_filename);
6713   __Pyx_RefNannyFinishContext();
6714   return NULL;
6715   __pyx_L4_argument_unpacking_done:;
6716   __pyx_r = __pyx_pf_5fiona_4_env_14GDALDataFinder_8search_debian(__pyx_self, __pyx_v_self, __pyx_v_prefix);
6717 
6718   /* function exit code */
6719   __Pyx_RefNannyFinishContext();
6720   return __pyx_r;
6721 }
6722 
__pyx_pf_5fiona_4_env_14GDALDataFinder_8search_debian(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)6723 static PyObject *__pyx_pf_5fiona_4_env_14GDALDataFinder_8search_debian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
6724   char const *__pyx_v_gdal_release_name;
6725   PyObject *__pyx_v_datadir = NULL;
6726   PyObject *__pyx_r = NULL;
6727   __Pyx_RefNannyDeclarations
6728   PyObject *__pyx_t_1 = NULL;
6729   PyObject *__pyx_t_2 = NULL;
6730   PyObject *__pyx_t_3 = NULL;
6731   PyObject *__pyx_t_4 = NULL;
6732   PyObject *__pyx_t_5 = NULL;
6733   int __pyx_t_6;
6734   PyObject *__pyx_t_7 = NULL;
6735   PyObject *__pyx_t_8 = NULL;
6736   int __pyx_t_9;
6737   int __pyx_lineno = 0;
6738   const char *__pyx_filename = NULL;
6739   int __pyx_clineno = 0;
6740   __Pyx_RefNannySetupContext("search_debian", 0);
6741 
6742   /* "fiona/_env.pyx":328
6743  *     def search_debian(self, prefix=sys.prefix):
6744  *         """Check Debian locations"""
6745  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")             # <<<<<<<<<<<<<<
6746  *         datadir = os.path.join(prefix, 'share', 'gdal', '{}.{}'.format(*gdal_release_name.split('.')[:2]))
6747  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6748  */
6749   __pyx_v_gdal_release_name = GDALVersionInfo(((char const *)"RELEASE_NAME"));
6750 
6751   /* "fiona/_env.pyx":329
6752  *         """Check Debian locations"""
6753  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
6754  *         datadir = os.path.join(prefix, 'share', 'gdal', '{}.{}'.format(*gdal_release_name.split('.')[:2]))             # <<<<<<<<<<<<<<
6755  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6756  *
6757  */
6758   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
6759   __Pyx_GOTREF(__pyx_t_2);
6760   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
6761   __Pyx_GOTREF(__pyx_t_3);
6762   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6763   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
6764   __Pyx_GOTREF(__pyx_t_2);
6765   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6766   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u__3, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
6767   __Pyx_GOTREF(__pyx_t_3);
6768   __pyx_t_4 = __Pyx_PyUnicode_FromString(__pyx_v_gdal_release_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
6769   __Pyx_GOTREF(__pyx_t_4);
6770   __pyx_t_5 = PyUnicode_Split(((PyObject*)__pyx_t_4), __pyx_kp_u__4, -1L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 329, __pyx_L1_error)
6771   __Pyx_GOTREF(__pyx_t_5);
6772   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6773   __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 2, NULL, NULL, &__pyx_slice__5, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
6774   __Pyx_GOTREF(__pyx_t_4);
6775   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6776   __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 329, __pyx_L1_error)
6777   __Pyx_GOTREF(__pyx_t_5);
6778   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6779   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
6780   __Pyx_GOTREF(__pyx_t_4);
6781   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6782   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6783   __pyx_t_5 = NULL;
6784   __pyx_t_6 = 0;
6785   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6786     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
6787     if (likely(__pyx_t_5)) {
6788       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6789       __Pyx_INCREF(__pyx_t_5);
6790       __Pyx_INCREF(function);
6791       __Pyx_DECREF_SET(__pyx_t_2, function);
6792       __pyx_t_6 = 1;
6793     }
6794   }
6795   #if CYTHON_FAST_PYCALL
6796   if (PyFunction_Check(__pyx_t_2)) {
6797     PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_gdal, __pyx_t_4};
6798     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
6799     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6800     __Pyx_GOTREF(__pyx_t_1);
6801     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6802   } else
6803   #endif
6804   #if CYTHON_FAST_PYCCALL
6805   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
6806     PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_gdal, __pyx_t_4};
6807     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
6808     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6809     __Pyx_GOTREF(__pyx_t_1);
6810     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6811   } else
6812   #endif
6813   {
6814     __pyx_t_3 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
6815     __Pyx_GOTREF(__pyx_t_3);
6816     if (__pyx_t_5) {
6817       __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
6818     }
6819     __Pyx_INCREF(__pyx_v_prefix);
6820     __Pyx_GIVEREF(__pyx_v_prefix);
6821     PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_prefix);
6822     __Pyx_INCREF(__pyx_n_u_share);
6823     __Pyx_GIVEREF(__pyx_n_u_share);
6824     PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_n_u_share);
6825     __Pyx_INCREF(__pyx_n_u_gdal);
6826     __Pyx_GIVEREF(__pyx_n_u_gdal);
6827     PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_n_u_gdal);
6828     __Pyx_GIVEREF(__pyx_t_4);
6829     PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_6, __pyx_t_4);
6830     __pyx_t_4 = 0;
6831     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
6832     __Pyx_GOTREF(__pyx_t_1);
6833     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6834   }
6835   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6836   __pyx_v_datadir = __pyx_t_1;
6837   __pyx_t_1 = 0;
6838 
6839   /* "fiona/_env.pyx":330
6840  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
6841  *         datadir = os.path.join(prefix, 'share', 'gdal', '{}.{}'.format(*gdal_release_name.split('.')[:2]))
6842  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None             # <<<<<<<<<<<<<<
6843  *
6844  *
6845  */
6846   __Pyx_XDECREF(__pyx_r);
6847   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
6848   __Pyx_GOTREF(__pyx_t_3);
6849   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
6850   __Pyx_GOTREF(__pyx_t_4);
6851   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6852   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
6853   __Pyx_GOTREF(__pyx_t_3);
6854   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6855   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
6856   __Pyx_GOTREF(__pyx_t_5);
6857   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error)
6858   __Pyx_GOTREF(__pyx_t_7);
6859   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6860   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
6861   __Pyx_GOTREF(__pyx_t_5);
6862   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6863   __pyx_t_7 = NULL;
6864   __pyx_t_6 = 0;
6865   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6866     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
6867     if (likely(__pyx_t_7)) {
6868       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6869       __Pyx_INCREF(__pyx_t_7);
6870       __Pyx_INCREF(function);
6871       __Pyx_DECREF_SET(__pyx_t_5, function);
6872       __pyx_t_6 = 1;
6873     }
6874   }
6875   #if CYTHON_FAST_PYCALL
6876   if (PyFunction_Check(__pyx_t_5)) {
6877     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6878     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
6879     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6880     __Pyx_GOTREF(__pyx_t_4);
6881   } else
6882   #endif
6883   #if CYTHON_FAST_PYCCALL
6884   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6885     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datadir, __pyx_kp_u_header_dxf};
6886     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
6887     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6888     __Pyx_GOTREF(__pyx_t_4);
6889   } else
6890   #endif
6891   {
6892     __pyx_t_8 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
6893     __Pyx_GOTREF(__pyx_t_8);
6894     if (__pyx_t_7) {
6895       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
6896     }
6897     __Pyx_INCREF(__pyx_v_datadir);
6898     __Pyx_GIVEREF(__pyx_v_datadir);
6899     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_v_datadir);
6900     __Pyx_INCREF(__pyx_kp_u_header_dxf);
6901     __Pyx_GIVEREF(__pyx_kp_u_header_dxf);
6902     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_kp_u_header_dxf);
6903     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
6904     __Pyx_GOTREF(__pyx_t_4);
6905     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6906   }
6907   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6908   __pyx_t_5 = NULL;
6909   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
6910     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
6911     if (likely(__pyx_t_5)) {
6912       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6913       __Pyx_INCREF(__pyx_t_5);
6914       __Pyx_INCREF(function);
6915       __Pyx_DECREF_SET(__pyx_t_3, function);
6916     }
6917   }
6918   __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
6919   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6920   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6921   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
6922   __Pyx_GOTREF(__pyx_t_2);
6923   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6924   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 330, __pyx_L1_error)
6925   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6926   if (__pyx_t_9) {
6927     __Pyx_INCREF(__pyx_v_datadir);
6928     __pyx_t_1 = __pyx_v_datadir;
6929   } else {
6930     __Pyx_INCREF(Py_None);
6931     __pyx_t_1 = Py_None;
6932   }
6933   __pyx_r = __pyx_t_1;
6934   __pyx_t_1 = 0;
6935   goto __pyx_L0;
6936 
6937   /* "fiona/_env.pyx":326
6938  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
6939  *
6940  *     def search_debian(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
6941  *         """Check Debian locations"""
6942  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
6943  */
6944 
6945   /* function exit code */
6946   __pyx_L1_error:;
6947   __Pyx_XDECREF(__pyx_t_1);
6948   __Pyx_XDECREF(__pyx_t_2);
6949   __Pyx_XDECREF(__pyx_t_3);
6950   __Pyx_XDECREF(__pyx_t_4);
6951   __Pyx_XDECREF(__pyx_t_5);
6952   __Pyx_XDECREF(__pyx_t_7);
6953   __Pyx_XDECREF(__pyx_t_8);
6954   __Pyx_AddTraceback("fiona._env.GDALDataFinder.search_debian", __pyx_clineno, __pyx_lineno, __pyx_filename);
6955   __pyx_r = NULL;
6956   __pyx_L0:;
6957   __Pyx_XDECREF(__pyx_v_datadir);
6958   __Pyx_XGIVEREF(__pyx_r);
6959   __Pyx_RefNannyFinishContext();
6960   return __pyx_r;
6961 }
6962 
6963 /* "fiona/_env.pyx":339
6964  *
6965  *     """
6966  *     def has_data(self):             # <<<<<<<<<<<<<<
6967  *         """Returns True if PROJ's data files can be found
6968  *
6969  */
6970 
6971 /* Python wrapper */
6972 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_1has_data(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
6973 static char __pyx_doc_5fiona_4_env_14PROJDataFinder_has_data[] = "Returns True if PROJ's data files can be found\n\n        Returns\n        -------\n        bool\n\n        ";
6974 static PyMethodDef __pyx_mdef_5fiona_4_env_14PROJDataFinder_1has_data = {"has_data", (PyCFunction)__pyx_pw_5fiona_4_env_14PROJDataFinder_1has_data, METH_O, __pyx_doc_5fiona_4_env_14PROJDataFinder_has_data};
__pyx_pw_5fiona_4_env_14PROJDataFinder_1has_data(PyObject * __pyx_self,PyObject * __pyx_v_self)6975 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_1has_data(PyObject *__pyx_self, PyObject *__pyx_v_self) {
6976   PyObject *__pyx_r = 0;
6977   __Pyx_RefNannyDeclarations
6978   __Pyx_RefNannySetupContext("has_data (wrapper)", 0);
6979   __pyx_r = __pyx_pf_5fiona_4_env_14PROJDataFinder_has_data(__pyx_self, ((PyObject *)__pyx_v_self));
6980 
6981   /* function exit code */
6982   __Pyx_RefNannyFinishContext();
6983   return __pyx_r;
6984 }
6985 
__pyx_pf_5fiona_4_env_14PROJDataFinder_has_data(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self)6986 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_has_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
6987   OGRSpatialReferenceH __pyx_v_osr;
6988   PyObject *__pyx_r = NULL;
6989   __Pyx_RefNannyDeclarations
6990   PyObject *__pyx_t_1 = NULL;
6991   PyObject *__pyx_t_2 = NULL;
6992   PyObject *__pyx_t_3 = NULL;
6993   int __pyx_t_4;
6994   OGRErr __pyx_t_5;
6995   PyObject *__pyx_t_6 = NULL;
6996   PyObject *__pyx_t_7 = NULL;
6997   PyObject *__pyx_t_8 = NULL;
6998   PyObject *__pyx_t_9 = NULL;
6999   int __pyx_t_10;
7000   char const *__pyx_t_11;
7001   PyObject *__pyx_t_12 = NULL;
7002   PyObject *__pyx_t_13 = NULL;
7003   PyObject *__pyx_t_14 = NULL;
7004   int __pyx_lineno = 0;
7005   const char *__pyx_filename = NULL;
7006   int __pyx_clineno = 0;
7007   __Pyx_RefNannySetupContext("has_data", 0);
7008 
7009   /* "fiona/_env.pyx":347
7010  *
7011  *         """
7012  *         cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)             # <<<<<<<<<<<<<<
7013  *
7014  *         try:
7015  */
7016   __pyx_v_osr = OSRNewSpatialReference(NULL);
7017 
7018   /* "fiona/_env.pyx":349
7019  *         cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
7020  *
7021  *         try:             # <<<<<<<<<<<<<<
7022  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))
7023  *         except CPLE_BaseError:
7024  */
7025   /*try:*/ {
7026     {
7027       __Pyx_PyThreadState_declare
7028       __Pyx_PyThreadState_assign
7029       __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7030       __Pyx_XGOTREF(__pyx_t_1);
7031       __Pyx_XGOTREF(__pyx_t_2);
7032       __Pyx_XGOTREF(__pyx_t_3);
7033       /*try:*/ {
7034 
7035         /* "fiona/_env.pyx":350
7036  *
7037  *         try:
7038  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))             # <<<<<<<<<<<<<<
7039  *         except CPLE_BaseError:
7040  *             return False
7041  */
7042         __pyx_t_4 = __pyx_f_5fiona_4_err_exc_wrap_int(OSRImportFromEPSG(__pyx_v_osr, 0x10E6)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 350, __pyx_L6_error)
7043         __pyx_t_5 = __pyx_f_5fiona_4_err_exc_wrap_ogrerr(__pyx_t_4); if (unlikely(__pyx_t_5 == ((OGRErr)-1))) __PYX_ERR(0, 350, __pyx_L6_error)
7044 
7045         /* "fiona/_env.pyx":349
7046  *         cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
7047  *
7048  *         try:             # <<<<<<<<<<<<<<
7049  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))
7050  *         except CPLE_BaseError:
7051  */
7052       }
7053 
7054       /* "fiona/_env.pyx":354
7055  *             return False
7056  *         else:
7057  *             return True             # <<<<<<<<<<<<<<
7058  *         finally:
7059  *             _safe_osr_release(osr)
7060  */
7061       /*else:*/ {
7062         __Pyx_XDECREF(__pyx_r);
7063         __Pyx_INCREF(Py_True);
7064         __pyx_r = Py_True;
7065         goto __pyx_L9_except_return;
7066       }
7067       __pyx_L6_error:;
7068 
7069       /* "fiona/_env.pyx":351
7070  *         try:
7071  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))
7072  *         except CPLE_BaseError:             # <<<<<<<<<<<<<<
7073  *             return False
7074  *         else:
7075  */
7076       __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
7077       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L8_except_error)
7078       __Pyx_GOTREF(__pyx_t_9);
7079       __pyx_t_4 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_9);
7080       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7081       __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
7082       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0;
7083       if (__pyx_t_4) {
7084         __Pyx_AddTraceback("fiona._env.PROJDataFinder.has_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
7085         if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(0, 351, __pyx_L8_except_error)
7086         __Pyx_GOTREF(__pyx_t_8);
7087         __Pyx_GOTREF(__pyx_t_7);
7088         __Pyx_GOTREF(__pyx_t_6);
7089 
7090         /* "fiona/_env.pyx":352
7091  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))
7092  *         except CPLE_BaseError:
7093  *             return False             # <<<<<<<<<<<<<<
7094  *         else:
7095  *             return True
7096  */
7097         __Pyx_XDECREF(__pyx_r);
7098         __Pyx_INCREF(Py_False);
7099         __pyx_r = Py_False;
7100         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7101         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7102         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7103         goto __pyx_L9_except_return;
7104       }
7105       goto __pyx_L8_except_error;
7106       __pyx_L8_except_error:;
7107 
7108       /* "fiona/_env.pyx":349
7109  *         cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
7110  *
7111  *         try:             # <<<<<<<<<<<<<<
7112  *             exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(osr, 4326)))
7113  *         except CPLE_BaseError:
7114  */
7115       __Pyx_XGIVEREF(__pyx_t_1);
7116       __Pyx_XGIVEREF(__pyx_t_2);
7117       __Pyx_XGIVEREF(__pyx_t_3);
7118       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7119       goto __pyx_L4_error;
7120       __pyx_L9_except_return:;
7121       __Pyx_XGIVEREF(__pyx_t_1);
7122       __Pyx_XGIVEREF(__pyx_t_2);
7123       __Pyx_XGIVEREF(__pyx_t_3);
7124       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7125       goto __pyx_L3_return;
7126     }
7127   }
7128 
7129   /* "fiona/_env.pyx":356
7130  *             return True
7131  *         finally:
7132  *             _safe_osr_release(osr)             # <<<<<<<<<<<<<<
7133  *
7134  *
7135  */
7136   /*finally:*/ {
7137     __pyx_L4_error:;
7138     /*exception exit:*/{
7139       __Pyx_PyThreadState_declare
7140       __Pyx_PyThreadState_assign
7141       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
7142       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7143       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7144       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7145       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7146       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
7147       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
7148       __Pyx_XGOTREF(__pyx_t_3);
7149       __Pyx_XGOTREF(__pyx_t_2);
7150       __Pyx_XGOTREF(__pyx_t_1);
7151       __Pyx_XGOTREF(__pyx_t_12);
7152       __Pyx_XGOTREF(__pyx_t_13);
7153       __Pyx_XGOTREF(__pyx_t_14);
7154       __pyx_t_4 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
7155       {
7156         __pyx_t_6 = __pyx_f_5fiona_4_env__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L15_error)
7157         __Pyx_GOTREF(__pyx_t_6);
7158         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7159       }
7160       if (PY_MAJOR_VERSION >= 3) {
7161         __Pyx_XGIVEREF(__pyx_t_12);
7162         __Pyx_XGIVEREF(__pyx_t_13);
7163         __Pyx_XGIVEREF(__pyx_t_14);
7164         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
7165       }
7166       __Pyx_XGIVEREF(__pyx_t_3);
7167       __Pyx_XGIVEREF(__pyx_t_2);
7168       __Pyx_XGIVEREF(__pyx_t_1);
7169       __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
7170       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
7171       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
7172       goto __pyx_L1_error;
7173       __pyx_L15_error:;
7174       if (PY_MAJOR_VERSION >= 3) {
7175         __Pyx_XGIVEREF(__pyx_t_12);
7176         __Pyx_XGIVEREF(__pyx_t_13);
7177         __Pyx_XGIVEREF(__pyx_t_14);
7178         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
7179       }
7180       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7181       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7182       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7183       __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
7184       goto __pyx_L1_error;
7185     }
7186     __pyx_L3_return: {
7187       __pyx_t_14 = __pyx_r;
7188       __pyx_r = 0;
7189       __pyx_t_6 = __pyx_f_5fiona_4_env__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error)
7190       __Pyx_GOTREF(__pyx_t_6);
7191       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7192       __pyx_r = __pyx_t_14;
7193       __pyx_t_14 = 0;
7194       goto __pyx_L0;
7195     }
7196   }
7197 
7198   /* "fiona/_env.pyx":339
7199  *
7200  *     """
7201  *     def has_data(self):             # <<<<<<<<<<<<<<
7202  *         """Returns True if PROJ's data files can be found
7203  *
7204  */
7205 
7206   /* function exit code */
7207   __pyx_L1_error:;
7208   __Pyx_XDECREF(__pyx_t_6);
7209   __Pyx_XDECREF(__pyx_t_7);
7210   __Pyx_XDECREF(__pyx_t_8);
7211   __Pyx_XDECREF(__pyx_t_9);
7212   __Pyx_AddTraceback("fiona._env.PROJDataFinder.has_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
7213   __pyx_r = NULL;
7214   __pyx_L0:;
7215   __Pyx_XGIVEREF(__pyx_r);
7216   __Pyx_RefNannyFinishContext();
7217   return __pyx_r;
7218 }
7219 
7220 /* "fiona/_env.pyx":359
7221  *
7222  *
7223  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
7224  *         """Returns PROJ data directory
7225  *
7226  */
7227 
7228 /* Python wrapper */
7229 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_3search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7230 static char __pyx_doc_5fiona_4_env_14PROJDataFinder_2search[] = "Returns PROJ data directory\n\n        Note well that os.environ is not consulted.\n\n        Returns\n        -------\n        str or None\n\n        ";
7231 static PyMethodDef __pyx_mdef_5fiona_4_env_14PROJDataFinder_3search = {"search", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14PROJDataFinder_3search, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14PROJDataFinder_2search};
__pyx_pw_5fiona_4_env_14PROJDataFinder_3search(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7232 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_3search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7233   PyObject *__pyx_v_self = 0;
7234   PyObject *__pyx_v_prefix = 0;
7235   int __pyx_lineno = 0;
7236   const char *__pyx_filename = NULL;
7237   int __pyx_clineno = 0;
7238   PyObject *__pyx_r = 0;
7239   __Pyx_RefNannyDeclarations
7240   __Pyx_RefNannySetupContext("search (wrapper)", 0);
7241   {
7242     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
7243     PyObject* values[2] = {0,0};
7244     values[1] = ((PyObject *)((PyObject *)Py_None));
7245     if (unlikely(__pyx_kwds)) {
7246       Py_ssize_t kw_args;
7247       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7248       switch (pos_args) {
7249         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7250         CYTHON_FALLTHROUGH;
7251         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7252         CYTHON_FALLTHROUGH;
7253         case  0: break;
7254         default: goto __pyx_L5_argtuple_error;
7255       }
7256       kw_args = PyDict_Size(__pyx_kwds);
7257       switch (pos_args) {
7258         case  0:
7259         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
7260         else goto __pyx_L5_argtuple_error;
7261         CYTHON_FALLTHROUGH;
7262         case  1:
7263         if (kw_args > 0) {
7264           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
7265           if (value) { values[1] = value; kw_args--; }
7266         }
7267       }
7268       if (unlikely(kw_args > 0)) {
7269         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
7270       }
7271     } else {
7272       switch (PyTuple_GET_SIZE(__pyx_args)) {
7273         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7274         CYTHON_FALLTHROUGH;
7275         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7276         break;
7277         default: goto __pyx_L5_argtuple_error;
7278       }
7279     }
7280     __pyx_v_self = values[0];
7281     __pyx_v_prefix = values[1];
7282   }
7283   goto __pyx_L4_argument_unpacking_done;
7284   __pyx_L5_argtuple_error:;
7285   __Pyx_RaiseArgtupleInvalid("search", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
7286   __pyx_L3_error:;
7287   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search", __pyx_clineno, __pyx_lineno, __pyx_filename);
7288   __Pyx_RefNannyFinishContext();
7289   return NULL;
7290   __pyx_L4_argument_unpacking_done:;
7291   __pyx_r = __pyx_pf_5fiona_4_env_14PROJDataFinder_2search(__pyx_self, __pyx_v_self, __pyx_v_prefix);
7292 
7293   /* function exit code */
7294   __Pyx_RefNannyFinishContext();
7295   return __pyx_r;
7296 }
7297 
__pyx_pf_5fiona_4_env_14PROJDataFinder_2search(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)7298 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_2search(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
7299   PyObject *__pyx_v_path = NULL;
7300   PyObject *__pyx_r = NULL;
7301   __Pyx_RefNannyDeclarations
7302   PyObject *__pyx_t_1 = NULL;
7303   PyObject *__pyx_t_2 = NULL;
7304   PyObject *__pyx_t_3 = NULL;
7305   int __pyx_t_4;
7306   PyObject *__pyx_t_5 = NULL;
7307   int __pyx_t_6;
7308   PyObject *__pyx_t_7 = NULL;
7309   int __pyx_lineno = 0;
7310   const char *__pyx_filename = NULL;
7311   int __pyx_clineno = 0;
7312   __Pyx_RefNannySetupContext("search", 0);
7313 
7314   /* "fiona/_env.pyx":369
7315  *
7316  *         """
7317  *         path = self.search_wheel(prefix or __file__)             # <<<<<<<<<<<<<<
7318  *         if not path:
7319  *             path = self.search_prefix(prefix or sys.prefix)
7320  */
7321   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_search_wheel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
7322   __Pyx_GOTREF(__pyx_t_2);
7323   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 369, __pyx_L1_error)
7324   if (!__pyx_t_4) {
7325   } else {
7326     __Pyx_INCREF(__pyx_v_prefix);
7327     __pyx_t_3 = __pyx_v_prefix;
7328     goto __pyx_L3_bool_binop_done;
7329   }
7330   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L1_error)
7331   __Pyx_GOTREF(__pyx_t_5);
7332   __Pyx_INCREF(__pyx_t_5);
7333   __pyx_t_3 = __pyx_t_5;
7334   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7335   __pyx_L3_bool_binop_done:;
7336   __pyx_t_5 = NULL;
7337   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7338     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
7339     if (likely(__pyx_t_5)) {
7340       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7341       __Pyx_INCREF(__pyx_t_5);
7342       __Pyx_INCREF(function);
7343       __Pyx_DECREF_SET(__pyx_t_2, function);
7344     }
7345   }
7346   __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
7347   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7348   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7349   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
7350   __Pyx_GOTREF(__pyx_t_1);
7351   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7352   __pyx_v_path = __pyx_t_1;
7353   __pyx_t_1 = 0;
7354 
7355   /* "fiona/_env.pyx":370
7356  *         """
7357  *         path = self.search_wheel(prefix or __file__)
7358  *         if not path:             # <<<<<<<<<<<<<<
7359  *             path = self.search_prefix(prefix or sys.prefix)
7360  *         return path
7361  */
7362   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 370, __pyx_L1_error)
7363   __pyx_t_6 = ((!__pyx_t_4) != 0);
7364   if (__pyx_t_6) {
7365 
7366     /* "fiona/_env.pyx":371
7367  *         path = self.search_wheel(prefix or __file__)
7368  *         if not path:
7369  *             path = self.search_prefix(prefix or sys.prefix)             # <<<<<<<<<<<<<<
7370  *         return path
7371  *
7372  */
7373     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_search_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
7374     __Pyx_GOTREF(__pyx_t_2);
7375     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 371, __pyx_L1_error)
7376     if (!__pyx_t_6) {
7377     } else {
7378       __Pyx_INCREF(__pyx_v_prefix);
7379       __pyx_t_3 = __pyx_v_prefix;
7380       goto __pyx_L6_bool_binop_done;
7381     }
7382     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 371, __pyx_L1_error)
7383     __Pyx_GOTREF(__pyx_t_5);
7384     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_prefix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error)
7385     __Pyx_GOTREF(__pyx_t_7);
7386     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7387     __Pyx_INCREF(__pyx_t_7);
7388     __pyx_t_3 = __pyx_t_7;
7389     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7390     __pyx_L6_bool_binop_done:;
7391     __pyx_t_7 = NULL;
7392     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7393       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
7394       if (likely(__pyx_t_7)) {
7395         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7396         __Pyx_INCREF(__pyx_t_7);
7397         __Pyx_INCREF(function);
7398         __Pyx_DECREF_SET(__pyx_t_2, function);
7399       }
7400     }
7401     __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
7402     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7403     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7404     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
7405     __Pyx_GOTREF(__pyx_t_1);
7406     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7407     __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
7408     __pyx_t_1 = 0;
7409 
7410     /* "fiona/_env.pyx":370
7411  *         """
7412  *         path = self.search_wheel(prefix or __file__)
7413  *         if not path:             # <<<<<<<<<<<<<<
7414  *             path = self.search_prefix(prefix or sys.prefix)
7415  *         return path
7416  */
7417   }
7418 
7419   /* "fiona/_env.pyx":372
7420  *         if not path:
7421  *             path = self.search_prefix(prefix or sys.prefix)
7422  *         return path             # <<<<<<<<<<<<<<
7423  *
7424  *     def search_wheel(self, prefix=None):
7425  */
7426   __Pyx_XDECREF(__pyx_r);
7427   __Pyx_INCREF(__pyx_v_path);
7428   __pyx_r = __pyx_v_path;
7429   goto __pyx_L0;
7430 
7431   /* "fiona/_env.pyx":359
7432  *
7433  *
7434  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
7435  *         """Returns PROJ data directory
7436  *
7437  */
7438 
7439   /* function exit code */
7440   __pyx_L1_error:;
7441   __Pyx_XDECREF(__pyx_t_1);
7442   __Pyx_XDECREF(__pyx_t_2);
7443   __Pyx_XDECREF(__pyx_t_3);
7444   __Pyx_XDECREF(__pyx_t_5);
7445   __Pyx_XDECREF(__pyx_t_7);
7446   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search", __pyx_clineno, __pyx_lineno, __pyx_filename);
7447   __pyx_r = NULL;
7448   __pyx_L0:;
7449   __Pyx_XDECREF(__pyx_v_path);
7450   __Pyx_XGIVEREF(__pyx_r);
7451   __Pyx_RefNannyFinishContext();
7452   return __pyx_r;
7453 }
7454 
7455 /* "fiona/_env.pyx":374
7456  *         return path
7457  *
7458  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
7459  *         """Check wheel location"""
7460  *         if prefix is None:
7461  */
7462 
7463 /* Python wrapper */
7464 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_5search_wheel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7465 static char __pyx_doc_5fiona_4_env_14PROJDataFinder_4search_wheel[] = "Check wheel location";
7466 static PyMethodDef __pyx_mdef_5fiona_4_env_14PROJDataFinder_5search_wheel = {"search_wheel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14PROJDataFinder_5search_wheel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14PROJDataFinder_4search_wheel};
__pyx_pw_5fiona_4_env_14PROJDataFinder_5search_wheel(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7467 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_5search_wheel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7468   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
7469   PyObject *__pyx_v_prefix = 0;
7470   int __pyx_lineno = 0;
7471   const char *__pyx_filename = NULL;
7472   int __pyx_clineno = 0;
7473   PyObject *__pyx_r = 0;
7474   __Pyx_RefNannyDeclarations
7475   __Pyx_RefNannySetupContext("search_wheel (wrapper)", 0);
7476   {
7477     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
7478     PyObject* values[2] = {0,0};
7479     values[1] = ((PyObject *)((PyObject *)Py_None));
7480     if (unlikely(__pyx_kwds)) {
7481       Py_ssize_t kw_args;
7482       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7483       switch (pos_args) {
7484         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7485         CYTHON_FALLTHROUGH;
7486         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7487         CYTHON_FALLTHROUGH;
7488         case  0: break;
7489         default: goto __pyx_L5_argtuple_error;
7490       }
7491       kw_args = PyDict_Size(__pyx_kwds);
7492       switch (pos_args) {
7493         case  0:
7494         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
7495         else goto __pyx_L5_argtuple_error;
7496         CYTHON_FALLTHROUGH;
7497         case  1:
7498         if (kw_args > 0) {
7499           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
7500           if (value) { values[1] = value; kw_args--; }
7501         }
7502       }
7503       if (unlikely(kw_args > 0)) {
7504         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search_wheel") < 0)) __PYX_ERR(0, 374, __pyx_L3_error)
7505       }
7506     } else {
7507       switch (PyTuple_GET_SIZE(__pyx_args)) {
7508         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7509         CYTHON_FALLTHROUGH;
7510         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7511         break;
7512         default: goto __pyx_L5_argtuple_error;
7513       }
7514     }
7515     __pyx_v_self = values[0];
7516     __pyx_v_prefix = values[1];
7517   }
7518   goto __pyx_L4_argument_unpacking_done;
7519   __pyx_L5_argtuple_error:;
7520   __Pyx_RaiseArgtupleInvalid("search_wheel", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 374, __pyx_L3_error)
7521   __pyx_L3_error:;
7522   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search_wheel", __pyx_clineno, __pyx_lineno, __pyx_filename);
7523   __Pyx_RefNannyFinishContext();
7524   return NULL;
7525   __pyx_L4_argument_unpacking_done:;
7526   __pyx_r = __pyx_pf_5fiona_4_env_14PROJDataFinder_4search_wheel(__pyx_self, __pyx_v_self, __pyx_v_prefix);
7527 
7528   /* function exit code */
7529   __Pyx_RefNannyFinishContext();
7530   return __pyx_r;
7531 }
7532 
__pyx_pf_5fiona_4_env_14PROJDataFinder_4search_wheel(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)7533 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_4search_wheel(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
7534   PyObject *__pyx_v_datadir = NULL;
7535   PyObject *__pyx_r = NULL;
7536   __Pyx_RefNannyDeclarations
7537   int __pyx_t_1;
7538   int __pyx_t_2;
7539   PyObject *__pyx_t_3 = NULL;
7540   PyObject *__pyx_t_4 = NULL;
7541   PyObject *__pyx_t_5 = NULL;
7542   PyObject *__pyx_t_6 = NULL;
7543   PyObject *__pyx_t_7 = NULL;
7544   PyObject *__pyx_t_8 = NULL;
7545   PyObject *__pyx_t_9 = NULL;
7546   int __pyx_t_10;
7547   int __pyx_lineno = 0;
7548   const char *__pyx_filename = NULL;
7549   int __pyx_clineno = 0;
7550   __Pyx_RefNannySetupContext("search_wheel", 0);
7551   __Pyx_INCREF(__pyx_v_prefix);
7552 
7553   /* "fiona/_env.pyx":376
7554  *     def search_wheel(self, prefix=None):
7555  *         """Check wheel location"""
7556  *         if prefix is None:             # <<<<<<<<<<<<<<
7557  *             prefix = __file__
7558  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "proj_data"))
7559  */
7560   __pyx_t_1 = (__pyx_v_prefix == Py_None);
7561   __pyx_t_2 = (__pyx_t_1 != 0);
7562   if (__pyx_t_2) {
7563 
7564     /* "fiona/_env.pyx":377
7565  *         """Check wheel location"""
7566  *         if prefix is None:
7567  *             prefix = __file__             # <<<<<<<<<<<<<<
7568  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "proj_data"))
7569  *         return datadir if os.path.exists(datadir) else None
7570  */
7571     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
7572     __Pyx_GOTREF(__pyx_t_3);
7573     __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_3);
7574     __pyx_t_3 = 0;
7575 
7576     /* "fiona/_env.pyx":376
7577  *     def search_wheel(self, prefix=None):
7578  *         """Check wheel location"""
7579  *         if prefix is None:             # <<<<<<<<<<<<<<
7580  *             prefix = __file__
7581  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "proj_data"))
7582  */
7583   }
7584 
7585   /* "fiona/_env.pyx":378
7586  *         if prefix is None:
7587  *             prefix = __file__
7588  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "proj_data"))             # <<<<<<<<<<<<<<
7589  *         return datadir if os.path.exists(datadir) else None
7590  *
7591  */
7592   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
7593   __Pyx_GOTREF(__pyx_t_4);
7594   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
7595   __Pyx_GOTREF(__pyx_t_5);
7596   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7597   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abspath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
7598   __Pyx_GOTREF(__pyx_t_4);
7599   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7600   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error)
7601   __Pyx_GOTREF(__pyx_t_6);
7602   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L1_error)
7603   __Pyx_GOTREF(__pyx_t_7);
7604   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7605   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error)
7606   __Pyx_GOTREF(__pyx_t_6);
7607   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7608   __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error)
7609   __Pyx_GOTREF(__pyx_t_8);
7610   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 378, __pyx_L1_error)
7611   __Pyx_GOTREF(__pyx_t_9);
7612   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7613   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dirname); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error)
7614   __Pyx_GOTREF(__pyx_t_8);
7615   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7616   __pyx_t_9 = NULL;
7617   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
7618     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
7619     if (likely(__pyx_t_9)) {
7620       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
7621       __Pyx_INCREF(__pyx_t_9);
7622       __Pyx_INCREF(function);
7623       __Pyx_DECREF_SET(__pyx_t_8, function);
7624     }
7625   }
7626   __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_prefix);
7627   __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7628   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L1_error)
7629   __Pyx_GOTREF(__pyx_t_7);
7630   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7631   __pyx_t_8 = NULL;
7632   __pyx_t_10 = 0;
7633   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
7634     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
7635     if (likely(__pyx_t_8)) {
7636       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
7637       __Pyx_INCREF(__pyx_t_8);
7638       __Pyx_INCREF(function);
7639       __Pyx_DECREF_SET(__pyx_t_6, function);
7640       __pyx_t_10 = 1;
7641     }
7642   }
7643   #if CYTHON_FAST_PYCALL
7644   if (PyFunction_Check(__pyx_t_6)) {
7645     PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_n_u_proj_data};
7646     __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
7647     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7648     __Pyx_GOTREF(__pyx_t_5);
7649     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7650   } else
7651   #endif
7652   #if CYTHON_FAST_PYCCALL
7653   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
7654     PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_n_u_proj_data};
7655     __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
7656     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7657     __Pyx_GOTREF(__pyx_t_5);
7658     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7659   } else
7660   #endif
7661   {
7662     __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 378, __pyx_L1_error)
7663     __Pyx_GOTREF(__pyx_t_9);
7664     if (__pyx_t_8) {
7665       __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
7666     }
7667     __Pyx_GIVEREF(__pyx_t_7);
7668     PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_7);
7669     __Pyx_INCREF(__pyx_n_u_proj_data);
7670     __Pyx_GIVEREF(__pyx_n_u_proj_data);
7671     PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_n_u_proj_data);
7672     __pyx_t_7 = 0;
7673     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
7674     __Pyx_GOTREF(__pyx_t_5);
7675     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7676   }
7677   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7678   __pyx_t_6 = NULL;
7679   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7680     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
7681     if (likely(__pyx_t_6)) {
7682       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7683       __Pyx_INCREF(__pyx_t_6);
7684       __Pyx_INCREF(function);
7685       __Pyx_DECREF_SET(__pyx_t_4, function);
7686     }
7687   }
7688   __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
7689   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7690   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7691   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
7692   __Pyx_GOTREF(__pyx_t_3);
7693   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7694   __pyx_v_datadir = __pyx_t_3;
7695   __pyx_t_3 = 0;
7696 
7697   /* "fiona/_env.pyx":379
7698  *             prefix = __file__
7699  *         datadir = os.path.abspath(os.path.join(os.path.dirname(prefix), "proj_data"))
7700  *         return datadir if os.path.exists(datadir) else None             # <<<<<<<<<<<<<<
7701  *
7702  *     def search_prefix(self, prefix=sys.prefix):
7703  */
7704   __Pyx_XDECREF(__pyx_r);
7705   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
7706   __Pyx_GOTREF(__pyx_t_5);
7707   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L1_error)
7708   __Pyx_GOTREF(__pyx_t_6);
7709   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7710   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_exists); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
7711   __Pyx_GOTREF(__pyx_t_5);
7712   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7713   __pyx_t_6 = NULL;
7714   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7715     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7716     if (likely(__pyx_t_6)) {
7717       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7718       __Pyx_INCREF(__pyx_t_6);
7719       __Pyx_INCREF(function);
7720       __Pyx_DECREF_SET(__pyx_t_5, function);
7721     }
7722   }
7723   __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_datadir) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_datadir);
7724   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7725   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error)
7726   __Pyx_GOTREF(__pyx_t_4);
7727   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7728   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 379, __pyx_L1_error)
7729   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7730   if (__pyx_t_2) {
7731     __Pyx_INCREF(__pyx_v_datadir);
7732     __pyx_t_3 = __pyx_v_datadir;
7733   } else {
7734     __Pyx_INCREF(Py_None);
7735     __pyx_t_3 = Py_None;
7736   }
7737   __pyx_r = __pyx_t_3;
7738   __pyx_t_3 = 0;
7739   goto __pyx_L0;
7740 
7741   /* "fiona/_env.pyx":374
7742  *         return path
7743  *
7744  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
7745  *         """Check wheel location"""
7746  *         if prefix is None:
7747  */
7748 
7749   /* function exit code */
7750   __pyx_L1_error:;
7751   __Pyx_XDECREF(__pyx_t_3);
7752   __Pyx_XDECREF(__pyx_t_4);
7753   __Pyx_XDECREF(__pyx_t_5);
7754   __Pyx_XDECREF(__pyx_t_6);
7755   __Pyx_XDECREF(__pyx_t_7);
7756   __Pyx_XDECREF(__pyx_t_8);
7757   __Pyx_XDECREF(__pyx_t_9);
7758   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search_wheel", __pyx_clineno, __pyx_lineno, __pyx_filename);
7759   __pyx_r = NULL;
7760   __pyx_L0:;
7761   __Pyx_XDECREF(__pyx_v_datadir);
7762   __Pyx_XDECREF(__pyx_v_prefix);
7763   __Pyx_XGIVEREF(__pyx_r);
7764   __Pyx_RefNannyFinishContext();
7765   return __pyx_r;
7766 }
7767 
7768 /* "fiona/_env.pyx":381
7769  *         return datadir if os.path.exists(datadir) else None
7770  *
7771  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
7772  *         """Check sys.prefix location"""
7773  *         datadir = os.path.join(prefix, 'share', 'proj')
7774  */
7775 
__pyx_pf_5fiona_4_env_28__defaults__(CYTHON_UNUSED PyObject * __pyx_self)7776 static PyObject *__pyx_pf_5fiona_4_env_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
7777   PyObject *__pyx_r = NULL;
7778   __Pyx_RefNannyDeclarations
7779   PyObject *__pyx_t_1 = NULL;
7780   PyObject *__pyx_t_2 = NULL;
7781   int __pyx_lineno = 0;
7782   const char *__pyx_filename = NULL;
7783   int __pyx_clineno = 0;
7784   __Pyx_RefNannySetupContext("__defaults__", 0);
7785   __Pyx_XDECREF(__pyx_r);
7786   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
7787   __Pyx_GOTREF(__pyx_t_1);
7788   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_prefix);
7789   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_prefix);
7790   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_prefix);
7791   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
7792   __Pyx_GOTREF(__pyx_t_2);
7793   __Pyx_GIVEREF(__pyx_t_1);
7794   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
7795   __Pyx_INCREF(Py_None);
7796   __Pyx_GIVEREF(Py_None);
7797   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
7798   __pyx_t_1 = 0;
7799   __pyx_r = __pyx_t_2;
7800   __pyx_t_2 = 0;
7801   goto __pyx_L0;
7802 
7803   /* function exit code */
7804   __pyx_L1_error:;
7805   __Pyx_XDECREF(__pyx_t_1);
7806   __Pyx_XDECREF(__pyx_t_2);
7807   __Pyx_AddTraceback("fiona._env.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7808   __pyx_r = NULL;
7809   __pyx_L0:;
7810   __Pyx_XGIVEREF(__pyx_r);
7811   __Pyx_RefNannyFinishContext();
7812   return __pyx_r;
7813 }
7814 
7815 /* Python wrapper */
7816 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_7search_prefix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7817 static char __pyx_doc_5fiona_4_env_14PROJDataFinder_6search_prefix[] = "Check sys.prefix location";
7818 static PyMethodDef __pyx_mdef_5fiona_4_env_14PROJDataFinder_7search_prefix = {"search_prefix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_14PROJDataFinder_7search_prefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14PROJDataFinder_6search_prefix};
__pyx_pw_5fiona_4_env_14PROJDataFinder_7search_prefix(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7819 static PyObject *__pyx_pw_5fiona_4_env_14PROJDataFinder_7search_prefix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7820   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
7821   PyObject *__pyx_v_prefix = 0;
7822   int __pyx_lineno = 0;
7823   const char *__pyx_filename = NULL;
7824   int __pyx_clineno = 0;
7825   PyObject *__pyx_r = 0;
7826   __Pyx_RefNannyDeclarations
7827   __Pyx_RefNannySetupContext("search_prefix (wrapper)", 0);
7828   {
7829     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
7830     PyObject* values[2] = {0,0};
7831     __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
7832     values[1] = __pyx_dynamic_args->__pyx_arg_prefix;
7833     if (unlikely(__pyx_kwds)) {
7834       Py_ssize_t kw_args;
7835       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7836       switch (pos_args) {
7837         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7838         CYTHON_FALLTHROUGH;
7839         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7840         CYTHON_FALLTHROUGH;
7841         case  0: break;
7842         default: goto __pyx_L5_argtuple_error;
7843       }
7844       kw_args = PyDict_Size(__pyx_kwds);
7845       switch (pos_args) {
7846         case  0:
7847         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
7848         else goto __pyx_L5_argtuple_error;
7849         CYTHON_FALLTHROUGH;
7850         case  1:
7851         if (kw_args > 0) {
7852           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix);
7853           if (value) { values[1] = value; kw_args--; }
7854         }
7855       }
7856       if (unlikely(kw_args > 0)) {
7857         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search_prefix") < 0)) __PYX_ERR(0, 381, __pyx_L3_error)
7858       }
7859     } else {
7860       switch (PyTuple_GET_SIZE(__pyx_args)) {
7861         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7862         CYTHON_FALLTHROUGH;
7863         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7864         break;
7865         default: goto __pyx_L5_argtuple_error;
7866       }
7867     }
7868     __pyx_v_self = values[0];
7869     __pyx_v_prefix = values[1];
7870   }
7871   goto __pyx_L4_argument_unpacking_done;
7872   __pyx_L5_argtuple_error:;
7873   __Pyx_RaiseArgtupleInvalid("search_prefix", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 381, __pyx_L3_error)
7874   __pyx_L3_error:;
7875   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
7876   __Pyx_RefNannyFinishContext();
7877   return NULL;
7878   __pyx_L4_argument_unpacking_done:;
7879   __pyx_r = __pyx_pf_5fiona_4_env_14PROJDataFinder_6search_prefix(__pyx_self, __pyx_v_self, __pyx_v_prefix);
7880 
7881   /* function exit code */
7882   __Pyx_RefNannyFinishContext();
7883   return __pyx_r;
7884 }
7885 
__pyx_pf_5fiona_4_env_14PROJDataFinder_6search_prefix(CYTHON_UNUSED PyObject * __pyx_self,CYTHON_UNUSED PyObject * __pyx_v_self,PyObject * __pyx_v_prefix)7886 static PyObject *__pyx_pf_5fiona_4_env_14PROJDataFinder_6search_prefix(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
7887   PyObject *__pyx_v_datadir = NULL;
7888   PyObject *__pyx_r = NULL;
7889   __Pyx_RefNannyDeclarations
7890   PyObject *__pyx_t_1 = NULL;
7891   PyObject *__pyx_t_2 = NULL;
7892   PyObject *__pyx_t_3 = NULL;
7893   int __pyx_t_4;
7894   PyObject *__pyx_t_5 = NULL;
7895   int __pyx_t_6;
7896   int __pyx_lineno = 0;
7897   const char *__pyx_filename = NULL;
7898   int __pyx_clineno = 0;
7899   __Pyx_RefNannySetupContext("search_prefix", 0);
7900 
7901   /* "fiona/_env.pyx":383
7902  *     def search_prefix(self, prefix=sys.prefix):
7903  *         """Check sys.prefix location"""
7904  *         datadir = os.path.join(prefix, 'share', 'proj')             # <<<<<<<<<<<<<<
7905  *         return datadir if os.path.exists(datadir) else None
7906  *
7907  */
7908   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
7909   __Pyx_GOTREF(__pyx_t_2);
7910   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
7911   __Pyx_GOTREF(__pyx_t_3);
7912   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7913   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
7914   __Pyx_GOTREF(__pyx_t_2);
7915   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7916   __pyx_t_3 = NULL;
7917   __pyx_t_4 = 0;
7918   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7919     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7920     if (likely(__pyx_t_3)) {
7921       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7922       __Pyx_INCREF(__pyx_t_3);
7923       __Pyx_INCREF(function);
7924       __Pyx_DECREF_SET(__pyx_t_2, function);
7925       __pyx_t_4 = 1;
7926     }
7927   }
7928   #if CYTHON_FAST_PYCALL
7929   if (PyFunction_Check(__pyx_t_2)) {
7930     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_proj};
7931     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
7932     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7933     __Pyx_GOTREF(__pyx_t_1);
7934   } else
7935   #endif
7936   #if CYTHON_FAST_PYCCALL
7937   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
7938     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_prefix, __pyx_n_u_share, __pyx_n_u_proj};
7939     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
7940     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7941     __Pyx_GOTREF(__pyx_t_1);
7942   } else
7943   #endif
7944   {
7945     __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error)
7946     __Pyx_GOTREF(__pyx_t_5);
7947     if (__pyx_t_3) {
7948       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
7949     }
7950     __Pyx_INCREF(__pyx_v_prefix);
7951     __Pyx_GIVEREF(__pyx_v_prefix);
7952     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_prefix);
7953     __Pyx_INCREF(__pyx_n_u_share);
7954     __Pyx_GIVEREF(__pyx_n_u_share);
7955     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_share);
7956     __Pyx_INCREF(__pyx_n_u_proj);
7957     __Pyx_GIVEREF(__pyx_n_u_proj);
7958     PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_n_u_proj);
7959     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
7960     __Pyx_GOTREF(__pyx_t_1);
7961     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7962   }
7963   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7964   __pyx_v_datadir = __pyx_t_1;
7965   __pyx_t_1 = 0;
7966 
7967   /* "fiona/_env.pyx":384
7968  *         """Check sys.prefix location"""
7969  *         datadir = os.path.join(prefix, 'share', 'proj')
7970  *         return datadir if os.path.exists(datadir) else None             # <<<<<<<<<<<<<<
7971  *
7972  *
7973  */
7974   __Pyx_XDECREF(__pyx_r);
7975   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
7976   __Pyx_GOTREF(__pyx_t_5);
7977   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
7978   __Pyx_GOTREF(__pyx_t_3);
7979   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7980   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
7981   __Pyx_GOTREF(__pyx_t_5);
7982   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7983   __pyx_t_3 = NULL;
7984   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7985     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
7986     if (likely(__pyx_t_3)) {
7987       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7988       __Pyx_INCREF(__pyx_t_3);
7989       __Pyx_INCREF(function);
7990       __Pyx_DECREF_SET(__pyx_t_5, function);
7991     }
7992   }
7993   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_datadir) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_datadir);
7994   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7995   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
7996   __Pyx_GOTREF(__pyx_t_2);
7997   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7998   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 384, __pyx_L1_error)
7999   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8000   if (__pyx_t_6) {
8001     __Pyx_INCREF(__pyx_v_datadir);
8002     __pyx_t_1 = __pyx_v_datadir;
8003   } else {
8004     __Pyx_INCREF(Py_None);
8005     __pyx_t_1 = Py_None;
8006   }
8007   __pyx_r = __pyx_t_1;
8008   __pyx_t_1 = 0;
8009   goto __pyx_L0;
8010 
8011   /* "fiona/_env.pyx":381
8012  *         return datadir if os.path.exists(datadir) else None
8013  *
8014  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
8015  *         """Check sys.prefix location"""
8016  *         datadir = os.path.join(prefix, 'share', 'proj')
8017  */
8018 
8019   /* function exit code */
8020   __pyx_L1_error:;
8021   __Pyx_XDECREF(__pyx_t_1);
8022   __Pyx_XDECREF(__pyx_t_2);
8023   __Pyx_XDECREF(__pyx_t_3);
8024   __Pyx_XDECREF(__pyx_t_5);
8025   __Pyx_AddTraceback("fiona._env.PROJDataFinder.search_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
8026   __pyx_r = NULL;
8027   __pyx_L0:;
8028   __Pyx_XDECREF(__pyx_v_datadir);
8029   __Pyx_XGIVEREF(__pyx_r);
8030   __Pyx_RefNannyFinishContext();
8031   return __pyx_r;
8032 }
8033 
8034 /* "fiona/_env.pyx":390
8035  *     """Configuration and driver management"""
8036  *
8037  *     def __init__(self, **options):             # <<<<<<<<<<<<<<
8038  *         super(GDALEnv, self).__init__(**options)
8039  *         self._have_registered_drivers = False
8040  */
8041 
8042 /* Python wrapper */
8043 static int __pyx_pw_5fiona_4_env_7GDALEnv_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8044 static int __pyx_pw_5fiona_4_env_7GDALEnv_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8045   PyObject *__pyx_v_options = 0;
8046   int __pyx_r;
8047   __Pyx_RefNannyDeclarations
8048   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8049   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
8050     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
8051   if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
8052   if (__pyx_kwds) {
8053     __pyx_v_options = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_options)) return -1;
8054     __Pyx_GOTREF(__pyx_v_options);
8055   } else {
8056     __pyx_v_options = NULL;
8057   }
8058   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv___init__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self), __pyx_v_options);
8059 
8060   /* function exit code */
8061   __Pyx_XDECREF(__pyx_v_options);
8062   __Pyx_RefNannyFinishContext();
8063   return __pyx_r;
8064 }
8065 
__pyx_pf_5fiona_4_env_7GDALEnv___init__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self,PyObject * __pyx_v_options)8066 static int __pyx_pf_5fiona_4_env_7GDALEnv___init__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v_options) {
8067   int __pyx_r;
8068   __Pyx_RefNannyDeclarations
8069   PyObject *__pyx_t_1 = NULL;
8070   PyObject *__pyx_t_2 = NULL;
8071   int __pyx_lineno = 0;
8072   const char *__pyx_filename = NULL;
8073   int __pyx_clineno = 0;
8074   __Pyx_RefNannySetupContext("__init__", 0);
8075 
8076   /* "fiona/_env.pyx":391
8077  *
8078  *     def __init__(self, **options):
8079  *         super(GDALEnv, self).__init__(**options)             # <<<<<<<<<<<<<<
8080  *         self._have_registered_drivers = False
8081  *
8082  */
8083   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
8084   __Pyx_GOTREF(__pyx_t_1);
8085   __Pyx_INCREF(((PyObject *)__pyx_ptype_5fiona_4_env_GDALEnv));
8086   __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5fiona_4_env_GDALEnv));
8087   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_5fiona_4_env_GDALEnv));
8088   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8089   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8090   PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
8091   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
8092   __Pyx_GOTREF(__pyx_t_2);
8093   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8094   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
8095   __Pyx_GOTREF(__pyx_t_1);
8096   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8097   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
8098   __Pyx_GOTREF(__pyx_t_2);
8099   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8100   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8101 
8102   /* "fiona/_env.pyx":392
8103  *     def __init__(self, **options):
8104  *         super(GDALEnv, self).__init__(**options)
8105  *         self._have_registered_drivers = False             # <<<<<<<<<<<<<<
8106  *
8107  *     def start(self):
8108  */
8109   __Pyx_INCREF(Py_False);
8110   __Pyx_GIVEREF(Py_False);
8111   __Pyx_GOTREF(__pyx_v_self->_have_registered_drivers);
8112   __Pyx_DECREF(__pyx_v_self->_have_registered_drivers);
8113   __pyx_v_self->_have_registered_drivers = Py_False;
8114 
8115   /* "fiona/_env.pyx":390
8116  *     """Configuration and driver management"""
8117  *
8118  *     def __init__(self, **options):             # <<<<<<<<<<<<<<
8119  *         super(GDALEnv, self).__init__(**options)
8120  *         self._have_registered_drivers = False
8121  */
8122 
8123   /* function exit code */
8124   __pyx_r = 0;
8125   goto __pyx_L0;
8126   __pyx_L1_error:;
8127   __Pyx_XDECREF(__pyx_t_1);
8128   __Pyx_XDECREF(__pyx_t_2);
8129   __Pyx_AddTraceback("fiona._env.GDALEnv.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8130   __pyx_r = -1;
8131   __pyx_L0:;
8132   __Pyx_RefNannyFinishContext();
8133   return __pyx_r;
8134 }
8135 
8136 /* "fiona/_env.pyx":394
8137  *         self._have_registered_drivers = False
8138  *
8139  *     def start(self):             # <<<<<<<<<<<<<<
8140  *         CPLPushErrorHandler(<CPLErrorHandler>logging_error_handler)
8141  *
8142  */
8143 
8144 /* Python wrapper */
8145 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_3start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_3start(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8146 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_3start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8147   PyObject *__pyx_r = 0;
8148   __Pyx_RefNannyDeclarations
8149   __Pyx_RefNannySetupContext("start (wrapper)", 0);
8150   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_2start(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
8151 
8152   /* function exit code */
8153   __Pyx_RefNannyFinishContext();
8154   return __pyx_r;
8155 }
8156 
__pyx_pf_5fiona_4_env_7GDALEnv_2start(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)8157 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_2start(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
8158   PyObject *__pyx_v_path = NULL;
8159   PyObject *__pyx_r = NULL;
8160   __Pyx_RefNannyDeclarations
8161   int __pyx_t_1;
8162   int __pyx_t_2;
8163   PyObject *__pyx_t_3 = NULL;
8164   PyObject *__pyx_t_4 = NULL;
8165   PyObject *__pyx_t_5 = NULL;
8166   PyObject *__pyx_t_6 = NULL;
8167   PyObject *__pyx_t_7 = NULL;
8168   PyObject *__pyx_t_8 = NULL;
8169   PyObject *__pyx_t_9 = NULL;
8170   PyObject *__pyx_t_10 = NULL;
8171   int __pyx_t_11;
8172   PyObject *__pyx_t_12 = NULL;
8173   int __pyx_lineno = 0;
8174   const char *__pyx_filename = NULL;
8175   int __pyx_clineno = 0;
8176   __Pyx_RefNannySetupContext("start", 0);
8177 
8178   /* "fiona/_env.pyx":395
8179  *
8180  *     def start(self):
8181  *         CPLPushErrorHandler(<CPLErrorHandler>logging_error_handler)             # <<<<<<<<<<<<<<
8182  *
8183  *         # The outer if statement prevents each thread from acquiring a
8184  */
8185   CPLPushErrorHandler(((CPLErrorHandler)__pyx_f_5fiona_4_env_logging_error_handler));
8186 
8187   /* "fiona/_env.pyx":400
8188  *         # lock when the environment starts, and the inner avoids a
8189  *         # potential race condition.
8190  *         if not self._have_registered_drivers:             # <<<<<<<<<<<<<<
8191  *             with threading.Lock():
8192  *                 if not self._have_registered_drivers:
8193  */
8194   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_have_registered_drivers); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
8195   __pyx_t_2 = ((!__pyx_t_1) != 0);
8196   if (__pyx_t_2) {
8197 
8198     /* "fiona/_env.pyx":401
8199  *         # potential race condition.
8200  *         if not self._have_registered_drivers:
8201  *             with threading.Lock():             # <<<<<<<<<<<<<<
8202  *                 if not self._have_registered_drivers:
8203  *
8204  */
8205     /*with:*/ {
8206       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_threading); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
8207       __Pyx_GOTREF(__pyx_t_4);
8208       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Lock); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
8209       __Pyx_GOTREF(__pyx_t_5);
8210       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8211       __pyx_t_4 = NULL;
8212       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8213         __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
8214         if (likely(__pyx_t_4)) {
8215           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8216           __Pyx_INCREF(__pyx_t_4);
8217           __Pyx_INCREF(function);
8218           __Pyx_DECREF_SET(__pyx_t_5, function);
8219         }
8220       }
8221       __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8222       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8223       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
8224       __Pyx_GOTREF(__pyx_t_3);
8225       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8226       __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error)
8227       __Pyx_GOTREF(__pyx_t_6);
8228       __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L4_error)
8229       __Pyx_GOTREF(__pyx_t_4);
8230       __pyx_t_7 = NULL;
8231       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
8232         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
8233         if (likely(__pyx_t_7)) {
8234           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8235           __Pyx_INCREF(__pyx_t_7);
8236           __Pyx_INCREF(function);
8237           __Pyx_DECREF_SET(__pyx_t_4, function);
8238         }
8239       }
8240       __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
8241       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8242       if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L4_error)
8243       __Pyx_GOTREF(__pyx_t_5);
8244       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8245       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8246       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8247       /*try:*/ {
8248         {
8249           __Pyx_PyThreadState_declare
8250           __Pyx_PyThreadState_assign
8251           __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
8252           __Pyx_XGOTREF(__pyx_t_8);
8253           __Pyx_XGOTREF(__pyx_t_9);
8254           __Pyx_XGOTREF(__pyx_t_10);
8255           /*try:*/ {
8256 
8257             /* "fiona/_env.pyx":402
8258  *         if not self._have_registered_drivers:
8259  *             with threading.Lock():
8260  *                 if not self._have_registered_drivers:             # <<<<<<<<<<<<<<
8261  *
8262  *                     GDALAllRegister()
8263  */
8264             __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_have_registered_drivers); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 402, __pyx_L8_error)
8265             __pyx_t_1 = ((!__pyx_t_2) != 0);
8266             if (__pyx_t_1) {
8267 
8268               /* "fiona/_env.pyx":404
8269  *                 if not self._have_registered_drivers:
8270  *
8271  *                     GDALAllRegister()             # <<<<<<<<<<<<<<
8272  *                     OGRRegisterAll()
8273  *
8274  */
8275               GDALAllRegister();
8276 
8277               /* "fiona/_env.pyx":405
8278  *
8279  *                     GDALAllRegister()
8280  *                     OGRRegisterAll()             # <<<<<<<<<<<<<<
8281  *
8282  *                     if 'GDAL_DATA' in os.environ:
8283  */
8284               OGRRegisterAll();
8285 
8286               /* "fiona/_env.pyx":407
8287  *                     OGRRegisterAll()
8288  *
8289  *                     if 'GDAL_DATA' in os.environ:             # <<<<<<<<<<<<<<
8290  *                         log.debug("GDAL_DATA found in environment.")
8291  *                         self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])
8292  */
8293               __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L8_error)
8294               __Pyx_GOTREF(__pyx_t_3);
8295               __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_environ); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L8_error)
8296               __Pyx_GOTREF(__pyx_t_5);
8297               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8298               __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_GDAL_DATA, __pyx_t_5, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 407, __pyx_L8_error)
8299               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8300               __pyx_t_2 = (__pyx_t_1 != 0);
8301               if (__pyx_t_2) {
8302 
8303                 /* "fiona/_env.pyx":408
8304  *
8305  *                     if 'GDAL_DATA' in os.environ:
8306  *                         log.debug("GDAL_DATA found in environment.")             # <<<<<<<<<<<<<<
8307  *                         self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])
8308  *
8309  */
8310                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L8_error)
8311                 __Pyx_GOTREF(__pyx_t_3);
8312                 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L8_error)
8313                 __Pyx_GOTREF(__pyx_t_4);
8314                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8315                 __pyx_t_3 = NULL;
8316                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8317                   __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
8318                   if (likely(__pyx_t_3)) {
8319                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8320                     __Pyx_INCREF(__pyx_t_3);
8321                     __Pyx_INCREF(function);
8322                     __Pyx_DECREF_SET(__pyx_t_4, function);
8323                   }
8324                 }
8325                 __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_GDAL_DATA_found_in_environment) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_GDAL_DATA_found_in_environment);
8326                 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8327                 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L8_error)
8328                 __Pyx_GOTREF(__pyx_t_5);
8329                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8330                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8331 
8332                 /* "fiona/_env.pyx":409
8333  *                     if 'GDAL_DATA' in os.environ:
8334  *                         log.debug("GDAL_DATA found in environment.")
8335  *                         self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])             # <<<<<<<<<<<<<<
8336  *
8337  *                     else:
8338  */
8339                 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_config_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L8_error)
8340                 __Pyx_GOTREF(__pyx_t_5);
8341                 __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L8_error)
8342                 __Pyx_GOTREF(__pyx_t_4);
8343                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L8_error)
8344                 __Pyx_GOTREF(__pyx_t_3);
8345                 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_environ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 409, __pyx_L8_error)
8346                 __Pyx_GOTREF(__pyx_t_7);
8347                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8348                 __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_n_u_GDAL_DATA); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L8_error)
8349                 __Pyx_GOTREF(__pyx_t_3);
8350                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8351                 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_GDAL_DATA, __pyx_t_3) < 0) __PYX_ERR(0, 409, __pyx_L8_error)
8352                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8353                 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L8_error)
8354                 __Pyx_GOTREF(__pyx_t_3);
8355                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8356                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8357                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8358 
8359                 /* "fiona/_env.pyx":407
8360  *                     OGRRegisterAll()
8361  *
8362  *                     if 'GDAL_DATA' in os.environ:             # <<<<<<<<<<<<<<
8363  *                         log.debug("GDAL_DATA found in environment.")
8364  *                         self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])
8365  */
8366                 goto __pyx_L15;
8367               }
8368 
8369               /* "fiona/_env.pyx":412
8370  *
8371  *                     else:
8372  *                         path = GDALDataFinder().search_wheel()             # <<<<<<<<<<<<<<
8373  *
8374  *                         if path:
8375  */
8376               /*else*/ {
8377                 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_GDALDataFinder); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L8_error)
8378                 __Pyx_GOTREF(__pyx_t_5);
8379                 __pyx_t_7 = NULL;
8380                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8381                   __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
8382                   if (likely(__pyx_t_7)) {
8383                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8384                     __Pyx_INCREF(__pyx_t_7);
8385                     __Pyx_INCREF(function);
8386                     __Pyx_DECREF_SET(__pyx_t_5, function);
8387                   }
8388                 }
8389                 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8390                 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8391                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L8_error)
8392                 __Pyx_GOTREF(__pyx_t_4);
8393                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8394                 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_search_wheel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L8_error)
8395                 __Pyx_GOTREF(__pyx_t_5);
8396                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8397                 __pyx_t_4 = NULL;
8398                 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8399                   __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
8400                   if (likely(__pyx_t_4)) {
8401                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8402                     __Pyx_INCREF(__pyx_t_4);
8403                     __Pyx_INCREF(function);
8404                     __Pyx_DECREF_SET(__pyx_t_5, function);
8405                   }
8406                 }
8407                 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8408                 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8409                 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L8_error)
8410                 __Pyx_GOTREF(__pyx_t_3);
8411                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8412                 __pyx_v_path = __pyx_t_3;
8413                 __pyx_t_3 = 0;
8414 
8415                 /* "fiona/_env.pyx":414
8416  *                         path = GDALDataFinder().search_wheel()
8417  *
8418  *                         if path:             # <<<<<<<<<<<<<<
8419  *                             log.debug("GDAL data found in package: path=%r.", path)
8420  *                             self.update_config_options(GDAL_DATA=path)
8421  */
8422                 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 414, __pyx_L8_error)
8423                 if (__pyx_t_2) {
8424 
8425                   /* "fiona/_env.pyx":415
8426  *
8427  *                         if path:
8428  *                             log.debug("GDAL data found in package: path=%r.", path)             # <<<<<<<<<<<<<<
8429  *                             self.update_config_options(GDAL_DATA=path)
8430  *
8431  */
8432                   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 415, __pyx_L8_error)
8433                   __Pyx_GOTREF(__pyx_t_5);
8434                   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L8_error)
8435                   __Pyx_GOTREF(__pyx_t_4);
8436                   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8437                   __pyx_t_5 = NULL;
8438                   __pyx_t_11 = 0;
8439                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8440                     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
8441                     if (likely(__pyx_t_5)) {
8442                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8443                       __Pyx_INCREF(__pyx_t_5);
8444                       __Pyx_INCREF(function);
8445                       __Pyx_DECREF_SET(__pyx_t_4, function);
8446                       __pyx_t_11 = 1;
8447                     }
8448                   }
8449                   #if CYTHON_FAST_PYCALL
8450                   if (PyFunction_Check(__pyx_t_4)) {
8451                     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_GDAL_data_found_in_package_path, __pyx_v_path};
8452                     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L8_error)
8453                     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8454                     __Pyx_GOTREF(__pyx_t_3);
8455                   } else
8456                   #endif
8457                   #if CYTHON_FAST_PYCCALL
8458                   if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
8459                     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_GDAL_data_found_in_package_path, __pyx_v_path};
8460                     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L8_error)
8461                     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8462                     __Pyx_GOTREF(__pyx_t_3);
8463                   } else
8464                   #endif
8465                   {
8466                     __pyx_t_7 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 415, __pyx_L8_error)
8467                     __Pyx_GOTREF(__pyx_t_7);
8468                     if (__pyx_t_5) {
8469                       __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
8470                     }
8471                     __Pyx_INCREF(__pyx_kp_u_GDAL_data_found_in_package_path);
8472                     __Pyx_GIVEREF(__pyx_kp_u_GDAL_data_found_in_package_path);
8473                     PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_kp_u_GDAL_data_found_in_package_path);
8474                     __Pyx_INCREF(__pyx_v_path);
8475                     __Pyx_GIVEREF(__pyx_v_path);
8476                     PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_v_path);
8477                     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L8_error)
8478                     __Pyx_GOTREF(__pyx_t_3);
8479                     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8480                   }
8481                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8482                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8483 
8484                   /* "fiona/_env.pyx":416
8485  *                         if path:
8486  *                             log.debug("GDAL data found in package: path=%r.", path)
8487  *                             self.update_config_options(GDAL_DATA=path)             # <<<<<<<<<<<<<<
8488  *
8489  *                         # See https://github.com/mapbox/rasterio/issues/1631.
8490  */
8491                   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_config_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L8_error)
8492                   __Pyx_GOTREF(__pyx_t_3);
8493                   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 416, __pyx_L8_error)
8494                   __Pyx_GOTREF(__pyx_t_4);
8495                   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_GDAL_DATA, __pyx_v_path) < 0) __PYX_ERR(0, 416, __pyx_L8_error)
8496                   __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 416, __pyx_L8_error)
8497                   __Pyx_GOTREF(__pyx_t_7);
8498                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8499                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8500                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8501 
8502                   /* "fiona/_env.pyx":414
8503  *                         path = GDALDataFinder().search_wheel()
8504  *
8505  *                         if path:             # <<<<<<<<<<<<<<
8506  *                             log.debug("GDAL data found in package: path=%r.", path)
8507  *                             self.update_config_options(GDAL_DATA=path)
8508  */
8509                   goto __pyx_L16;
8510                 }
8511 
8512                 /* "fiona/_env.pyx":419
8513  *
8514  *                         # See https://github.com/mapbox/rasterio/issues/1631.
8515  *                         elif GDALDataFinder().find_file("header.dxf"):             # <<<<<<<<<<<<<<
8516  *                             log.debug("GDAL data files are available at built-in paths.")
8517  *
8518  */
8519                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_GDALDataFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L8_error)
8520                 __Pyx_GOTREF(__pyx_t_3);
8521                 __pyx_t_5 = NULL;
8522                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8523                   __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
8524                   if (likely(__pyx_t_5)) {
8525                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8526                     __Pyx_INCREF(__pyx_t_5);
8527                     __Pyx_INCREF(function);
8528                     __Pyx_DECREF_SET(__pyx_t_3, function);
8529                   }
8530                 }
8531                 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
8532                 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8533                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L8_error)
8534                 __Pyx_GOTREF(__pyx_t_4);
8535                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8536                 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_find_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L8_error)
8537                 __Pyx_GOTREF(__pyx_t_3);
8538                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8539                 __pyx_t_4 = NULL;
8540                 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
8541                   __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8542                   if (likely(__pyx_t_4)) {
8543                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8544                     __Pyx_INCREF(__pyx_t_4);
8545                     __Pyx_INCREF(function);
8546                     __Pyx_DECREF_SET(__pyx_t_3, function);
8547                   }
8548                 }
8549                 __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_header_dxf) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_header_dxf);
8550                 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8551                 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 419, __pyx_L8_error)
8552                 __Pyx_GOTREF(__pyx_t_7);
8553                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8554                 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 419, __pyx_L8_error)
8555                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8556                 if (__pyx_t_2) {
8557 
8558                   /* "fiona/_env.pyx":420
8559  *                         # See https://github.com/mapbox/rasterio/issues/1631.
8560  *                         elif GDALDataFinder().find_file("header.dxf"):
8561  *                             log.debug("GDAL data files are available at built-in paths.")             # <<<<<<<<<<<<<<
8562  *
8563  *                         else:
8564  */
8565                   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L8_error)
8566                   __Pyx_GOTREF(__pyx_t_3);
8567                   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L8_error)
8568                   __Pyx_GOTREF(__pyx_t_4);
8569                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8570                   __pyx_t_3 = NULL;
8571                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8572                     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
8573                     if (likely(__pyx_t_3)) {
8574                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8575                       __Pyx_INCREF(__pyx_t_3);
8576                       __Pyx_INCREF(function);
8577                       __Pyx_DECREF_SET(__pyx_t_4, function);
8578                     }
8579                   }
8580                   __pyx_t_7 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_GDAL_data_files_are_available_at) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_GDAL_data_files_are_available_at);
8581                   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8582                   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 420, __pyx_L8_error)
8583                   __Pyx_GOTREF(__pyx_t_7);
8584                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8585                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8586 
8587                   /* "fiona/_env.pyx":419
8588  *
8589  *                         # See https://github.com/mapbox/rasterio/issues/1631.
8590  *                         elif GDALDataFinder().find_file("header.dxf"):             # <<<<<<<<<<<<<<
8591  *                             log.debug("GDAL data files are available at built-in paths.")
8592  *
8593  */
8594                   goto __pyx_L16;
8595                 }
8596 
8597                 /* "fiona/_env.pyx":423
8598  *
8599  *                         else:
8600  *                             path = GDALDataFinder().search()             # <<<<<<<<<<<<<<
8601  *
8602  *                             if path:
8603  */
8604                 /*else*/ {
8605                   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_GDALDataFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L8_error)
8606                   __Pyx_GOTREF(__pyx_t_3);
8607                   __pyx_t_5 = NULL;
8608                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8609                     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
8610                     if (likely(__pyx_t_5)) {
8611                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8612                       __Pyx_INCREF(__pyx_t_5);
8613                       __Pyx_INCREF(function);
8614                       __Pyx_DECREF_SET(__pyx_t_3, function);
8615                     }
8616                   }
8617                   __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
8618                   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8619                   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L8_error)
8620                   __Pyx_GOTREF(__pyx_t_4);
8621                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8622                   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L8_error)
8623                   __Pyx_GOTREF(__pyx_t_3);
8624                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8625                   __pyx_t_4 = NULL;
8626                   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
8627                     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8628                     if (likely(__pyx_t_4)) {
8629                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8630                       __Pyx_INCREF(__pyx_t_4);
8631                       __Pyx_INCREF(function);
8632                       __Pyx_DECREF_SET(__pyx_t_3, function);
8633                     }
8634                   }
8635                   __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
8636                   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8637                   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L8_error)
8638                   __Pyx_GOTREF(__pyx_t_7);
8639                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8640                   __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_7);
8641                   __pyx_t_7 = 0;
8642 
8643                   /* "fiona/_env.pyx":425
8644  *                             path = GDALDataFinder().search()
8645  *
8646  *                             if path:             # <<<<<<<<<<<<<<
8647  *                                 log.debug("GDAL data found in other locations: path=%r.", path)
8648  *                                 self.update_config_options(GDAL_DATA=path)
8649  */
8650                   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 425, __pyx_L8_error)
8651                   if (__pyx_t_2) {
8652 
8653                     /* "fiona/_env.pyx":426
8654  *
8655  *                             if path:
8656  *                                 log.debug("GDAL data found in other locations: path=%r.", path)             # <<<<<<<<<<<<<<
8657  *                                 self.update_config_options(GDAL_DATA=path)
8658  *
8659  */
8660                     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L8_error)
8661                     __Pyx_GOTREF(__pyx_t_3);
8662                     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L8_error)
8663                     __Pyx_GOTREF(__pyx_t_4);
8664                     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8665                     __pyx_t_3 = NULL;
8666                     __pyx_t_11 = 0;
8667                     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8668                       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
8669                       if (likely(__pyx_t_3)) {
8670                         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8671                         __Pyx_INCREF(__pyx_t_3);
8672                         __Pyx_INCREF(function);
8673                         __Pyx_DECREF_SET(__pyx_t_4, function);
8674                         __pyx_t_11 = 1;
8675                       }
8676                     }
8677                     #if CYTHON_FAST_PYCALL
8678                     if (PyFunction_Check(__pyx_t_4)) {
8679                       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_GDAL_data_found_in_other_locatio, __pyx_v_path};
8680                       __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L8_error)
8681                       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8682                       __Pyx_GOTREF(__pyx_t_7);
8683                     } else
8684                     #endif
8685                     #if CYTHON_FAST_PYCCALL
8686                     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
8687                       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_GDAL_data_found_in_other_locatio, __pyx_v_path};
8688                       __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L8_error)
8689                       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8690                       __Pyx_GOTREF(__pyx_t_7);
8691                     } else
8692                     #endif
8693                     {
8694                       __pyx_t_5 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L8_error)
8695                       __Pyx_GOTREF(__pyx_t_5);
8696                       if (__pyx_t_3) {
8697                         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
8698                       }
8699                       __Pyx_INCREF(__pyx_kp_u_GDAL_data_found_in_other_locatio);
8700                       __Pyx_GIVEREF(__pyx_kp_u_GDAL_data_found_in_other_locatio);
8701                       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_kp_u_GDAL_data_found_in_other_locatio);
8702                       __Pyx_INCREF(__pyx_v_path);
8703                       __Pyx_GIVEREF(__pyx_v_path);
8704                       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_path);
8705                       __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L8_error)
8706                       __Pyx_GOTREF(__pyx_t_7);
8707                       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8708                     }
8709                     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8710                     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8711 
8712                     /* "fiona/_env.pyx":427
8713  *                             if path:
8714  *                                 log.debug("GDAL data found in other locations: path=%r.", path)
8715  *                                 self.update_config_options(GDAL_DATA=path)             # <<<<<<<<<<<<<<
8716  *
8717  *                     if 'PROJ_LIB' in os.environ:
8718  */
8719                     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_config_options); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L8_error)
8720                     __Pyx_GOTREF(__pyx_t_7);
8721                     __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L8_error)
8722                     __Pyx_GOTREF(__pyx_t_4);
8723                     if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_GDAL_DATA, __pyx_v_path) < 0) __PYX_ERR(0, 427, __pyx_L8_error)
8724                     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L8_error)
8725                     __Pyx_GOTREF(__pyx_t_5);
8726                     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8727                     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8728                     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8729 
8730                     /* "fiona/_env.pyx":425
8731  *                             path = GDALDataFinder().search()
8732  *
8733  *                             if path:             # <<<<<<<<<<<<<<
8734  *                                 log.debug("GDAL data found in other locations: path=%r.", path)
8735  *                                 self.update_config_options(GDAL_DATA=path)
8736  */
8737                   }
8738                 }
8739                 __pyx_L16:;
8740               }
8741               __pyx_L15:;
8742 
8743               /* "fiona/_env.pyx":429
8744  *                                 self.update_config_options(GDAL_DATA=path)
8745  *
8746  *                     if 'PROJ_LIB' in os.environ:             # <<<<<<<<<<<<<<
8747  *                         log.debug("PROJ_LIB found in environment.")
8748  *                         path = os.environ["PROJ_LIB"]
8749  */
8750               __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L8_error)
8751               __Pyx_GOTREF(__pyx_t_5);
8752               __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_environ); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L8_error)
8753               __Pyx_GOTREF(__pyx_t_4);
8754               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8755               __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_PROJ_LIB, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 429, __pyx_L8_error)
8756               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8757               __pyx_t_1 = (__pyx_t_2 != 0);
8758               if (__pyx_t_1) {
8759 
8760                 /* "fiona/_env.pyx":430
8761  *
8762  *                     if 'PROJ_LIB' in os.environ:
8763  *                         log.debug("PROJ_LIB found in environment.")             # <<<<<<<<<<<<<<
8764  *                         path = os.environ["PROJ_LIB"]
8765  *                         set_proj_data_search_path(path)
8766  */
8767                 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L8_error)
8768                 __Pyx_GOTREF(__pyx_t_5);
8769                 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L8_error)
8770                 __Pyx_GOTREF(__pyx_t_7);
8771                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8772                 __pyx_t_5 = NULL;
8773                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
8774                   __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
8775                   if (likely(__pyx_t_5)) {
8776                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8777                     __Pyx_INCREF(__pyx_t_5);
8778                     __Pyx_INCREF(function);
8779                     __Pyx_DECREF_SET(__pyx_t_7, function);
8780                   }
8781                 }
8782                 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_kp_u_PROJ_LIB_found_in_environment) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_u_PROJ_LIB_found_in_environment);
8783                 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8784                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L8_error)
8785                 __Pyx_GOTREF(__pyx_t_4);
8786                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8787                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8788 
8789                 /* "fiona/_env.pyx":431
8790  *                     if 'PROJ_LIB' in os.environ:
8791  *                         log.debug("PROJ_LIB found in environment.")
8792  *                         path = os.environ["PROJ_LIB"]             # <<<<<<<<<<<<<<
8793  *                         set_proj_data_search_path(path)
8794  *
8795  */
8796                 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L8_error)
8797                 __Pyx_GOTREF(__pyx_t_4);
8798                 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_environ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L8_error)
8799                 __Pyx_GOTREF(__pyx_t_7);
8800                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8801                 __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_n_u_PROJ_LIB); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L8_error)
8802                 __Pyx_GOTREF(__pyx_t_4);
8803                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8804                 __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_4);
8805                 __pyx_t_4 = 0;
8806 
8807                 /* "fiona/_env.pyx":432
8808  *                         log.debug("PROJ_LIB found in environment.")
8809  *                         path = os.environ["PROJ_LIB"]
8810  *                         set_proj_data_search_path(path)             # <<<<<<<<<<<<<<
8811  *
8812  *                     else:
8813  */
8814                 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_set_proj_data_search_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L8_error)
8815                 __Pyx_GOTREF(__pyx_t_7);
8816                 __pyx_t_5 = NULL;
8817                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
8818                   __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
8819                   if (likely(__pyx_t_5)) {
8820                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8821                     __Pyx_INCREF(__pyx_t_5);
8822                     __Pyx_INCREF(function);
8823                     __Pyx_DECREF_SET(__pyx_t_7, function);
8824                   }
8825                 }
8826                 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_path);
8827                 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8828                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L8_error)
8829                 __Pyx_GOTREF(__pyx_t_4);
8830                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8831                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8832 
8833                 /* "fiona/_env.pyx":429
8834  *                                 self.update_config_options(GDAL_DATA=path)
8835  *
8836  *                     if 'PROJ_LIB' in os.environ:             # <<<<<<<<<<<<<<
8837  *                         log.debug("PROJ_LIB found in environment.")
8838  *                         path = os.environ["PROJ_LIB"]
8839  */
8840                 goto __pyx_L18;
8841               }
8842 
8843               /* "fiona/_env.pyx":435
8844  *
8845  *                     else:
8846  *                         path = PROJDataFinder().search_wheel()             # <<<<<<<<<<<<<<
8847  *
8848  *                         if path:
8849  */
8850               /*else*/ {
8851                 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PROJDataFinder); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L8_error)
8852                 __Pyx_GOTREF(__pyx_t_5);
8853                 __pyx_t_3 = NULL;
8854                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8855                   __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
8856                   if (likely(__pyx_t_3)) {
8857                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8858                     __Pyx_INCREF(__pyx_t_3);
8859                     __Pyx_INCREF(function);
8860                     __Pyx_DECREF_SET(__pyx_t_5, function);
8861                   }
8862                 }
8863                 __pyx_t_7 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8864                 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8865                 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L8_error)
8866                 __Pyx_GOTREF(__pyx_t_7);
8867                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8868                 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_search_wheel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L8_error)
8869                 __Pyx_GOTREF(__pyx_t_5);
8870                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8871                 __pyx_t_7 = NULL;
8872                 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8873                   __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
8874                   if (likely(__pyx_t_7)) {
8875                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8876                     __Pyx_INCREF(__pyx_t_7);
8877                     __Pyx_INCREF(function);
8878                     __Pyx_DECREF_SET(__pyx_t_5, function);
8879                   }
8880                 }
8881                 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8882                 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8883                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L8_error)
8884                 __Pyx_GOTREF(__pyx_t_4);
8885                 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8886                 __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_4);
8887                 __pyx_t_4 = 0;
8888 
8889                 /* "fiona/_env.pyx":437
8890  *                         path = PROJDataFinder().search_wheel()
8891  *
8892  *                         if path:             # <<<<<<<<<<<<<<
8893  *                             log.debug("PROJ data found in package: path=%r.", path)
8894  *                             set_proj_data_search_path(path)
8895  */
8896                 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 437, __pyx_L8_error)
8897                 if (__pyx_t_1) {
8898 
8899                   /* "fiona/_env.pyx":438
8900  *
8901  *                         if path:
8902  *                             log.debug("PROJ data found in package: path=%r.", path)             # <<<<<<<<<<<<<<
8903  *                             set_proj_data_search_path(path)
8904  *
8905  */
8906                   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L8_error)
8907                   __Pyx_GOTREF(__pyx_t_5);
8908                   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L8_error)
8909                   __Pyx_GOTREF(__pyx_t_7);
8910                   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8911                   __pyx_t_5 = NULL;
8912                   __pyx_t_11 = 0;
8913                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
8914                     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
8915                     if (likely(__pyx_t_5)) {
8916                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8917                       __Pyx_INCREF(__pyx_t_5);
8918                       __Pyx_INCREF(function);
8919                       __Pyx_DECREF_SET(__pyx_t_7, function);
8920                       __pyx_t_11 = 1;
8921                     }
8922                   }
8923                   #if CYTHON_FAST_PYCALL
8924                   if (PyFunction_Check(__pyx_t_7)) {
8925                     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_PROJ_data_found_in_package_path, __pyx_v_path};
8926                     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L8_error)
8927                     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8928                     __Pyx_GOTREF(__pyx_t_4);
8929                   } else
8930                   #endif
8931                   #if CYTHON_FAST_PYCCALL
8932                   if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
8933                     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_PROJ_data_found_in_package_path, __pyx_v_path};
8934                     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L8_error)
8935                     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8936                     __Pyx_GOTREF(__pyx_t_4);
8937                   } else
8938                   #endif
8939                   {
8940                     __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L8_error)
8941                     __Pyx_GOTREF(__pyx_t_3);
8942                     if (__pyx_t_5) {
8943                       __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
8944                     }
8945                     __Pyx_INCREF(__pyx_kp_u_PROJ_data_found_in_package_path);
8946                     __Pyx_GIVEREF(__pyx_kp_u_PROJ_data_found_in_package_path);
8947                     PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_kp_u_PROJ_data_found_in_package_path);
8948                     __Pyx_INCREF(__pyx_v_path);
8949                     __Pyx_GIVEREF(__pyx_v_path);
8950                     PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_path);
8951                     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L8_error)
8952                     __Pyx_GOTREF(__pyx_t_4);
8953                     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8954                   }
8955                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8956                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8957 
8958                   /* "fiona/_env.pyx":439
8959  *                         if path:
8960  *                             log.debug("PROJ data found in package: path=%r.", path)
8961  *                             set_proj_data_search_path(path)             # <<<<<<<<<<<<<<
8962  *
8963  *                         elif PROJDataFinder().has_data():
8964  */
8965                   __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_set_proj_data_search_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L8_error)
8966                   __Pyx_GOTREF(__pyx_t_7);
8967                   __pyx_t_3 = NULL;
8968                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
8969                     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
8970                     if (likely(__pyx_t_3)) {
8971                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8972                       __Pyx_INCREF(__pyx_t_3);
8973                       __Pyx_INCREF(function);
8974                       __Pyx_DECREF_SET(__pyx_t_7, function);
8975                     }
8976                   }
8977                   __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_path);
8978                   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8979                   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L8_error)
8980                   __Pyx_GOTREF(__pyx_t_4);
8981                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8982                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8983 
8984                   /* "fiona/_env.pyx":437
8985  *                         path = PROJDataFinder().search_wheel()
8986  *
8987  *                         if path:             # <<<<<<<<<<<<<<
8988  *                             log.debug("PROJ data found in package: path=%r.", path)
8989  *                             set_proj_data_search_path(path)
8990  */
8991                   goto __pyx_L19;
8992                 }
8993 
8994                 /* "fiona/_env.pyx":441
8995  *                             set_proj_data_search_path(path)
8996  *
8997  *                         elif PROJDataFinder().has_data():             # <<<<<<<<<<<<<<
8998  *                             log.debug("PROJ data files are available at built-in paths.")
8999  *
9000  */
9001                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PROJDataFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L8_error)
9002                 __Pyx_GOTREF(__pyx_t_3);
9003                 __pyx_t_5 = NULL;
9004                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9005                   __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
9006                   if (likely(__pyx_t_5)) {
9007                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9008                     __Pyx_INCREF(__pyx_t_5);
9009                     __Pyx_INCREF(function);
9010                     __Pyx_DECREF_SET(__pyx_t_3, function);
9011                   }
9012                 }
9013                 __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9014                 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9015                 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L8_error)
9016                 __Pyx_GOTREF(__pyx_t_7);
9017                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9018                 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_has_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L8_error)
9019                 __Pyx_GOTREF(__pyx_t_3);
9020                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9021                 __pyx_t_7 = NULL;
9022                 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9023                   __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
9024                   if (likely(__pyx_t_7)) {
9025                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9026                     __Pyx_INCREF(__pyx_t_7);
9027                     __Pyx_INCREF(function);
9028                     __Pyx_DECREF_SET(__pyx_t_3, function);
9029                   }
9030                 }
9031                 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9032                 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9033                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L8_error)
9034                 __Pyx_GOTREF(__pyx_t_4);
9035                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9036                 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 441, __pyx_L8_error)
9037                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9038                 if (__pyx_t_1) {
9039 
9040                   /* "fiona/_env.pyx":442
9041  *
9042  *                         elif PROJDataFinder().has_data():
9043  *                             log.debug("PROJ data files are available at built-in paths.")             # <<<<<<<<<<<<<<
9044  *
9045  *                         else:
9046  */
9047                   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L8_error)
9048                   __Pyx_GOTREF(__pyx_t_3);
9049                   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 442, __pyx_L8_error)
9050                   __Pyx_GOTREF(__pyx_t_7);
9051                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9052                   __pyx_t_3 = NULL;
9053                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9054                     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
9055                     if (likely(__pyx_t_3)) {
9056                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9057                       __Pyx_INCREF(__pyx_t_3);
9058                       __Pyx_INCREF(function);
9059                       __Pyx_DECREF_SET(__pyx_t_7, function);
9060                     }
9061                   }
9062                   __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_kp_u_PROJ_data_files_are_available_at) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_u_PROJ_data_files_are_available_at);
9063                   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9064                   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 442, __pyx_L8_error)
9065                   __Pyx_GOTREF(__pyx_t_4);
9066                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9067                   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9068 
9069                   /* "fiona/_env.pyx":441
9070  *                             set_proj_data_search_path(path)
9071  *
9072  *                         elif PROJDataFinder().has_data():             # <<<<<<<<<<<<<<
9073  *                             log.debug("PROJ data files are available at built-in paths.")
9074  *
9075  */
9076                   goto __pyx_L19;
9077                 }
9078 
9079                 /* "fiona/_env.pyx":445
9080  *
9081  *                         else:
9082  *                             path = PROJDataFinder().search()             # <<<<<<<<<<<<<<
9083  *
9084  *                             if path:
9085  */
9086                 /*else*/ {
9087                   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PROJDataFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L8_error)
9088                   __Pyx_GOTREF(__pyx_t_3);
9089                   __pyx_t_5 = NULL;
9090                   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9091                     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
9092                     if (likely(__pyx_t_5)) {
9093                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9094                       __Pyx_INCREF(__pyx_t_5);
9095                       __Pyx_INCREF(function);
9096                       __Pyx_DECREF_SET(__pyx_t_3, function);
9097                     }
9098                   }
9099                   __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9100                   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9101                   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L8_error)
9102                   __Pyx_GOTREF(__pyx_t_7);
9103                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9104                   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L8_error)
9105                   __Pyx_GOTREF(__pyx_t_3);
9106                   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9107                   __pyx_t_7 = NULL;
9108                   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9109                     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
9110                     if (likely(__pyx_t_7)) {
9111                       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9112                       __Pyx_INCREF(__pyx_t_7);
9113                       __Pyx_INCREF(function);
9114                       __Pyx_DECREF_SET(__pyx_t_3, function);
9115                     }
9116                   }
9117                   __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9118                   __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9119                   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L8_error)
9120                   __Pyx_GOTREF(__pyx_t_4);
9121                   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9122                   __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_4);
9123                   __pyx_t_4 = 0;
9124 
9125                   /* "fiona/_env.pyx":447
9126  *                             path = PROJDataFinder().search()
9127  *
9128  *                             if path:             # <<<<<<<<<<<<<<
9129  *                                 log.debug("PROJ data found in other locations: path=%r.", path)
9130  *                                 set_proj_data_search_path(path)
9131  */
9132                   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 447, __pyx_L8_error)
9133                   if (__pyx_t_1) {
9134 
9135                     /* "fiona/_env.pyx":448
9136  *
9137  *                             if path:
9138  *                                 log.debug("PROJ data found in other locations: path=%r.", path)             # <<<<<<<<<<<<<<
9139  *                                 set_proj_data_search_path(path)
9140  *
9141  */
9142                     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L8_error)
9143                     __Pyx_GOTREF(__pyx_t_3);
9144                     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L8_error)
9145                     __Pyx_GOTREF(__pyx_t_7);
9146                     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9147                     __pyx_t_3 = NULL;
9148                     __pyx_t_11 = 0;
9149                     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9150                       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
9151                       if (likely(__pyx_t_3)) {
9152                         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9153                         __Pyx_INCREF(__pyx_t_3);
9154                         __Pyx_INCREF(function);
9155                         __Pyx_DECREF_SET(__pyx_t_7, function);
9156                         __pyx_t_11 = 1;
9157                       }
9158                     }
9159                     #if CYTHON_FAST_PYCALL
9160                     if (PyFunction_Check(__pyx_t_7)) {
9161                       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_PROJ_data_found_in_other_locatio, __pyx_v_path};
9162                       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L8_error)
9163                       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9164                       __Pyx_GOTREF(__pyx_t_4);
9165                     } else
9166                     #endif
9167                     #if CYTHON_FAST_PYCCALL
9168                     if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9169                       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_PROJ_data_found_in_other_locatio, __pyx_v_path};
9170                       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L8_error)
9171                       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9172                       __Pyx_GOTREF(__pyx_t_4);
9173                     } else
9174                     #endif
9175                     {
9176                       __pyx_t_5 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L8_error)
9177                       __Pyx_GOTREF(__pyx_t_5);
9178                       if (__pyx_t_3) {
9179                         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
9180                       }
9181                       __Pyx_INCREF(__pyx_kp_u_PROJ_data_found_in_other_locatio);
9182                       __Pyx_GIVEREF(__pyx_kp_u_PROJ_data_found_in_other_locatio);
9183                       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_kp_u_PROJ_data_found_in_other_locatio);
9184                       __Pyx_INCREF(__pyx_v_path);
9185                       __Pyx_GIVEREF(__pyx_v_path);
9186                       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_path);
9187                       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L8_error)
9188                       __Pyx_GOTREF(__pyx_t_4);
9189                       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9190                     }
9191                     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9192                     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9193 
9194                     /* "fiona/_env.pyx":449
9195  *                             if path:
9196  *                                 log.debug("PROJ data found in other locations: path=%r.", path)
9197  *                                 set_proj_data_search_path(path)             # <<<<<<<<<<<<<<
9198  *
9199  *                     if driver_count() == 0:
9200  */
9201                     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_set_proj_data_search_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L8_error)
9202                     __Pyx_GOTREF(__pyx_t_7);
9203                     __pyx_t_5 = NULL;
9204                     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9205                       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
9206                       if (likely(__pyx_t_5)) {
9207                         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9208                         __Pyx_INCREF(__pyx_t_5);
9209                         __Pyx_INCREF(function);
9210                         __Pyx_DECREF_SET(__pyx_t_7, function);
9211                       }
9212                     }
9213                     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_path);
9214                     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9215                     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L8_error)
9216                     __Pyx_GOTREF(__pyx_t_4);
9217                     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9218                     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9219 
9220                     /* "fiona/_env.pyx":447
9221  *                             path = PROJDataFinder().search()
9222  *
9223  *                             if path:             # <<<<<<<<<<<<<<
9224  *                                 log.debug("PROJ data found in other locations: path=%r.", path)
9225  *                                 set_proj_data_search_path(path)
9226  */
9227                   }
9228                 }
9229                 __pyx_L19:;
9230               }
9231               __pyx_L18:;
9232 
9233               /* "fiona/_env.pyx":451
9234  *                                 set_proj_data_search_path(path)
9235  *
9236  *                     if driver_count() == 0:             # <<<<<<<<<<<<<<
9237  *                         CPLPopErrorHandler()
9238  *                         raise ValueError("Drivers not registered.")
9239  */
9240               __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_driver_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L8_error)
9241               __Pyx_GOTREF(__pyx_t_7);
9242               __pyx_t_5 = NULL;
9243               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9244                 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
9245                 if (likely(__pyx_t_5)) {
9246                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9247                   __Pyx_INCREF(__pyx_t_5);
9248                   __Pyx_INCREF(function);
9249                   __Pyx_DECREF_SET(__pyx_t_7, function);
9250                 }
9251               }
9252               __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
9253               __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9254               if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L8_error)
9255               __Pyx_GOTREF(__pyx_t_4);
9256               __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9257               __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L8_error)
9258               __Pyx_GOTREF(__pyx_t_7);
9259               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9260               __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 451, __pyx_L8_error)
9261               __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9262               if (unlikely(__pyx_t_1)) {
9263 
9264                 /* "fiona/_env.pyx":452
9265  *
9266  *                     if driver_count() == 0:
9267  *                         CPLPopErrorHandler()             # <<<<<<<<<<<<<<
9268  *                         raise ValueError("Drivers not registered.")
9269  *
9270  */
9271                 CPLPopErrorHandler();
9272 
9273                 /* "fiona/_env.pyx":453
9274  *                     if driver_count() == 0:
9275  *                         CPLPopErrorHandler()
9276  *                         raise ValueError("Drivers not registered.")             # <<<<<<<<<<<<<<
9277  *
9278  *                     # Flag the drivers as registered, otherwise every thread
9279  */
9280                 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L8_error)
9281                 __Pyx_GOTREF(__pyx_t_7);
9282                 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
9283                 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9284                 __PYX_ERR(0, 453, __pyx_L8_error)
9285 
9286                 /* "fiona/_env.pyx":451
9287  *                                 set_proj_data_search_path(path)
9288  *
9289  *                     if driver_count() == 0:             # <<<<<<<<<<<<<<
9290  *                         CPLPopErrorHandler()
9291  *                         raise ValueError("Drivers not registered.")
9292  */
9293               }
9294 
9295               /* "fiona/_env.pyx":459
9296  *                     # is started rather than just whenever the first thread
9297  *                     # actually makes it this far.
9298  *                     self._have_registered_drivers = True             # <<<<<<<<<<<<<<
9299  *
9300  *         log.debug("Started GDALEnv: self=%r.", self)
9301  */
9302               __Pyx_INCREF(Py_True);
9303               __Pyx_GIVEREF(Py_True);
9304               __Pyx_GOTREF(__pyx_v_self->_have_registered_drivers);
9305               __Pyx_DECREF(__pyx_v_self->_have_registered_drivers);
9306               __pyx_v_self->_have_registered_drivers = Py_True;
9307 
9308               /* "fiona/_env.pyx":402
9309  *         if not self._have_registered_drivers:
9310  *             with threading.Lock():
9311  *                 if not self._have_registered_drivers:             # <<<<<<<<<<<<<<
9312  *
9313  *                     GDALAllRegister()
9314  */
9315             }
9316 
9317             /* "fiona/_env.pyx":401
9318  *         # potential race condition.
9319  *         if not self._have_registered_drivers:
9320  *             with threading.Lock():             # <<<<<<<<<<<<<<
9321  *                 if not self._have_registered_drivers:
9322  *
9323  */
9324           }
9325           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9326           __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9327           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9328           goto __pyx_L13_try_end;
9329           __pyx_L8_error:;
9330           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9331           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9332           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9333           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9334           /*except:*/ {
9335             __Pyx_AddTraceback("fiona._env.GDALEnv.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
9336             if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 401, __pyx_L10_except_error)
9337             __Pyx_GOTREF(__pyx_t_7);
9338             __Pyx_GOTREF(__pyx_t_4);
9339             __Pyx_GOTREF(__pyx_t_5);
9340             __pyx_t_3 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L10_except_error)
9341             __Pyx_GOTREF(__pyx_t_3);
9342             __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL);
9343             __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9344             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9345             if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 401, __pyx_L10_except_error)
9346             __Pyx_GOTREF(__pyx_t_12);
9347             __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12);
9348             __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
9349             if (__pyx_t_1 < 0) __PYX_ERR(0, 401, __pyx_L10_except_error)
9350             __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
9351             if (__pyx_t_2) {
9352               __Pyx_GIVEREF(__pyx_t_7);
9353               __Pyx_GIVEREF(__pyx_t_4);
9354               __Pyx_XGIVEREF(__pyx_t_5);
9355               __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_4, __pyx_t_5);
9356               __pyx_t_7 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0;
9357               __PYX_ERR(0, 401, __pyx_L10_except_error)
9358             }
9359             __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9360             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9361             __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9362             goto __pyx_L9_exception_handled;
9363           }
9364           __pyx_L10_except_error:;
9365           __Pyx_XGIVEREF(__pyx_t_8);
9366           __Pyx_XGIVEREF(__pyx_t_9);
9367           __Pyx_XGIVEREF(__pyx_t_10);
9368           __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
9369           goto __pyx_L1_error;
9370           __pyx_L9_exception_handled:;
9371           __Pyx_XGIVEREF(__pyx_t_8);
9372           __Pyx_XGIVEREF(__pyx_t_9);
9373           __Pyx_XGIVEREF(__pyx_t_10);
9374           __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
9375           __pyx_L13_try_end:;
9376         }
9377       }
9378       /*finally:*/ {
9379         /*normal exit:*/{
9380           if (__pyx_t_6) {
9381             __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__7, NULL);
9382             __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9383             if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 401, __pyx_L1_error)
9384             __Pyx_GOTREF(__pyx_t_10);
9385             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9386           }
9387           goto __pyx_L7;
9388         }
9389         __pyx_L7:;
9390       }
9391       goto __pyx_L25;
9392       __pyx_L4_error:;
9393       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9394       goto __pyx_L1_error;
9395       __pyx_L25:;
9396     }
9397 
9398     /* "fiona/_env.pyx":400
9399  *         # lock when the environment starts, and the inner avoids a
9400  *         # potential race condition.
9401  *         if not self._have_registered_drivers:             # <<<<<<<<<<<<<<
9402  *             with threading.Lock():
9403  *                 if not self._have_registered_drivers:
9404  */
9405   }
9406 
9407   /* "fiona/_env.pyx":461
9408  *                     self._have_registered_drivers = True
9409  *
9410  *         log.debug("Started GDALEnv: self=%r.", self)             # <<<<<<<<<<<<<<
9411  *
9412  *     def stop(self):
9413  */
9414   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
9415   __Pyx_GOTREF(__pyx_t_4);
9416   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 461, __pyx_L1_error)
9417   __Pyx_GOTREF(__pyx_t_7);
9418   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9419   __pyx_t_4 = NULL;
9420   __pyx_t_11 = 0;
9421   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9422     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9423     if (likely(__pyx_t_4)) {
9424       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9425       __Pyx_INCREF(__pyx_t_4);
9426       __Pyx_INCREF(function);
9427       __Pyx_DECREF_SET(__pyx_t_7, function);
9428       __pyx_t_11 = 1;
9429     }
9430   }
9431   #if CYTHON_FAST_PYCALL
9432   if (PyFunction_Check(__pyx_t_7)) {
9433     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Started_GDALEnv_self_r, ((PyObject *)__pyx_v_self)};
9434     __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error)
9435     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9436     __Pyx_GOTREF(__pyx_t_5);
9437   } else
9438   #endif
9439   #if CYTHON_FAST_PYCCALL
9440   if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9441     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Started_GDALEnv_self_r, ((PyObject *)__pyx_v_self)};
9442     __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error)
9443     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9444     __Pyx_GOTREF(__pyx_t_5);
9445   } else
9446   #endif
9447   {
9448     __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
9449     __Pyx_GOTREF(__pyx_t_3);
9450     if (__pyx_t_4) {
9451       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
9452     }
9453     __Pyx_INCREF(__pyx_kp_u_Started_GDALEnv_self_r);
9454     __Pyx_GIVEREF(__pyx_kp_u_Started_GDALEnv_self_r);
9455     PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_kp_u_Started_GDALEnv_self_r);
9456     __Pyx_INCREF(((PyObject *)__pyx_v_self));
9457     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9458     PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, ((PyObject *)__pyx_v_self));
9459     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error)
9460     __Pyx_GOTREF(__pyx_t_5);
9461     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9462   }
9463   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9464   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9465 
9466   /* "fiona/_env.pyx":394
9467  *         self._have_registered_drivers = False
9468  *
9469  *     def start(self):             # <<<<<<<<<<<<<<
9470  *         CPLPushErrorHandler(<CPLErrorHandler>logging_error_handler)
9471  *
9472  */
9473 
9474   /* function exit code */
9475   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9476   goto __pyx_L0;
9477   __pyx_L1_error:;
9478   __Pyx_XDECREF(__pyx_t_3);
9479   __Pyx_XDECREF(__pyx_t_4);
9480   __Pyx_XDECREF(__pyx_t_5);
9481   __Pyx_XDECREF(__pyx_t_7);
9482   __Pyx_AddTraceback("fiona._env.GDALEnv.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
9483   __pyx_r = NULL;
9484   __pyx_L0:;
9485   __Pyx_XDECREF(__pyx_v_path);
9486   __Pyx_XGIVEREF(__pyx_r);
9487   __Pyx_RefNannyFinishContext();
9488   return __pyx_r;
9489 }
9490 
9491 /* "fiona/_env.pyx":463
9492  *         log.debug("Started GDALEnv: self=%r.", self)
9493  *
9494  *     def stop(self):             # <<<<<<<<<<<<<<
9495  *         # NB: do not restore the CPL error handler to its default
9496  *         # state here. If you do, log messages will be written to stderr
9497  */
9498 
9499 /* Python wrapper */
9500 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_5stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_5stop(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9501 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_5stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9502   PyObject *__pyx_r = 0;
9503   __Pyx_RefNannyDeclarations
9504   __Pyx_RefNannySetupContext("stop (wrapper)", 0);
9505   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_4stop(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
9506 
9507   /* function exit code */
9508   __Pyx_RefNannyFinishContext();
9509   return __pyx_r;
9510 }
9511 
__pyx_pf_5fiona_4_env_7GDALEnv_4stop(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)9512 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_4stop(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
9513   PyObject *__pyx_r = NULL;
9514   __Pyx_RefNannyDeclarations
9515   PyObject *__pyx_t_1 = NULL;
9516   PyObject *__pyx_t_2 = NULL;
9517   PyObject *__pyx_t_3 = NULL;
9518   int __pyx_t_4;
9519   PyObject *__pyx_t_5 = NULL;
9520   int __pyx_lineno = 0;
9521   const char *__pyx_filename = NULL;
9522   int __pyx_clineno = 0;
9523   __Pyx_RefNannySetupContext("stop", 0);
9524 
9525   /* "fiona/_env.pyx":467
9526  *         # state here. If you do, log messages will be written to stderr
9527  *         # by GDAL instead of being sent to Python's logging module.
9528  *         log.debug("Stopping GDALEnv %r.", self)             # <<<<<<<<<<<<<<
9529  *         CPLPopErrorHandler()
9530  *         log.debug("Error handler popped.")
9531  */
9532   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
9533   __Pyx_GOTREF(__pyx_t_2);
9534   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error)
9535   __Pyx_GOTREF(__pyx_t_3);
9536   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9537   __pyx_t_2 = NULL;
9538   __pyx_t_4 = 0;
9539   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9540     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
9541     if (likely(__pyx_t_2)) {
9542       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9543       __Pyx_INCREF(__pyx_t_2);
9544       __Pyx_INCREF(function);
9545       __Pyx_DECREF_SET(__pyx_t_3, function);
9546       __pyx_t_4 = 1;
9547     }
9548   }
9549   #if CYTHON_FAST_PYCALL
9550   if (PyFunction_Check(__pyx_t_3)) {
9551     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Stopping_GDALEnv_r, ((PyObject *)__pyx_v_self)};
9552     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
9553     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9554     __Pyx_GOTREF(__pyx_t_1);
9555   } else
9556   #endif
9557   #if CYTHON_FAST_PYCCALL
9558   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9559     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Stopping_GDALEnv_r, ((PyObject *)__pyx_v_self)};
9560     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
9561     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9562     __Pyx_GOTREF(__pyx_t_1);
9563   } else
9564   #endif
9565   {
9566     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 467, __pyx_L1_error)
9567     __Pyx_GOTREF(__pyx_t_5);
9568     if (__pyx_t_2) {
9569       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
9570     }
9571     __Pyx_INCREF(__pyx_kp_u_Stopping_GDALEnv_r);
9572     __Pyx_GIVEREF(__pyx_kp_u_Stopping_GDALEnv_r);
9573     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_u_Stopping_GDALEnv_r);
9574     __Pyx_INCREF(((PyObject *)__pyx_v_self));
9575     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9576     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_self));
9577     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
9578     __Pyx_GOTREF(__pyx_t_1);
9579     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9580   }
9581   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9582   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9583 
9584   /* "fiona/_env.pyx":468
9585  *         # by GDAL instead of being sent to Python's logging module.
9586  *         log.debug("Stopping GDALEnv %r.", self)
9587  *         CPLPopErrorHandler()             # <<<<<<<<<<<<<<
9588  *         log.debug("Error handler popped.")
9589  *         log.debug("Stopped GDALEnv %r.", self)
9590  */
9591   CPLPopErrorHandler();
9592 
9593   /* "fiona/_env.pyx":469
9594  *         log.debug("Stopping GDALEnv %r.", self)
9595  *         CPLPopErrorHandler()
9596  *         log.debug("Error handler popped.")             # <<<<<<<<<<<<<<
9597  *         log.debug("Stopped GDALEnv %r.", self)
9598  *
9599  */
9600   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error)
9601   __Pyx_GOTREF(__pyx_t_3);
9602   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __pyx_L1_error)
9603   __Pyx_GOTREF(__pyx_t_5);
9604   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9605   __pyx_t_3 = NULL;
9606   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9607     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
9608     if (likely(__pyx_t_3)) {
9609       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9610       __Pyx_INCREF(__pyx_t_3);
9611       __Pyx_INCREF(function);
9612       __Pyx_DECREF_SET(__pyx_t_5, function);
9613     }
9614   }
9615   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_u_Error_handler_popped) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_Error_handler_popped);
9616   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9617   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
9618   __Pyx_GOTREF(__pyx_t_1);
9619   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9620   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9621 
9622   /* "fiona/_env.pyx":470
9623  *         CPLPopErrorHandler()
9624  *         log.debug("Error handler popped.")
9625  *         log.debug("Stopped GDALEnv %r.", self)             # <<<<<<<<<<<<<<
9626  *
9627  *     def drivers(self):
9628  */
9629   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error)
9630   __Pyx_GOTREF(__pyx_t_5);
9631   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
9632   __Pyx_GOTREF(__pyx_t_3);
9633   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9634   __pyx_t_5 = NULL;
9635   __pyx_t_4 = 0;
9636   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9637     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
9638     if (likely(__pyx_t_5)) {
9639       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9640       __Pyx_INCREF(__pyx_t_5);
9641       __Pyx_INCREF(function);
9642       __Pyx_DECREF_SET(__pyx_t_3, function);
9643       __pyx_t_4 = 1;
9644     }
9645   }
9646   #if CYTHON_FAST_PYCALL
9647   if (PyFunction_Check(__pyx_t_3)) {
9648     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Stopped_GDALEnv_r, ((PyObject *)__pyx_v_self)};
9649     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
9650     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9651     __Pyx_GOTREF(__pyx_t_1);
9652   } else
9653   #endif
9654   #if CYTHON_FAST_PYCCALL
9655   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9656     PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Stopped_GDALEnv_r, ((PyObject *)__pyx_v_self)};
9657     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
9658     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9659     __Pyx_GOTREF(__pyx_t_1);
9660   } else
9661   #endif
9662   {
9663     __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
9664     __Pyx_GOTREF(__pyx_t_2);
9665     if (__pyx_t_5) {
9666       __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
9667     }
9668     __Pyx_INCREF(__pyx_kp_u_Stopped_GDALEnv_r);
9669     __Pyx_GIVEREF(__pyx_kp_u_Stopped_GDALEnv_r);
9670     PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_kp_u_Stopped_GDALEnv_r);
9671     __Pyx_INCREF(((PyObject *)__pyx_v_self));
9672     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9673     PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, ((PyObject *)__pyx_v_self));
9674     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
9675     __Pyx_GOTREF(__pyx_t_1);
9676     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9677   }
9678   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9679   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9680 
9681   /* "fiona/_env.pyx":463
9682  *         log.debug("Started GDALEnv: self=%r.", self)
9683  *
9684  *     def stop(self):             # <<<<<<<<<<<<<<
9685  *         # NB: do not restore the CPL error handler to its default
9686  *         # state here. If you do, log messages will be written to stderr
9687  */
9688 
9689   /* function exit code */
9690   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9691   goto __pyx_L0;
9692   __pyx_L1_error:;
9693   __Pyx_XDECREF(__pyx_t_1);
9694   __Pyx_XDECREF(__pyx_t_2);
9695   __Pyx_XDECREF(__pyx_t_3);
9696   __Pyx_XDECREF(__pyx_t_5);
9697   __Pyx_AddTraceback("fiona._env.GDALEnv.stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
9698   __pyx_r = NULL;
9699   __pyx_L0:;
9700   __Pyx_XGIVEREF(__pyx_r);
9701   __Pyx_RefNannyFinishContext();
9702   return __pyx_r;
9703 }
9704 
9705 /* "fiona/_env.pyx":472
9706  *         log.debug("Stopped GDALEnv %r.", self)
9707  *
9708  *     def drivers(self):             # <<<<<<<<<<<<<<
9709  *         cdef OGRSFDriverH driver = NULL
9710  *         cdef int i
9711  */
9712 
9713 /* Python wrapper */
9714 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_7drivers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_7drivers(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9715 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_7drivers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9716   PyObject *__pyx_r = 0;
9717   __Pyx_RefNannyDeclarations
9718   __Pyx_RefNannySetupContext("drivers (wrapper)", 0);
9719   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_6drivers(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
9720 
9721   /* function exit code */
9722   __Pyx_RefNannyFinishContext();
9723   return __pyx_r;
9724 }
9725 
__pyx_pf_5fiona_4_env_7GDALEnv_6drivers(CYTHON_UNUSED struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)9726 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_6drivers(CYTHON_UNUSED struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
9727   CYTHON_UNUSED OGRSFDriverH __pyx_v_driver;
9728   int __pyx_v_i;
9729   PyObject *__pyx_v_result = NULL;
9730   OGRSFDriverH __pyx_v_drv;
9731   char *__pyx_v_key;
9732   char *__pyx_v_val;
9733   PyObject *__pyx_r = NULL;
9734   __Pyx_RefNannyDeclarations
9735   PyObject *__pyx_t_1 = NULL;
9736   int __pyx_t_2;
9737   int __pyx_t_3;
9738   int __pyx_t_4;
9739   PyObject *__pyx_t_5 = NULL;
9740   int __pyx_lineno = 0;
9741   const char *__pyx_filename = NULL;
9742   int __pyx_clineno = 0;
9743   __Pyx_RefNannySetupContext("drivers", 0);
9744 
9745   /* "fiona/_env.pyx":473
9746  *
9747  *     def drivers(self):
9748  *         cdef OGRSFDriverH driver = NULL             # <<<<<<<<<<<<<<
9749  *         cdef int i
9750  *
9751  */
9752   __pyx_v_driver = NULL;
9753 
9754   /* "fiona/_env.pyx":476
9755  *         cdef int i
9756  *
9757  *         result = {}             # <<<<<<<<<<<<<<
9758  *         for i in range(OGRGetDriverCount()):
9759  *             drv = OGRGetDriver(i)
9760  */
9761   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
9762   __Pyx_GOTREF(__pyx_t_1);
9763   __pyx_v_result = ((PyObject*)__pyx_t_1);
9764   __pyx_t_1 = 0;
9765 
9766   /* "fiona/_env.pyx":477
9767  *
9768  *         result = {}
9769  *         for i in range(OGRGetDriverCount()):             # <<<<<<<<<<<<<<
9770  *             drv = OGRGetDriver(i)
9771  *             key = <char *>OGR_Dr_GetName(drv)
9772  */
9773   __pyx_t_2 = OGRGetDriverCount();
9774   __pyx_t_3 = __pyx_t_2;
9775   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
9776     __pyx_v_i = __pyx_t_4;
9777 
9778     /* "fiona/_env.pyx":478
9779  *         result = {}
9780  *         for i in range(OGRGetDriverCount()):
9781  *             drv = OGRGetDriver(i)             # <<<<<<<<<<<<<<
9782  *             key = <char *>OGR_Dr_GetName(drv)
9783  *             val = <char *>OGR_Dr_GetName(drv)
9784  */
9785     __pyx_v_drv = OGRGetDriver(__pyx_v_i);
9786 
9787     /* "fiona/_env.pyx":479
9788  *         for i in range(OGRGetDriverCount()):
9789  *             drv = OGRGetDriver(i)
9790  *             key = <char *>OGR_Dr_GetName(drv)             # <<<<<<<<<<<<<<
9791  *             val = <char *>OGR_Dr_GetName(drv)
9792  *             result[key] = val
9793  */
9794     __pyx_v_key = ((char *)OGR_Dr_GetName(__pyx_v_drv));
9795 
9796     /* "fiona/_env.pyx":480
9797  *             drv = OGRGetDriver(i)
9798  *             key = <char *>OGR_Dr_GetName(drv)
9799  *             val = <char *>OGR_Dr_GetName(drv)             # <<<<<<<<<<<<<<
9800  *             result[key] = val
9801  *
9802  */
9803     __pyx_v_val = ((char *)OGR_Dr_GetName(__pyx_v_drv));
9804 
9805     /* "fiona/_env.pyx":481
9806  *             key = <char *>OGR_Dr_GetName(drv)
9807  *             val = <char *>OGR_Dr_GetName(drv)
9808  *             result[key] = val             # <<<<<<<<<<<<<<
9809  *
9810  *         return result
9811  */
9812     __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
9813     __Pyx_GOTREF(__pyx_t_1);
9814     __pyx_t_5 = __Pyx_PyUnicode_FromString(__pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error)
9815     __Pyx_GOTREF(__pyx_t_5);
9816     if (unlikely(PyDict_SetItem(__pyx_v_result, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(0, 481, __pyx_L1_error)
9817     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9818     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9819   }
9820 
9821   /* "fiona/_env.pyx":483
9822  *             result[key] = val
9823  *
9824  *         return result             # <<<<<<<<<<<<<<
9825  *
9826  *
9827  */
9828   __Pyx_XDECREF(__pyx_r);
9829   __Pyx_INCREF(__pyx_v_result);
9830   __pyx_r = __pyx_v_result;
9831   goto __pyx_L0;
9832 
9833   /* "fiona/_env.pyx":472
9834  *         log.debug("Stopped GDALEnv %r.", self)
9835  *
9836  *     def drivers(self):             # <<<<<<<<<<<<<<
9837  *         cdef OGRSFDriverH driver = NULL
9838  *         cdef int i
9839  */
9840 
9841   /* function exit code */
9842   __pyx_L1_error:;
9843   __Pyx_XDECREF(__pyx_t_1);
9844   __Pyx_XDECREF(__pyx_t_5);
9845   __Pyx_AddTraceback("fiona._env.GDALEnv.drivers", __pyx_clineno, __pyx_lineno, __pyx_filename);
9846   __pyx_r = NULL;
9847   __pyx_L0:;
9848   __Pyx_XDECREF(__pyx_v_result);
9849   __Pyx_XGIVEREF(__pyx_r);
9850   __Pyx_RefNannyFinishContext();
9851   return __pyx_r;
9852 }
9853 
9854 /* "fiona/_env.pxd":6
9855  *
9856  * cdef class GDALEnv(ConfigEnv):
9857  *     cdef public object _have_registered_drivers             # <<<<<<<<<<<<<<
9858  */
9859 
9860 /* Python wrapper */
9861 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_1__get__(PyObject * __pyx_v_self)9862 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_1__get__(PyObject *__pyx_v_self) {
9863   PyObject *__pyx_r = 0;
9864   __Pyx_RefNannyDeclarations
9865   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9866   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers___get__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
9867 
9868   /* function exit code */
9869   __Pyx_RefNannyFinishContext();
9870   return __pyx_r;
9871 }
9872 
__pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers___get__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)9873 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers___get__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
9874   PyObject *__pyx_r = NULL;
9875   __Pyx_RefNannyDeclarations
9876   __Pyx_RefNannySetupContext("__get__", 0);
9877   __Pyx_XDECREF(__pyx_r);
9878   __Pyx_INCREF(__pyx_v_self->_have_registered_drivers);
9879   __pyx_r = __pyx_v_self->_have_registered_drivers;
9880   goto __pyx_L0;
9881 
9882   /* function exit code */
9883   __pyx_L0:;
9884   __Pyx_XGIVEREF(__pyx_r);
9885   __Pyx_RefNannyFinishContext();
9886   return __pyx_r;
9887 }
9888 
9889 /* Python wrapper */
9890 static int __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)9891 static int __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
9892   int __pyx_r;
9893   __Pyx_RefNannyDeclarations
9894   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
9895   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_2__set__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self), ((PyObject *)__pyx_v_value));
9896 
9897   /* function exit code */
9898   __Pyx_RefNannyFinishContext();
9899   return __pyx_r;
9900 }
9901 
__pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_2__set__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self,PyObject * __pyx_v_value)9902 static int __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_2__set__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v_value) {
9903   int __pyx_r;
9904   __Pyx_RefNannyDeclarations
9905   __Pyx_RefNannySetupContext("__set__", 0);
9906   __Pyx_INCREF(__pyx_v_value);
9907   __Pyx_GIVEREF(__pyx_v_value);
9908   __Pyx_GOTREF(__pyx_v_self->_have_registered_drivers);
9909   __Pyx_DECREF(__pyx_v_self->_have_registered_drivers);
9910   __pyx_v_self->_have_registered_drivers = __pyx_v_value;
9911 
9912   /* function exit code */
9913   __pyx_r = 0;
9914   __Pyx_RefNannyFinishContext();
9915   return __pyx_r;
9916 }
9917 
9918 /* Python wrapper */
9919 static int __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_5__del__(PyObject * __pyx_v_self)9920 static int __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_5__del__(PyObject *__pyx_v_self) {
9921   int __pyx_r;
9922   __Pyx_RefNannyDeclarations
9923   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
9924   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_4__del__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
9925 
9926   /* function exit code */
9927   __Pyx_RefNannyFinishContext();
9928   return __pyx_r;
9929 }
9930 
__pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_4__del__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)9931 static int __pyx_pf_5fiona_4_env_7GDALEnv_24_have_registered_drivers_4__del__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
9932   int __pyx_r;
9933   __Pyx_RefNannyDeclarations
9934   __Pyx_RefNannySetupContext("__del__", 0);
9935   __Pyx_INCREF(Py_None);
9936   __Pyx_GIVEREF(Py_None);
9937   __Pyx_GOTREF(__pyx_v_self->_have_registered_drivers);
9938   __Pyx_DECREF(__pyx_v_self->_have_registered_drivers);
9939   __pyx_v_self->_have_registered_drivers = Py_None;
9940 
9941   /* function exit code */
9942   __pyx_r = 0;
9943   __Pyx_RefNannyFinishContext();
9944   return __pyx_r;
9945 }
9946 
9947 /* "(tree fragment)":1
9948  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9949  *     cdef tuple state
9950  *     cdef object _dict
9951  */
9952 
9953 /* Python wrapper */
9954 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9955 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9956   PyObject *__pyx_r = 0;
9957   __Pyx_RefNannyDeclarations
9958   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
9959   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_8__reduce_cython__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self));
9960 
9961   /* function exit code */
9962   __Pyx_RefNannyFinishContext();
9963   return __pyx_r;
9964 }
9965 
__pyx_pf_5fiona_4_env_7GDALEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self)9966 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_8__reduce_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self) {
9967   PyObject *__pyx_v_state = 0;
9968   PyObject *__pyx_v__dict = 0;
9969   int __pyx_v_use_setstate;
9970   PyObject *__pyx_r = NULL;
9971   __Pyx_RefNannyDeclarations
9972   PyObject *__pyx_t_1 = NULL;
9973   int __pyx_t_2;
9974   int __pyx_t_3;
9975   PyObject *__pyx_t_4 = NULL;
9976   int __pyx_t_5;
9977   PyObject *__pyx_t_6 = NULL;
9978   int __pyx_lineno = 0;
9979   const char *__pyx_filename = NULL;
9980   int __pyx_clineno = 0;
9981   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9982 
9983   /* "(tree fragment)":5
9984  *     cdef object _dict
9985  *     cdef bint use_setstate
9986  *     state = (self._have_registered_drivers, self.options)             # <<<<<<<<<<<<<<
9987  *     _dict = getattr(self, '__dict__', None)
9988  *     if _dict is not None:
9989  */
9990   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
9991   __Pyx_GOTREF(__pyx_t_1);
9992   __Pyx_INCREF(__pyx_v_self->_have_registered_drivers);
9993   __Pyx_GIVEREF(__pyx_v_self->_have_registered_drivers);
9994   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_have_registered_drivers);
9995   __Pyx_INCREF(__pyx_v_self->__pyx_base.options);
9996   __Pyx_GIVEREF(__pyx_v_self->__pyx_base.options);
9997   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->__pyx_base.options);
9998   __pyx_v_state = ((PyObject*)__pyx_t_1);
9999   __pyx_t_1 = 0;
10000 
10001   /* "(tree fragment)":6
10002  *     cdef bint use_setstate
10003  *     state = (self._have_registered_drivers, self.options)
10004  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
10005  *     if _dict is not None:
10006  *         state += (_dict,)
10007  */
10008   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
10009   __Pyx_GOTREF(__pyx_t_1);
10010   __pyx_v__dict = __pyx_t_1;
10011   __pyx_t_1 = 0;
10012 
10013   /* "(tree fragment)":7
10014  *     state = (self._have_registered_drivers, self.options)
10015  *     _dict = getattr(self, '__dict__', None)
10016  *     if _dict is not None:             # <<<<<<<<<<<<<<
10017  *         state += (_dict,)
10018  *         use_setstate = True
10019  */
10020   __pyx_t_2 = (__pyx_v__dict != Py_None);
10021   __pyx_t_3 = (__pyx_t_2 != 0);
10022   if (__pyx_t_3) {
10023 
10024     /* "(tree fragment)":8
10025  *     _dict = getattr(self, '__dict__', None)
10026  *     if _dict is not None:
10027  *         state += (_dict,)             # <<<<<<<<<<<<<<
10028  *         use_setstate = True
10029  *     else:
10030  */
10031     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
10032     __Pyx_GOTREF(__pyx_t_1);
10033     __Pyx_INCREF(__pyx_v__dict);
10034     __Pyx_GIVEREF(__pyx_v__dict);
10035     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
10036     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
10037     __Pyx_GOTREF(__pyx_t_4);
10038     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10039     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
10040     __pyx_t_4 = 0;
10041 
10042     /* "(tree fragment)":9
10043  *     if _dict is not None:
10044  *         state += (_dict,)
10045  *         use_setstate = True             # <<<<<<<<<<<<<<
10046  *     else:
10047  *         use_setstate = self._have_registered_drivers is not None or self.options is not None
10048  */
10049     __pyx_v_use_setstate = 1;
10050 
10051     /* "(tree fragment)":7
10052  *     state = (self._have_registered_drivers, self.options)
10053  *     _dict = getattr(self, '__dict__', None)
10054  *     if _dict is not None:             # <<<<<<<<<<<<<<
10055  *         state += (_dict,)
10056  *         use_setstate = True
10057  */
10058     goto __pyx_L3;
10059   }
10060 
10061   /* "(tree fragment)":11
10062  *         use_setstate = True
10063  *     else:
10064  *         use_setstate = self._have_registered_drivers is not None or self.options is not None             # <<<<<<<<<<<<<<
10065  *     if use_setstate:
10066  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, None), state
10067  */
10068   /*else*/ {
10069     __pyx_t_2 = (__pyx_v_self->_have_registered_drivers != Py_None);
10070     __pyx_t_5 = (__pyx_t_2 != 0);
10071     if (!__pyx_t_5) {
10072     } else {
10073       __pyx_t_3 = __pyx_t_5;
10074       goto __pyx_L4_bool_binop_done;
10075     }
10076     __pyx_t_5 = (__pyx_v_self->__pyx_base.options != Py_None);
10077     __pyx_t_2 = (__pyx_t_5 != 0);
10078     __pyx_t_3 = __pyx_t_2;
10079     __pyx_L4_bool_binop_done:;
10080     __pyx_v_use_setstate = __pyx_t_3;
10081   }
10082   __pyx_L3:;
10083 
10084   /* "(tree fragment)":12
10085  *     else:
10086  *         use_setstate = self._have_registered_drivers is not None or self.options is not None
10087  *     if use_setstate:             # <<<<<<<<<<<<<<
10088  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, None), state
10089  *     else:
10090  */
10091   __pyx_t_3 = (__pyx_v_use_setstate != 0);
10092   if (__pyx_t_3) {
10093 
10094     /* "(tree fragment)":13
10095  *         use_setstate = self._have_registered_drivers is not None or self.options is not None
10096  *     if use_setstate:
10097  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, None), state             # <<<<<<<<<<<<<<
10098  *     else:
10099  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, state)
10100  */
10101     __Pyx_XDECREF(__pyx_r);
10102     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_GDALEnv); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
10103     __Pyx_GOTREF(__pyx_t_4);
10104     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
10105     __Pyx_GOTREF(__pyx_t_1);
10106     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10107     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10108     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10109     __Pyx_INCREF(__pyx_int_40410864);
10110     __Pyx_GIVEREF(__pyx_int_40410864);
10111     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_40410864);
10112     __Pyx_INCREF(Py_None);
10113     __Pyx_GIVEREF(Py_None);
10114     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
10115     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
10116     __Pyx_GOTREF(__pyx_t_6);
10117     __Pyx_GIVEREF(__pyx_t_4);
10118     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
10119     __Pyx_GIVEREF(__pyx_t_1);
10120     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
10121     __Pyx_INCREF(__pyx_v_state);
10122     __Pyx_GIVEREF(__pyx_v_state);
10123     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
10124     __pyx_t_4 = 0;
10125     __pyx_t_1 = 0;
10126     __pyx_r = __pyx_t_6;
10127     __pyx_t_6 = 0;
10128     goto __pyx_L0;
10129 
10130     /* "(tree fragment)":12
10131  *     else:
10132  *         use_setstate = self._have_registered_drivers is not None or self.options is not None
10133  *     if use_setstate:             # <<<<<<<<<<<<<<
10134  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, None), state
10135  *     else:
10136  */
10137   }
10138 
10139   /* "(tree fragment)":15
10140  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, None), state
10141  *     else:
10142  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, state)             # <<<<<<<<<<<<<<
10143  * def __setstate_cython__(self, __pyx_state):
10144  *     __pyx_unpickle_GDALEnv__set_state(self, __pyx_state)
10145  */
10146   /*else*/ {
10147     __Pyx_XDECREF(__pyx_r);
10148     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_GDALEnv); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
10149     __Pyx_GOTREF(__pyx_t_6);
10150     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
10151     __Pyx_GOTREF(__pyx_t_1);
10152     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10153     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10154     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10155     __Pyx_INCREF(__pyx_int_40410864);
10156     __Pyx_GIVEREF(__pyx_int_40410864);
10157     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_40410864);
10158     __Pyx_INCREF(__pyx_v_state);
10159     __Pyx_GIVEREF(__pyx_v_state);
10160     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
10161     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
10162     __Pyx_GOTREF(__pyx_t_4);
10163     __Pyx_GIVEREF(__pyx_t_6);
10164     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
10165     __Pyx_GIVEREF(__pyx_t_1);
10166     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10167     __pyx_t_6 = 0;
10168     __pyx_t_1 = 0;
10169     __pyx_r = __pyx_t_4;
10170     __pyx_t_4 = 0;
10171     goto __pyx_L0;
10172   }
10173 
10174   /* "(tree fragment)":1
10175  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10176  *     cdef tuple state
10177  *     cdef object _dict
10178  */
10179 
10180   /* function exit code */
10181   __pyx_L1_error:;
10182   __Pyx_XDECREF(__pyx_t_1);
10183   __Pyx_XDECREF(__pyx_t_4);
10184   __Pyx_XDECREF(__pyx_t_6);
10185   __Pyx_AddTraceback("fiona._env.GDALEnv.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10186   __pyx_r = NULL;
10187   __pyx_L0:;
10188   __Pyx_XDECREF(__pyx_v_state);
10189   __Pyx_XDECREF(__pyx_v__dict);
10190   __Pyx_XGIVEREF(__pyx_r);
10191   __Pyx_RefNannyFinishContext();
10192   return __pyx_r;
10193 }
10194 
10195 /* "(tree fragment)":16
10196  *     else:
10197  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, state)
10198  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10199  *     __pyx_unpickle_GDALEnv__set_state(self, __pyx_state)
10200  */
10201 
10202 /* Python wrapper */
10203 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_5fiona_4_env_7GDALEnv_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)10204 static PyObject *__pyx_pw_5fiona_4_env_7GDALEnv_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10205   PyObject *__pyx_r = 0;
10206   __Pyx_RefNannyDeclarations
10207   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
10208   __pyx_r = __pyx_pf_5fiona_4_env_7GDALEnv_10__setstate_cython__(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10209 
10210   /* function exit code */
10211   __Pyx_RefNannyFinishContext();
10212   return __pyx_r;
10213 }
10214 
__pyx_pf_5fiona_4_env_7GDALEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v_self,PyObject * __pyx_v___pyx_state)10215 static PyObject *__pyx_pf_5fiona_4_env_7GDALEnv_10__setstate_cython__(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10216   PyObject *__pyx_r = NULL;
10217   __Pyx_RefNannyDeclarations
10218   PyObject *__pyx_t_1 = NULL;
10219   int __pyx_lineno = 0;
10220   const char *__pyx_filename = NULL;
10221   int __pyx_clineno = 0;
10222   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
10223 
10224   /* "(tree fragment)":17
10225  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, state)
10226  * def __setstate_cython__(self, __pyx_state):
10227  *     __pyx_unpickle_GDALEnv__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
10228  */
10229   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
10230   __pyx_t_1 = __pyx_f_5fiona_4_env___pyx_unpickle_GDALEnv__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
10231   __Pyx_GOTREF(__pyx_t_1);
10232   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10233 
10234   /* "(tree fragment)":16
10235  *     else:
10236  *         return __pyx_unpickle_GDALEnv, (type(self), 0x2689ef0, state)
10237  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10238  *     __pyx_unpickle_GDALEnv__set_state(self, __pyx_state)
10239  */
10240 
10241   /* function exit code */
10242   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10243   goto __pyx_L0;
10244   __pyx_L1_error:;
10245   __Pyx_XDECREF(__pyx_t_1);
10246   __Pyx_AddTraceback("fiona._env.GDALEnv.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10247   __pyx_r = NULL;
10248   __pyx_L0:;
10249   __Pyx_XGIVEREF(__pyx_r);
10250   __Pyx_RefNannyFinishContext();
10251   return __pyx_r;
10252 }
10253 
10254 /* "fiona/_env.pyx":486
10255  *
10256  *
10257  * def set_proj_data_search_path(path):             # <<<<<<<<<<<<<<
10258  *     """Set PROJ data search path"""
10259  *     set_proj_search_path(path)
10260  */
10261 
10262 /* Python wrapper */
10263 static PyObject *__pyx_pw_5fiona_4_env_19set_proj_data_search_path(PyObject *__pyx_self, PyObject *__pyx_v_path); /*proto*/
10264 static char __pyx_doc_5fiona_4_env_18set_proj_data_search_path[] = "Set PROJ data search path";
10265 static PyMethodDef __pyx_mdef_5fiona_4_env_19set_proj_data_search_path = {"set_proj_data_search_path", (PyCFunction)__pyx_pw_5fiona_4_env_19set_proj_data_search_path, METH_O, __pyx_doc_5fiona_4_env_18set_proj_data_search_path};
__pyx_pw_5fiona_4_env_19set_proj_data_search_path(PyObject * __pyx_self,PyObject * __pyx_v_path)10266 static PyObject *__pyx_pw_5fiona_4_env_19set_proj_data_search_path(PyObject *__pyx_self, PyObject *__pyx_v_path) {
10267   PyObject *__pyx_r = 0;
10268   __Pyx_RefNannyDeclarations
10269   __Pyx_RefNannySetupContext("set_proj_data_search_path (wrapper)", 0);
10270   __pyx_r = __pyx_pf_5fiona_4_env_18set_proj_data_search_path(__pyx_self, ((PyObject *)__pyx_v_path));
10271 
10272   /* function exit code */
10273   __Pyx_RefNannyFinishContext();
10274   return __pyx_r;
10275 }
10276 
__pyx_pf_5fiona_4_env_18set_proj_data_search_path(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_path)10277 static PyObject *__pyx_pf_5fiona_4_env_18set_proj_data_search_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path) {
10278   PyObject *__pyx_r = NULL;
10279   __Pyx_RefNannyDeclarations
10280   __Pyx_RefNannySetupContext("set_proj_data_search_path", 0);
10281 
10282   /* "fiona/_env.pyx":488
10283  * def set_proj_data_search_path(path):
10284  *     """Set PROJ data search path"""
10285  *     set_proj_search_path(path)             # <<<<<<<<<<<<<<
10286  */
10287   __pyx_f_5fiona_5_shim_set_proj_search_path(__pyx_v_path);
10288 
10289   /* "fiona/_env.pyx":486
10290  *
10291  *
10292  * def set_proj_data_search_path(path):             # <<<<<<<<<<<<<<
10293  *     """Set PROJ data search path"""
10294  *     set_proj_search_path(path)
10295  */
10296 
10297   /* function exit code */
10298   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10299   __Pyx_XGIVEREF(__pyx_r);
10300   __Pyx_RefNannyFinishContext();
10301   return __pyx_r;
10302 }
10303 
10304 /* "(tree fragment)":1
10305  * def __pyx_unpickle_ConfigEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10306  *     cdef object __pyx_PickleError
10307  *     cdef object __pyx_result
10308  */
10309 
10310 /* Python wrapper */
10311 static PyObject *__pyx_pw_5fiona_4_env_21__pyx_unpickle_ConfigEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10312 static PyMethodDef __pyx_mdef_5fiona_4_env_21__pyx_unpickle_ConfigEnv = {"__pyx_unpickle_ConfigEnv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_21__pyx_unpickle_ConfigEnv, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_5fiona_4_env_21__pyx_unpickle_ConfigEnv(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10313 static PyObject *__pyx_pw_5fiona_4_env_21__pyx_unpickle_ConfigEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10314   PyObject *__pyx_v___pyx_type = 0;
10315   long __pyx_v___pyx_checksum;
10316   PyObject *__pyx_v___pyx_state = 0;
10317   int __pyx_lineno = 0;
10318   const char *__pyx_filename = NULL;
10319   int __pyx_clineno = 0;
10320   PyObject *__pyx_r = 0;
10321   __Pyx_RefNannyDeclarations
10322   __Pyx_RefNannySetupContext("__pyx_unpickle_ConfigEnv (wrapper)", 0);
10323   {
10324     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
10325     PyObject* values[3] = {0,0,0};
10326     if (unlikely(__pyx_kwds)) {
10327       Py_ssize_t kw_args;
10328       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10329       switch (pos_args) {
10330         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10331         CYTHON_FALLTHROUGH;
10332         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10333         CYTHON_FALLTHROUGH;
10334         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10335         CYTHON_FALLTHROUGH;
10336         case  0: break;
10337         default: goto __pyx_L5_argtuple_error;
10338       }
10339       kw_args = PyDict_Size(__pyx_kwds);
10340       switch (pos_args) {
10341         case  0:
10342         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
10343         else goto __pyx_L5_argtuple_error;
10344         CYTHON_FALLTHROUGH;
10345         case  1:
10346         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
10347         else {
10348           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConfigEnv", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
10349         }
10350         CYTHON_FALLTHROUGH;
10351         case  2:
10352         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
10353         else {
10354           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConfigEnv", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
10355         }
10356       }
10357       if (unlikely(kw_args > 0)) {
10358         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ConfigEnv") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
10359       }
10360     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
10361       goto __pyx_L5_argtuple_error;
10362     } else {
10363       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10364       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10365       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10366     }
10367     __pyx_v___pyx_type = values[0];
10368     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
10369     __pyx_v___pyx_state = values[2];
10370   }
10371   goto __pyx_L4_argument_unpacking_done;
10372   __pyx_L5_argtuple_error:;
10373   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConfigEnv", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
10374   __pyx_L3_error:;
10375   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_ConfigEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
10376   __Pyx_RefNannyFinishContext();
10377   return NULL;
10378   __pyx_L4_argument_unpacking_done:;
10379   __pyx_r = __pyx_pf_5fiona_4_env_20__pyx_unpickle_ConfigEnv(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
10380 
10381   /* function exit code */
10382   __Pyx_RefNannyFinishContext();
10383   return __pyx_r;
10384 }
10385 
__pyx_pf_5fiona_4_env_20__pyx_unpickle_ConfigEnv(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)10386 static PyObject *__pyx_pf_5fiona_4_env_20__pyx_unpickle_ConfigEnv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
10387   PyObject *__pyx_v___pyx_PickleError = 0;
10388   PyObject *__pyx_v___pyx_result = 0;
10389   PyObject *__pyx_r = NULL;
10390   __Pyx_RefNannyDeclarations
10391   int __pyx_t_1;
10392   PyObject *__pyx_t_2 = NULL;
10393   PyObject *__pyx_t_3 = NULL;
10394   PyObject *__pyx_t_4 = NULL;
10395   PyObject *__pyx_t_5 = NULL;
10396   int __pyx_t_6;
10397   int __pyx_lineno = 0;
10398   const char *__pyx_filename = NULL;
10399   int __pyx_clineno = 0;
10400   __Pyx_RefNannySetupContext("__pyx_unpickle_ConfigEnv", 0);
10401 
10402   /* "(tree fragment)":4
10403  *     cdef object __pyx_PickleError
10404  *     cdef object __pyx_result
10405  *     if __pyx_checksum != 0x93da65a:             # <<<<<<<<<<<<<<
10406  *         from pickle import PickleError as __pyx_PickleError
10407  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10408  */
10409   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x93da65a) != 0);
10410   if (__pyx_t_1) {
10411 
10412     /* "(tree fragment)":5
10413  *     cdef object __pyx_result
10414  *     if __pyx_checksum != 0x93da65a:
10415  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
10416  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10417  *     __pyx_result = ConfigEnv.__new__(__pyx_type)
10418  */
10419     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
10420     __Pyx_GOTREF(__pyx_t_2);
10421     __Pyx_INCREF(__pyx_n_s_PickleError);
10422     __Pyx_GIVEREF(__pyx_n_s_PickleError);
10423     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
10424     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
10425     __Pyx_GOTREF(__pyx_t_3);
10426     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10427     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
10428     __Pyx_GOTREF(__pyx_t_2);
10429     __Pyx_INCREF(__pyx_t_2);
10430     __pyx_v___pyx_PickleError = __pyx_t_2;
10431     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10432     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10433 
10434     /* "(tree fragment)":6
10435  *     if __pyx_checksum != 0x93da65a:
10436  *         from pickle import PickleError as __pyx_PickleError
10437  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)             # <<<<<<<<<<<<<<
10438  *     __pyx_result = ConfigEnv.__new__(__pyx_type)
10439  *     if __pyx_state is not None:
10440  */
10441     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
10442     __Pyx_GOTREF(__pyx_t_2);
10443     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x93, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
10444     __Pyx_GOTREF(__pyx_t_4);
10445     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10446     __Pyx_INCREF(__pyx_v___pyx_PickleError);
10447     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
10448     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10449       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
10450       if (likely(__pyx_t_5)) {
10451         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10452         __Pyx_INCREF(__pyx_t_5);
10453         __Pyx_INCREF(function);
10454         __Pyx_DECREF_SET(__pyx_t_2, function);
10455       }
10456     }
10457     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
10458     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10459     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10460     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
10461     __Pyx_GOTREF(__pyx_t_3);
10462     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10463     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10464     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10465     __PYX_ERR(1, 6, __pyx_L1_error)
10466 
10467     /* "(tree fragment)":4
10468  *     cdef object __pyx_PickleError
10469  *     cdef object __pyx_result
10470  *     if __pyx_checksum != 0x93da65a:             # <<<<<<<<<<<<<<
10471  *         from pickle import PickleError as __pyx_PickleError
10472  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10473  */
10474   }
10475 
10476   /* "(tree fragment)":7
10477  *         from pickle import PickleError as __pyx_PickleError
10478  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10479  *     __pyx_result = ConfigEnv.__new__(__pyx_type)             # <<<<<<<<<<<<<<
10480  *     if __pyx_state is not None:
10481  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10482  */
10483   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5fiona_4_env_ConfigEnv), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
10484   __Pyx_GOTREF(__pyx_t_2);
10485   __pyx_t_4 = NULL;
10486   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10487     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
10488     if (likely(__pyx_t_4)) {
10489       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10490       __Pyx_INCREF(__pyx_t_4);
10491       __Pyx_INCREF(function);
10492       __Pyx_DECREF_SET(__pyx_t_2, function);
10493     }
10494   }
10495   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
10496   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10497   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
10498   __Pyx_GOTREF(__pyx_t_3);
10499   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10500   __pyx_v___pyx_result = __pyx_t_3;
10501   __pyx_t_3 = 0;
10502 
10503   /* "(tree fragment)":8
10504  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10505  *     __pyx_result = ConfigEnv.__new__(__pyx_type)
10506  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
10507  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10508  *     return __pyx_result
10509  */
10510   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
10511   __pyx_t_6 = (__pyx_t_1 != 0);
10512   if (__pyx_t_6) {
10513 
10514     /* "(tree fragment)":9
10515  *     __pyx_result = ConfigEnv.__new__(__pyx_type)
10516  *     if __pyx_state is not None:
10517  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
10518  *     return __pyx_result
10519  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):
10520  */
10521     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
10522     __pyx_t_3 = __pyx_f_5fiona_4_env___pyx_unpickle_ConfigEnv__set_state(((struct __pyx_obj_5fiona_4_env_ConfigEnv *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
10523     __Pyx_GOTREF(__pyx_t_3);
10524     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10525 
10526     /* "(tree fragment)":8
10527  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x93da65a = (options))" % __pyx_checksum)
10528  *     __pyx_result = ConfigEnv.__new__(__pyx_type)
10529  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
10530  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10531  *     return __pyx_result
10532  */
10533   }
10534 
10535   /* "(tree fragment)":10
10536  *     if __pyx_state is not None:
10537  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10538  *     return __pyx_result             # <<<<<<<<<<<<<<
10539  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):
10540  *     __pyx_result.options = __pyx_state[0]
10541  */
10542   __Pyx_XDECREF(__pyx_r);
10543   __Pyx_INCREF(__pyx_v___pyx_result);
10544   __pyx_r = __pyx_v___pyx_result;
10545   goto __pyx_L0;
10546 
10547   /* "(tree fragment)":1
10548  * def __pyx_unpickle_ConfigEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10549  *     cdef object __pyx_PickleError
10550  *     cdef object __pyx_result
10551  */
10552 
10553   /* function exit code */
10554   __pyx_L1_error:;
10555   __Pyx_XDECREF(__pyx_t_2);
10556   __Pyx_XDECREF(__pyx_t_3);
10557   __Pyx_XDECREF(__pyx_t_4);
10558   __Pyx_XDECREF(__pyx_t_5);
10559   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_ConfigEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
10560   __pyx_r = NULL;
10561   __pyx_L0:;
10562   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
10563   __Pyx_XDECREF(__pyx_v___pyx_result);
10564   __Pyx_XGIVEREF(__pyx_r);
10565   __Pyx_RefNannyFinishContext();
10566   return __pyx_r;
10567 }
10568 
10569 /* "(tree fragment)":11
10570  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10571  *     return __pyx_result
10572  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
10573  *     __pyx_result.options = __pyx_state[0]
10574  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
10575  */
10576 
__pyx_f_5fiona_4_env___pyx_unpickle_ConfigEnv__set_state(struct __pyx_obj_5fiona_4_env_ConfigEnv * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)10577 static PyObject *__pyx_f_5fiona_4_env___pyx_unpickle_ConfigEnv__set_state(struct __pyx_obj_5fiona_4_env_ConfigEnv *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
10578   PyObject *__pyx_r = NULL;
10579   __Pyx_RefNannyDeclarations
10580   PyObject *__pyx_t_1 = NULL;
10581   int __pyx_t_2;
10582   Py_ssize_t __pyx_t_3;
10583   int __pyx_t_4;
10584   int __pyx_t_5;
10585   PyObject *__pyx_t_6 = NULL;
10586   PyObject *__pyx_t_7 = NULL;
10587   PyObject *__pyx_t_8 = NULL;
10588   int __pyx_lineno = 0;
10589   const char *__pyx_filename = NULL;
10590   int __pyx_clineno = 0;
10591   __Pyx_RefNannySetupContext("__pyx_unpickle_ConfigEnv__set_state", 0);
10592 
10593   /* "(tree fragment)":12
10594  *     return __pyx_result
10595  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):
10596  *     __pyx_result.options = __pyx_state[0]             # <<<<<<<<<<<<<<
10597  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
10598  *         __pyx_result.__dict__.update(__pyx_state[1])
10599  */
10600   if (unlikely(__pyx_v___pyx_state == Py_None)) {
10601     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10602     __PYX_ERR(1, 12, __pyx_L1_error)
10603   }
10604   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
10605   __Pyx_GOTREF(__pyx_t_1);
10606   __Pyx_GIVEREF(__pyx_t_1);
10607   __Pyx_GOTREF(__pyx_v___pyx_result->options);
10608   __Pyx_DECREF(__pyx_v___pyx_result->options);
10609   __pyx_v___pyx_result->options = __pyx_t_1;
10610   __pyx_t_1 = 0;
10611 
10612   /* "(tree fragment)":13
10613  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):
10614  *     __pyx_result.options = __pyx_state[0]
10615  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
10616  *         __pyx_result.__dict__.update(__pyx_state[1])
10617  */
10618   if (unlikely(__pyx_v___pyx_state == Py_None)) {
10619     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
10620     __PYX_ERR(1, 13, __pyx_L1_error)
10621   }
10622   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
10623   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
10624   if (__pyx_t_4) {
10625   } else {
10626     __pyx_t_2 = __pyx_t_4;
10627     goto __pyx_L4_bool_binop_done;
10628   }
10629   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
10630   __pyx_t_5 = (__pyx_t_4 != 0);
10631   __pyx_t_2 = __pyx_t_5;
10632   __pyx_L4_bool_binop_done:;
10633   if (__pyx_t_2) {
10634 
10635     /* "(tree fragment)":14
10636  *     __pyx_result.options = __pyx_state[0]
10637  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
10638  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
10639  */
10640     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
10641     __Pyx_GOTREF(__pyx_t_6);
10642     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
10643     __Pyx_GOTREF(__pyx_t_7);
10644     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10645     if (unlikely(__pyx_v___pyx_state == Py_None)) {
10646       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10647       __PYX_ERR(1, 14, __pyx_L1_error)
10648     }
10649     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
10650     __Pyx_GOTREF(__pyx_t_6);
10651     __pyx_t_8 = NULL;
10652     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
10653       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
10654       if (likely(__pyx_t_8)) {
10655         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
10656         __Pyx_INCREF(__pyx_t_8);
10657         __Pyx_INCREF(function);
10658         __Pyx_DECREF_SET(__pyx_t_7, function);
10659       }
10660     }
10661     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
10662     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10663     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10664     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
10665     __Pyx_GOTREF(__pyx_t_1);
10666     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10667     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10668 
10669     /* "(tree fragment)":13
10670  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):
10671  *     __pyx_result.options = __pyx_state[0]
10672  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
10673  *         __pyx_result.__dict__.update(__pyx_state[1])
10674  */
10675   }
10676 
10677   /* "(tree fragment)":11
10678  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
10679  *     return __pyx_result
10680  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
10681  *     __pyx_result.options = __pyx_state[0]
10682  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
10683  */
10684 
10685   /* function exit code */
10686   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10687   goto __pyx_L0;
10688   __pyx_L1_error:;
10689   __Pyx_XDECREF(__pyx_t_1);
10690   __Pyx_XDECREF(__pyx_t_6);
10691   __Pyx_XDECREF(__pyx_t_7);
10692   __Pyx_XDECREF(__pyx_t_8);
10693   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_ConfigEnv__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
10694   __pyx_r = 0;
10695   __pyx_L0:;
10696   __Pyx_XGIVEREF(__pyx_r);
10697   __Pyx_RefNannyFinishContext();
10698   return __pyx_r;
10699 }
10700 
10701 /* "(tree fragment)":1
10702  * def __pyx_unpickle_GDALEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10703  *     cdef object __pyx_PickleError
10704  *     cdef object __pyx_result
10705  */
10706 
10707 /* Python wrapper */
10708 static PyObject *__pyx_pw_5fiona_4_env_23__pyx_unpickle_GDALEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10709 static PyMethodDef __pyx_mdef_5fiona_4_env_23__pyx_unpickle_GDALEnv = {"__pyx_unpickle_GDALEnv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_23__pyx_unpickle_GDALEnv, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_5fiona_4_env_23__pyx_unpickle_GDALEnv(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10710 static PyObject *__pyx_pw_5fiona_4_env_23__pyx_unpickle_GDALEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10711   PyObject *__pyx_v___pyx_type = 0;
10712   long __pyx_v___pyx_checksum;
10713   PyObject *__pyx_v___pyx_state = 0;
10714   int __pyx_lineno = 0;
10715   const char *__pyx_filename = NULL;
10716   int __pyx_clineno = 0;
10717   PyObject *__pyx_r = 0;
10718   __Pyx_RefNannyDeclarations
10719   __Pyx_RefNannySetupContext("__pyx_unpickle_GDALEnv (wrapper)", 0);
10720   {
10721     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
10722     PyObject* values[3] = {0,0,0};
10723     if (unlikely(__pyx_kwds)) {
10724       Py_ssize_t kw_args;
10725       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10726       switch (pos_args) {
10727         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10728         CYTHON_FALLTHROUGH;
10729         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10730         CYTHON_FALLTHROUGH;
10731         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10732         CYTHON_FALLTHROUGH;
10733         case  0: break;
10734         default: goto __pyx_L5_argtuple_error;
10735       }
10736       kw_args = PyDict_Size(__pyx_kwds);
10737       switch (pos_args) {
10738         case  0:
10739         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
10740         else goto __pyx_L5_argtuple_error;
10741         CYTHON_FALLTHROUGH;
10742         case  1:
10743         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
10744         else {
10745           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GDALEnv", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
10746         }
10747         CYTHON_FALLTHROUGH;
10748         case  2:
10749         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
10750         else {
10751           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GDALEnv", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
10752         }
10753       }
10754       if (unlikely(kw_args > 0)) {
10755         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_GDALEnv") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
10756       }
10757     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
10758       goto __pyx_L5_argtuple_error;
10759     } else {
10760       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10761       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10762       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10763     }
10764     __pyx_v___pyx_type = values[0];
10765     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
10766     __pyx_v___pyx_state = values[2];
10767   }
10768   goto __pyx_L4_argument_unpacking_done;
10769   __pyx_L5_argtuple_error:;
10770   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GDALEnv", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
10771   __pyx_L3_error:;
10772   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_GDALEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
10773   __Pyx_RefNannyFinishContext();
10774   return NULL;
10775   __pyx_L4_argument_unpacking_done:;
10776   __pyx_r = __pyx_pf_5fiona_4_env_22__pyx_unpickle_GDALEnv(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
10777 
10778   /* function exit code */
10779   __Pyx_RefNannyFinishContext();
10780   return __pyx_r;
10781 }
10782 
__pyx_pf_5fiona_4_env_22__pyx_unpickle_GDALEnv(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)10783 static PyObject *__pyx_pf_5fiona_4_env_22__pyx_unpickle_GDALEnv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
10784   PyObject *__pyx_v___pyx_PickleError = 0;
10785   PyObject *__pyx_v___pyx_result = 0;
10786   PyObject *__pyx_r = NULL;
10787   __Pyx_RefNannyDeclarations
10788   int __pyx_t_1;
10789   PyObject *__pyx_t_2 = NULL;
10790   PyObject *__pyx_t_3 = NULL;
10791   PyObject *__pyx_t_4 = NULL;
10792   PyObject *__pyx_t_5 = NULL;
10793   int __pyx_t_6;
10794   int __pyx_lineno = 0;
10795   const char *__pyx_filename = NULL;
10796   int __pyx_clineno = 0;
10797   __Pyx_RefNannySetupContext("__pyx_unpickle_GDALEnv", 0);
10798 
10799   /* "(tree fragment)":4
10800  *     cdef object __pyx_PickleError
10801  *     cdef object __pyx_result
10802  *     if __pyx_checksum != 0x2689ef0:             # <<<<<<<<<<<<<<
10803  *         from pickle import PickleError as __pyx_PickleError
10804  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10805  */
10806   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2689ef0) != 0);
10807   if (__pyx_t_1) {
10808 
10809     /* "(tree fragment)":5
10810  *     cdef object __pyx_result
10811  *     if __pyx_checksum != 0x2689ef0:
10812  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
10813  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10814  *     __pyx_result = GDALEnv.__new__(__pyx_type)
10815  */
10816     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
10817     __Pyx_GOTREF(__pyx_t_2);
10818     __Pyx_INCREF(__pyx_n_s_PickleError);
10819     __Pyx_GIVEREF(__pyx_n_s_PickleError);
10820     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
10821     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
10822     __Pyx_GOTREF(__pyx_t_3);
10823     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10824     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
10825     __Pyx_GOTREF(__pyx_t_2);
10826     __Pyx_INCREF(__pyx_t_2);
10827     __pyx_v___pyx_PickleError = __pyx_t_2;
10828     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10829     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10830 
10831     /* "(tree fragment)":6
10832  *     if __pyx_checksum != 0x2689ef0:
10833  *         from pickle import PickleError as __pyx_PickleError
10834  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)             # <<<<<<<<<<<<<<
10835  *     __pyx_result = GDALEnv.__new__(__pyx_type)
10836  *     if __pyx_state is not None:
10837  */
10838     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
10839     __Pyx_GOTREF(__pyx_t_2);
10840     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x26, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
10841     __Pyx_GOTREF(__pyx_t_4);
10842     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10843     __Pyx_INCREF(__pyx_v___pyx_PickleError);
10844     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
10845     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10846       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
10847       if (likely(__pyx_t_5)) {
10848         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10849         __Pyx_INCREF(__pyx_t_5);
10850         __Pyx_INCREF(function);
10851         __Pyx_DECREF_SET(__pyx_t_2, function);
10852       }
10853     }
10854     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
10855     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10856     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10857     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
10858     __Pyx_GOTREF(__pyx_t_3);
10859     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10860     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10861     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10862     __PYX_ERR(1, 6, __pyx_L1_error)
10863 
10864     /* "(tree fragment)":4
10865  *     cdef object __pyx_PickleError
10866  *     cdef object __pyx_result
10867  *     if __pyx_checksum != 0x2689ef0:             # <<<<<<<<<<<<<<
10868  *         from pickle import PickleError as __pyx_PickleError
10869  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10870  */
10871   }
10872 
10873   /* "(tree fragment)":7
10874  *         from pickle import PickleError as __pyx_PickleError
10875  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10876  *     __pyx_result = GDALEnv.__new__(__pyx_type)             # <<<<<<<<<<<<<<
10877  *     if __pyx_state is not None:
10878  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
10879  */
10880   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5fiona_4_env_GDALEnv), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
10881   __Pyx_GOTREF(__pyx_t_2);
10882   __pyx_t_4 = NULL;
10883   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10884     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
10885     if (likely(__pyx_t_4)) {
10886       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10887       __Pyx_INCREF(__pyx_t_4);
10888       __Pyx_INCREF(function);
10889       __Pyx_DECREF_SET(__pyx_t_2, function);
10890     }
10891   }
10892   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
10893   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10894   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
10895   __Pyx_GOTREF(__pyx_t_3);
10896   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10897   __pyx_v___pyx_result = __pyx_t_3;
10898   __pyx_t_3 = 0;
10899 
10900   /* "(tree fragment)":8
10901  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10902  *     __pyx_result = GDALEnv.__new__(__pyx_type)
10903  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
10904  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
10905  *     return __pyx_result
10906  */
10907   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
10908   __pyx_t_6 = (__pyx_t_1 != 0);
10909   if (__pyx_t_6) {
10910 
10911     /* "(tree fragment)":9
10912  *     __pyx_result = GDALEnv.__new__(__pyx_type)
10913  *     if __pyx_state is not None:
10914  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
10915  *     return __pyx_result
10916  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):
10917  */
10918     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
10919     __pyx_t_3 = __pyx_f_5fiona_4_env___pyx_unpickle_GDALEnv__set_state(((struct __pyx_obj_5fiona_4_env_GDALEnv *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
10920     __Pyx_GOTREF(__pyx_t_3);
10921     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10922 
10923     /* "(tree fragment)":8
10924  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2689ef0 = (_have_registered_drivers, options))" % __pyx_checksum)
10925  *     __pyx_result = GDALEnv.__new__(__pyx_type)
10926  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
10927  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
10928  *     return __pyx_result
10929  */
10930   }
10931 
10932   /* "(tree fragment)":10
10933  *     if __pyx_state is not None:
10934  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
10935  *     return __pyx_result             # <<<<<<<<<<<<<<
10936  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):
10937  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
10938  */
10939   __Pyx_XDECREF(__pyx_r);
10940   __Pyx_INCREF(__pyx_v___pyx_result);
10941   __pyx_r = __pyx_v___pyx_result;
10942   goto __pyx_L0;
10943 
10944   /* "(tree fragment)":1
10945  * def __pyx_unpickle_GDALEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10946  *     cdef object __pyx_PickleError
10947  *     cdef object __pyx_result
10948  */
10949 
10950   /* function exit code */
10951   __pyx_L1_error:;
10952   __Pyx_XDECREF(__pyx_t_2);
10953   __Pyx_XDECREF(__pyx_t_3);
10954   __Pyx_XDECREF(__pyx_t_4);
10955   __Pyx_XDECREF(__pyx_t_5);
10956   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_GDALEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
10957   __pyx_r = NULL;
10958   __pyx_L0:;
10959   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
10960   __Pyx_XDECREF(__pyx_v___pyx_result);
10961   __Pyx_XGIVEREF(__pyx_r);
10962   __Pyx_RefNannyFinishContext();
10963   return __pyx_r;
10964 }
10965 
10966 /* "(tree fragment)":11
10967  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
10968  *     return __pyx_result
10969  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
10970  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
10971  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
10972  */
10973 
__pyx_f_5fiona_4_env___pyx_unpickle_GDALEnv__set_state(struct __pyx_obj_5fiona_4_env_GDALEnv * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)10974 static PyObject *__pyx_f_5fiona_4_env___pyx_unpickle_GDALEnv__set_state(struct __pyx_obj_5fiona_4_env_GDALEnv *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
10975   PyObject *__pyx_r = NULL;
10976   __Pyx_RefNannyDeclarations
10977   PyObject *__pyx_t_1 = NULL;
10978   int __pyx_t_2;
10979   Py_ssize_t __pyx_t_3;
10980   int __pyx_t_4;
10981   int __pyx_t_5;
10982   PyObject *__pyx_t_6 = NULL;
10983   PyObject *__pyx_t_7 = NULL;
10984   PyObject *__pyx_t_8 = NULL;
10985   int __pyx_lineno = 0;
10986   const char *__pyx_filename = NULL;
10987   int __pyx_clineno = 0;
10988   __Pyx_RefNannySetupContext("__pyx_unpickle_GDALEnv__set_state", 0);
10989 
10990   /* "(tree fragment)":12
10991  *     return __pyx_result
10992  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):
10993  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]             # <<<<<<<<<<<<<<
10994  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
10995  *         __pyx_result.__dict__.update(__pyx_state[2])
10996  */
10997   if (unlikely(__pyx_v___pyx_state == Py_None)) {
10998     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10999     __PYX_ERR(1, 12, __pyx_L1_error)
11000   }
11001   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
11002   __Pyx_GOTREF(__pyx_t_1);
11003   __Pyx_GIVEREF(__pyx_t_1);
11004   __Pyx_GOTREF(__pyx_v___pyx_result->_have_registered_drivers);
11005   __Pyx_DECREF(__pyx_v___pyx_result->_have_registered_drivers);
11006   __pyx_v___pyx_result->_have_registered_drivers = __pyx_t_1;
11007   __pyx_t_1 = 0;
11008   if (unlikely(__pyx_v___pyx_state == Py_None)) {
11009     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
11010     __PYX_ERR(1, 12, __pyx_L1_error)
11011   }
11012   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
11013   __Pyx_GOTREF(__pyx_t_1);
11014   __Pyx_GIVEREF(__pyx_t_1);
11015   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.options);
11016   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.options);
11017   __pyx_v___pyx_result->__pyx_base.options = __pyx_t_1;
11018   __pyx_t_1 = 0;
11019 
11020   /* "(tree fragment)":13
11021  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):
11022  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
11023  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
11024  *         __pyx_result.__dict__.update(__pyx_state[2])
11025  */
11026   if (unlikely(__pyx_v___pyx_state == Py_None)) {
11027     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
11028     __PYX_ERR(1, 13, __pyx_L1_error)
11029   }
11030   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
11031   __pyx_t_4 = ((__pyx_t_3 > 2) != 0);
11032   if (__pyx_t_4) {
11033   } else {
11034     __pyx_t_2 = __pyx_t_4;
11035     goto __pyx_L4_bool_binop_done;
11036   }
11037   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
11038   __pyx_t_5 = (__pyx_t_4 != 0);
11039   __pyx_t_2 = __pyx_t_5;
11040   __pyx_L4_bool_binop_done:;
11041   if (__pyx_t_2) {
11042 
11043     /* "(tree fragment)":14
11044  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
11045  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
11046  *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
11047  */
11048     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
11049     __Pyx_GOTREF(__pyx_t_6);
11050     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
11051     __Pyx_GOTREF(__pyx_t_7);
11052     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11053     if (unlikely(__pyx_v___pyx_state == Py_None)) {
11054       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
11055       __PYX_ERR(1, 14, __pyx_L1_error)
11056     }
11057     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
11058     __Pyx_GOTREF(__pyx_t_6);
11059     __pyx_t_8 = NULL;
11060     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
11061       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
11062       if (likely(__pyx_t_8)) {
11063         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
11064         __Pyx_INCREF(__pyx_t_8);
11065         __Pyx_INCREF(function);
11066         __Pyx_DECREF_SET(__pyx_t_7, function);
11067       }
11068     }
11069     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
11070     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11071     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11072     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
11073     __Pyx_GOTREF(__pyx_t_1);
11074     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11075     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11076 
11077     /* "(tree fragment)":13
11078  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):
11079  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
11080  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
11081  *         __pyx_result.__dict__.update(__pyx_state[2])
11082  */
11083   }
11084 
11085   /* "(tree fragment)":11
11086  *         __pyx_unpickle_GDALEnv__set_state(<GDALEnv> __pyx_result, __pyx_state)
11087  *     return __pyx_result
11088  * cdef __pyx_unpickle_GDALEnv__set_state(GDALEnv __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
11089  *     __pyx_result._have_registered_drivers = __pyx_state[0]; __pyx_result.options = __pyx_state[1]
11090  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
11091  */
11092 
11093   /* function exit code */
11094   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11095   goto __pyx_L0;
11096   __pyx_L1_error:;
11097   __Pyx_XDECREF(__pyx_t_1);
11098   __Pyx_XDECREF(__pyx_t_6);
11099   __Pyx_XDECREF(__pyx_t_7);
11100   __Pyx_XDECREF(__pyx_t_8);
11101   __Pyx_AddTraceback("fiona._env.__pyx_unpickle_GDALEnv__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
11102   __pyx_r = 0;
11103   __pyx_L0:;
11104   __Pyx_XGIVEREF(__pyx_r);
11105   __Pyx_RefNannyFinishContext();
11106   return __pyx_r;
11107 }
11108 
__pyx_tp_new_5fiona_4_env_ConfigEnv(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)11109 static PyObject *__pyx_tp_new_5fiona_4_env_ConfigEnv(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11110   struct __pyx_obj_5fiona_4_env_ConfigEnv *p;
11111   PyObject *o;
11112   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
11113     o = (*t->tp_alloc)(t, 0);
11114   } else {
11115     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
11116   }
11117   if (unlikely(!o)) return 0;
11118   p = ((struct __pyx_obj_5fiona_4_env_ConfigEnv *)o);
11119   p->options = Py_None; Py_INCREF(Py_None);
11120   return o;
11121 }
11122 
__pyx_tp_dealloc_5fiona_4_env_ConfigEnv(PyObject * o)11123 static void __pyx_tp_dealloc_5fiona_4_env_ConfigEnv(PyObject *o) {
11124   struct __pyx_obj_5fiona_4_env_ConfigEnv *p = (struct __pyx_obj_5fiona_4_env_ConfigEnv *)o;
11125   #if CYTHON_USE_TP_FINALIZE
11126   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
11127     if (PyObject_CallFinalizerFromDealloc(o)) return;
11128   }
11129   #endif
11130   PyObject_GC_UnTrack(o);
11131   Py_CLEAR(p->options);
11132   (*Py_TYPE(o)->tp_free)(o);
11133 }
11134 
__pyx_tp_traverse_5fiona_4_env_ConfigEnv(PyObject * o,visitproc v,void * a)11135 static int __pyx_tp_traverse_5fiona_4_env_ConfigEnv(PyObject *o, visitproc v, void *a) {
11136   int e;
11137   struct __pyx_obj_5fiona_4_env_ConfigEnv *p = (struct __pyx_obj_5fiona_4_env_ConfigEnv *)o;
11138   if (p->options) {
11139     e = (*v)(p->options, a); if (e) return e;
11140   }
11141   return 0;
11142 }
11143 
__pyx_tp_clear_5fiona_4_env_ConfigEnv(PyObject * o)11144 static int __pyx_tp_clear_5fiona_4_env_ConfigEnv(PyObject *o) {
11145   PyObject* tmp;
11146   struct __pyx_obj_5fiona_4_env_ConfigEnv *p = (struct __pyx_obj_5fiona_4_env_ConfigEnv *)o;
11147   tmp = ((PyObject*)p->options);
11148   p->options = Py_None; Py_INCREF(Py_None);
11149   Py_XDECREF(tmp);
11150   return 0;
11151 }
11152 
__pyx_getprop_5fiona_4_env_9ConfigEnv_options(PyObject * o,CYTHON_UNUSED void * x)11153 static PyObject *__pyx_getprop_5fiona_4_env_9ConfigEnv_options(PyObject *o, CYTHON_UNUSED void *x) {
11154   return __pyx_pw_5fiona_4_env_9ConfigEnv_7options_1__get__(o);
11155 }
11156 
__pyx_setprop_5fiona_4_env_9ConfigEnv_options(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)11157 static int __pyx_setprop_5fiona_4_env_9ConfigEnv_options(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
11158   if (v) {
11159     return __pyx_pw_5fiona_4_env_9ConfigEnv_7options_3__set__(o, v);
11160   }
11161   else {
11162     return __pyx_pw_5fiona_4_env_9ConfigEnv_7options_5__del__(o);
11163   }
11164 }
11165 
11166 static PyMethodDef __pyx_methods_5fiona_4_env_ConfigEnv[] = {
11167   {"update_config_options", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_9ConfigEnv_3update_config_options, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_9ConfigEnv_2update_config_options},
11168   {"clear_config_options", (PyCFunction)__pyx_pw_5fiona_4_env_9ConfigEnv_5clear_config_options, METH_NOARGS, __pyx_doc_5fiona_4_env_9ConfigEnv_4clear_config_options},
11169   {"get_config_options", (PyCFunction)__pyx_pw_5fiona_4_env_9ConfigEnv_7get_config_options, METH_NOARGS, 0},
11170   {"__reduce_cython__", (PyCFunction)__pyx_pw_5fiona_4_env_9ConfigEnv_9__reduce_cython__, METH_NOARGS, 0},
11171   {"__setstate_cython__", (PyCFunction)__pyx_pw_5fiona_4_env_9ConfigEnv_11__setstate_cython__, METH_O, 0},
11172   {0, 0, 0, 0}
11173 };
11174 
11175 static struct PyGetSetDef __pyx_getsets_5fiona_4_env_ConfigEnv[] = {
11176   {(char *)"options", __pyx_getprop_5fiona_4_env_9ConfigEnv_options, __pyx_setprop_5fiona_4_env_9ConfigEnv_options, (char *)0, 0},
11177   {0, 0, 0, 0, 0}
11178 };
11179 
11180 static PyTypeObject __pyx_type_5fiona_4_env_ConfigEnv = {
11181   PyVarObject_HEAD_INIT(0, 0)
11182   "fiona._env.ConfigEnv", /*tp_name*/
11183   sizeof(struct __pyx_obj_5fiona_4_env_ConfigEnv), /*tp_basicsize*/
11184   0, /*tp_itemsize*/
11185   __pyx_tp_dealloc_5fiona_4_env_ConfigEnv, /*tp_dealloc*/
11186   #if PY_VERSION_HEX < 0x030800b4
11187   0, /*tp_print*/
11188   #endif
11189   #if PY_VERSION_HEX >= 0x030800b4
11190   0, /*tp_vectorcall_offset*/
11191   #endif
11192   0, /*tp_getattr*/
11193   0, /*tp_setattr*/
11194   #if PY_MAJOR_VERSION < 3
11195   0, /*tp_compare*/
11196   #endif
11197   #if PY_MAJOR_VERSION >= 3
11198   0, /*tp_as_async*/
11199   #endif
11200   0, /*tp_repr*/
11201   0, /*tp_as_number*/
11202   0, /*tp_as_sequence*/
11203   0, /*tp_as_mapping*/
11204   0, /*tp_hash*/
11205   0, /*tp_call*/
11206   0, /*tp_str*/
11207   0, /*tp_getattro*/
11208   0, /*tp_setattro*/
11209   0, /*tp_as_buffer*/
11210   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11211   "Configuration option management", /*tp_doc*/
11212   __pyx_tp_traverse_5fiona_4_env_ConfigEnv, /*tp_traverse*/
11213   __pyx_tp_clear_5fiona_4_env_ConfigEnv, /*tp_clear*/
11214   0, /*tp_richcompare*/
11215   0, /*tp_weaklistoffset*/
11216   0, /*tp_iter*/
11217   0, /*tp_iternext*/
11218   __pyx_methods_5fiona_4_env_ConfigEnv, /*tp_methods*/
11219   0, /*tp_members*/
11220   __pyx_getsets_5fiona_4_env_ConfigEnv, /*tp_getset*/
11221   0, /*tp_base*/
11222   0, /*tp_dict*/
11223   0, /*tp_descr_get*/
11224   0, /*tp_descr_set*/
11225   0, /*tp_dictoffset*/
11226   __pyx_pw_5fiona_4_env_9ConfigEnv_1__init__, /*tp_init*/
11227   0, /*tp_alloc*/
11228   __pyx_tp_new_5fiona_4_env_ConfigEnv, /*tp_new*/
11229   0, /*tp_free*/
11230   0, /*tp_is_gc*/
11231   0, /*tp_bases*/
11232   0, /*tp_mro*/
11233   0, /*tp_cache*/
11234   0, /*tp_subclasses*/
11235   0, /*tp_weaklist*/
11236   0, /*tp_del*/
11237   0, /*tp_version_tag*/
11238   #if PY_VERSION_HEX >= 0x030400a1
11239   0, /*tp_finalize*/
11240   #endif
11241   #if PY_VERSION_HEX >= 0x030800b1
11242   0, /*tp_vectorcall*/
11243   #endif
11244   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11245   0, /*tp_print*/
11246   #endif
11247 };
11248 
__pyx_tp_new_5fiona_4_env_GDALEnv(PyTypeObject * t,PyObject * a,PyObject * k)11249 static PyObject *__pyx_tp_new_5fiona_4_env_GDALEnv(PyTypeObject *t, PyObject *a, PyObject *k) {
11250   struct __pyx_obj_5fiona_4_env_GDALEnv *p;
11251   PyObject *o = __pyx_tp_new_5fiona_4_env_ConfigEnv(t, a, k);
11252   if (unlikely(!o)) return 0;
11253   p = ((struct __pyx_obj_5fiona_4_env_GDALEnv *)o);
11254   p->_have_registered_drivers = Py_None; Py_INCREF(Py_None);
11255   return o;
11256 }
11257 
__pyx_tp_dealloc_5fiona_4_env_GDALEnv(PyObject * o)11258 static void __pyx_tp_dealloc_5fiona_4_env_GDALEnv(PyObject *o) {
11259   struct __pyx_obj_5fiona_4_env_GDALEnv *p = (struct __pyx_obj_5fiona_4_env_GDALEnv *)o;
11260   #if CYTHON_USE_TP_FINALIZE
11261   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
11262     if (PyObject_CallFinalizerFromDealloc(o)) return;
11263   }
11264   #endif
11265   PyObject_GC_UnTrack(o);
11266   Py_CLEAR(p->_have_registered_drivers);
11267   PyObject_GC_Track(o);
11268   __pyx_tp_dealloc_5fiona_4_env_ConfigEnv(o);
11269 }
11270 
__pyx_tp_traverse_5fiona_4_env_GDALEnv(PyObject * o,visitproc v,void * a)11271 static int __pyx_tp_traverse_5fiona_4_env_GDALEnv(PyObject *o, visitproc v, void *a) {
11272   int e;
11273   struct __pyx_obj_5fiona_4_env_GDALEnv *p = (struct __pyx_obj_5fiona_4_env_GDALEnv *)o;
11274   e = __pyx_tp_traverse_5fiona_4_env_ConfigEnv(o, v, a); if (e) return e;
11275   if (p->_have_registered_drivers) {
11276     e = (*v)(p->_have_registered_drivers, a); if (e) return e;
11277   }
11278   return 0;
11279 }
11280 
__pyx_tp_clear_5fiona_4_env_GDALEnv(PyObject * o)11281 static int __pyx_tp_clear_5fiona_4_env_GDALEnv(PyObject *o) {
11282   PyObject* tmp;
11283   struct __pyx_obj_5fiona_4_env_GDALEnv *p = (struct __pyx_obj_5fiona_4_env_GDALEnv *)o;
11284   __pyx_tp_clear_5fiona_4_env_ConfigEnv(o);
11285   tmp = ((PyObject*)p->_have_registered_drivers);
11286   p->_have_registered_drivers = Py_None; Py_INCREF(Py_None);
11287   Py_XDECREF(tmp);
11288   return 0;
11289 }
11290 
__pyx_getprop_5fiona_4_env_7GDALEnv__have_registered_drivers(PyObject * o,CYTHON_UNUSED void * x)11291 static PyObject *__pyx_getprop_5fiona_4_env_7GDALEnv__have_registered_drivers(PyObject *o, CYTHON_UNUSED void *x) {
11292   return __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_1__get__(o);
11293 }
11294 
__pyx_setprop_5fiona_4_env_7GDALEnv__have_registered_drivers(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)11295 static int __pyx_setprop_5fiona_4_env_7GDALEnv__have_registered_drivers(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
11296   if (v) {
11297     return __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_3__set__(o, v);
11298   }
11299   else {
11300     return __pyx_pw_5fiona_4_env_7GDALEnv_24_have_registered_drivers_5__del__(o);
11301   }
11302 }
11303 
11304 static PyMethodDef __pyx_methods_5fiona_4_env_GDALEnv[] = {
11305   {"start", (PyCFunction)__pyx_pw_5fiona_4_env_7GDALEnv_3start, METH_NOARGS, 0},
11306   {"stop", (PyCFunction)__pyx_pw_5fiona_4_env_7GDALEnv_5stop, METH_NOARGS, 0},
11307   {"drivers", (PyCFunction)__pyx_pw_5fiona_4_env_7GDALEnv_7drivers, METH_NOARGS, 0},
11308   {"__reduce_cython__", (PyCFunction)__pyx_pw_5fiona_4_env_7GDALEnv_9__reduce_cython__, METH_NOARGS, 0},
11309   {"__setstate_cython__", (PyCFunction)__pyx_pw_5fiona_4_env_7GDALEnv_11__setstate_cython__, METH_O, 0},
11310   {0, 0, 0, 0}
11311 };
11312 
11313 static struct PyGetSetDef __pyx_getsets_5fiona_4_env_GDALEnv[] = {
11314   {(char *)"_have_registered_drivers", __pyx_getprop_5fiona_4_env_7GDALEnv__have_registered_drivers, __pyx_setprop_5fiona_4_env_7GDALEnv__have_registered_drivers, (char *)0, 0},
11315   {0, 0, 0, 0, 0}
11316 };
11317 
11318 static PyTypeObject __pyx_type_5fiona_4_env_GDALEnv = {
11319   PyVarObject_HEAD_INIT(0, 0)
11320   "fiona._env.GDALEnv", /*tp_name*/
11321   sizeof(struct __pyx_obj_5fiona_4_env_GDALEnv), /*tp_basicsize*/
11322   0, /*tp_itemsize*/
11323   __pyx_tp_dealloc_5fiona_4_env_GDALEnv, /*tp_dealloc*/
11324   #if PY_VERSION_HEX < 0x030800b4
11325   0, /*tp_print*/
11326   #endif
11327   #if PY_VERSION_HEX >= 0x030800b4
11328   0, /*tp_vectorcall_offset*/
11329   #endif
11330   0, /*tp_getattr*/
11331   0, /*tp_setattr*/
11332   #if PY_MAJOR_VERSION < 3
11333   0, /*tp_compare*/
11334   #endif
11335   #if PY_MAJOR_VERSION >= 3
11336   0, /*tp_as_async*/
11337   #endif
11338   0, /*tp_repr*/
11339   0, /*tp_as_number*/
11340   0, /*tp_as_sequence*/
11341   0, /*tp_as_mapping*/
11342   0, /*tp_hash*/
11343   0, /*tp_call*/
11344   0, /*tp_str*/
11345   0, /*tp_getattro*/
11346   0, /*tp_setattro*/
11347   0, /*tp_as_buffer*/
11348   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11349   "Configuration and driver management", /*tp_doc*/
11350   __pyx_tp_traverse_5fiona_4_env_GDALEnv, /*tp_traverse*/
11351   __pyx_tp_clear_5fiona_4_env_GDALEnv, /*tp_clear*/
11352   0, /*tp_richcompare*/
11353   0, /*tp_weaklistoffset*/
11354   0, /*tp_iter*/
11355   0, /*tp_iternext*/
11356   __pyx_methods_5fiona_4_env_GDALEnv, /*tp_methods*/
11357   0, /*tp_members*/
11358   __pyx_getsets_5fiona_4_env_GDALEnv, /*tp_getset*/
11359   0, /*tp_base*/
11360   0, /*tp_dict*/
11361   0, /*tp_descr_get*/
11362   0, /*tp_descr_set*/
11363   0, /*tp_dictoffset*/
11364   __pyx_pw_5fiona_4_env_7GDALEnv_1__init__, /*tp_init*/
11365   0, /*tp_alloc*/
11366   __pyx_tp_new_5fiona_4_env_GDALEnv, /*tp_new*/
11367   0, /*tp_free*/
11368   0, /*tp_is_gc*/
11369   0, /*tp_bases*/
11370   0, /*tp_mro*/
11371   0, /*tp_cache*/
11372   0, /*tp_subclasses*/
11373   0, /*tp_weaklist*/
11374   0, /*tp_del*/
11375   0, /*tp_version_tag*/
11376   #if PY_VERSION_HEX >= 0x030400a1
11377   0, /*tp_finalize*/
11378   #endif
11379   #if PY_VERSION_HEX >= 0x030800b1
11380   0, /*tp_vectorcall*/
11381   #endif
11382   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11383   0, /*tp_print*/
11384   #endif
11385 };
11386 
11387 static PyMethodDef __pyx_methods[] = {
11388   {"get_gdal_config", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_13get_gdal_config, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_12get_gdal_config},
11389   {"set_gdal_config", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5fiona_4_env_15set_gdal_config, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fiona_4_env_14set_gdal_config},
11390   {"del_gdal_config", (PyCFunction)__pyx_pw_5fiona_4_env_17del_gdal_config, METH_O, __pyx_doc_5fiona_4_env_16del_gdal_config},
11391   {0, 0, 0, 0}
11392 };
11393 
11394 #if PY_MAJOR_VERSION >= 3
11395 #if CYTHON_PEP489_MULTI_PHASE_INIT
11396 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
11397 static int __pyx_pymod_exec__env(PyObject* module); /*proto*/
11398 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
11399   {Py_mod_create, (void*)__pyx_pymod_create},
11400   {Py_mod_exec, (void*)__pyx_pymod_exec__env},
11401   {0, NULL}
11402 };
11403 #endif
11404 
11405 static struct PyModuleDef __pyx_moduledef = {
11406     PyModuleDef_HEAD_INIT,
11407     "_env",
11408     __pyx_k_GDAL_and_OGR_driver_and_configur, /* m_doc */
11409   #if CYTHON_PEP489_MULTI_PHASE_INIT
11410     0, /* m_size */
11411   #else
11412     -1, /* m_size */
11413   #endif
11414     __pyx_methods /* m_methods */,
11415   #if CYTHON_PEP489_MULTI_PHASE_INIT
11416     __pyx_moduledef_slots, /* m_slots */
11417   #else
11418     NULL, /* m_reload */
11419   #endif
11420     NULL, /* m_traverse */
11421     NULL, /* m_clear */
11422     NULL /* m_free */
11423 };
11424 #endif
11425 #ifndef CYTHON_SMALL_CODE
11426 #if defined(__clang__)
11427     #define CYTHON_SMALL_CODE
11428 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
11429     #define CYTHON_SMALL_CODE __attribute__((cold))
11430 #else
11431     #define CYTHON_SMALL_CODE
11432 #endif
11433 #endif
11434 
11435 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11436   {&__pyx_n_u_CPLE_AWSAccessDenied, __pyx_k_CPLE_AWSAccessDenied, sizeof(__pyx_k_CPLE_AWSAccessDenied), 0, 1, 0, 1},
11437   {&__pyx_n_u_CPLE_AWSBucketNotFound, __pyx_k_CPLE_AWSBucketNotFound, sizeof(__pyx_k_CPLE_AWSBucketNotFound), 0, 1, 0, 1},
11438   {&__pyx_n_u_CPLE_AWSInvalidCredentials, __pyx_k_CPLE_AWSInvalidCredentials, sizeof(__pyx_k_CPLE_AWSInvalidCredentials), 0, 1, 0, 1},
11439   {&__pyx_n_u_CPLE_AWSObjectNotFound, __pyx_k_CPLE_AWSObjectNotFound, sizeof(__pyx_k_CPLE_AWSObjectNotFound), 0, 1, 0, 1},
11440   {&__pyx_n_u_CPLE_AWSSignatureDoesNotMatch, __pyx_k_CPLE_AWSSignatureDoesNotMatch, sizeof(__pyx_k_CPLE_AWSSignatureDoesNotMatch), 0, 1, 0, 1},
11441   {&__pyx_n_u_CPLE_AppDefined, __pyx_k_CPLE_AppDefined, sizeof(__pyx_k_CPLE_AppDefined), 0, 1, 0, 1},
11442   {&__pyx_n_u_CPLE_AssertionFailed, __pyx_k_CPLE_AssertionFailed, sizeof(__pyx_k_CPLE_AssertionFailed), 0, 1, 0, 1},
11443   {&__pyx_n_s_CPLE_BaseError, __pyx_k_CPLE_BaseError, sizeof(__pyx_k_CPLE_BaseError), 0, 0, 1, 1},
11444   {&__pyx_n_u_CPLE_FileIO, __pyx_k_CPLE_FileIO, sizeof(__pyx_k_CPLE_FileIO), 0, 1, 0, 1},
11445   {&__pyx_n_u_CPLE_HttpResponse, __pyx_k_CPLE_HttpResponse, sizeof(__pyx_k_CPLE_HttpResponse), 0, 1, 0, 1},
11446   {&__pyx_n_u_CPLE_IllegalArg, __pyx_k_CPLE_IllegalArg, sizeof(__pyx_k_CPLE_IllegalArg), 0, 1, 0, 1},
11447   {&__pyx_n_u_CPLE_NoWriteAccess, __pyx_k_CPLE_NoWriteAccess, sizeof(__pyx_k_CPLE_NoWriteAccess), 0, 1, 0, 1},
11448   {&__pyx_n_u_CPLE_None, __pyx_k_CPLE_None, sizeof(__pyx_k_CPLE_None), 0, 1, 0, 1},
11449   {&__pyx_n_u_CPLE_NotSupported, __pyx_k_CPLE_NotSupported, sizeof(__pyx_k_CPLE_NotSupported), 0, 1, 0, 1},
11450   {&__pyx_n_u_CPLE_OpenFailed, __pyx_k_CPLE_OpenFailed, sizeof(__pyx_k_CPLE_OpenFailed), 0, 1, 0, 1},
11451   {&__pyx_n_u_CPLE_OutOfMemory, __pyx_k_CPLE_OutOfMemory, sizeof(__pyx_k_CPLE_OutOfMemory), 0, 1, 0, 1},
11452   {&__pyx_n_u_CPLE_UserInterrupt, __pyx_k_CPLE_UserInterrupt, sizeof(__pyx_k_CPLE_UserInterrupt), 0, 1, 0, 1},
11453   {&__pyx_n_s_CRITICAL, __pyx_k_CRITICAL, sizeof(__pyx_k_CRITICAL), 0, 0, 1, 1},
11454   {&__pyx_n_u_CURL_CA_BUNDLE, __pyx_k_CURL_CA_BUNDLE, sizeof(__pyx_k_CURL_CA_BUNDLE), 0, 1, 0, 1},
11455   {&__pyx_n_s_ConfigEnv, __pyx_k_ConfigEnv, sizeof(__pyx_k_ConfigEnv), 0, 0, 1, 1},
11456   {&__pyx_n_s_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1},
11457   {&__pyx_kp_u_Drivers_not_registered, __pyx_k_Drivers_not_registered, sizeof(__pyx_k_Drivers_not_registered), 0, 1, 0, 0},
11458   {&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1},
11459   {&__pyx_n_s_EnvError, __pyx_k_EnvError, sizeof(__pyx_k_EnvError), 0, 0, 1, 1},
11460   {&__pyx_kp_u_Error_handler_popped, __pyx_k_Error_handler_popped, sizeof(__pyx_k_Error_handler_popped), 0, 1, 0, 0},
11461   {&__pyx_kp_s_Finds_GDAL_data_files_Note_this, __pyx_k_Finds_GDAL_data_files_Note_this, sizeof(__pyx_k_Finds_GDAL_data_files_Note_this), 0, 0, 1, 0},
11462   {&__pyx_kp_s_Finds_PROJ_data_files_Note_this, __pyx_k_Finds_PROJ_data_files_Note_this, sizeof(__pyx_k_Finds_PROJ_data_files_Note_this), 0, 0, 1, 0},
11463   {&__pyx_n_s_GDALDataFinder, __pyx_k_GDALDataFinder, sizeof(__pyx_k_GDALDataFinder), 0, 0, 1, 1},
11464   {&__pyx_n_s_GDALDataFinder_find_file, __pyx_k_GDALDataFinder_find_file, sizeof(__pyx_k_GDALDataFinder_find_file), 0, 0, 1, 1},
11465   {&__pyx_n_s_GDALDataFinder_search, __pyx_k_GDALDataFinder_search, sizeof(__pyx_k_GDALDataFinder_search), 0, 0, 1, 1},
11466   {&__pyx_n_s_GDALDataFinder_search_debian, __pyx_k_GDALDataFinder_search_debian, sizeof(__pyx_k_GDALDataFinder_search_debian), 0, 0, 1, 1},
11467   {&__pyx_n_s_GDALDataFinder_search_prefix, __pyx_k_GDALDataFinder_search_prefix, sizeof(__pyx_k_GDALDataFinder_search_prefix), 0, 0, 1, 1},
11468   {&__pyx_n_s_GDALDataFinder_search_wheel, __pyx_k_GDALDataFinder_search_wheel, sizeof(__pyx_k_GDALDataFinder_search_wheel), 0, 0, 1, 1},
11469   {&__pyx_n_s_GDALEnv, __pyx_k_GDALEnv, sizeof(__pyx_k_GDALEnv), 0, 0, 1, 1},
11470   {&__pyx_n_s_GDALVersion, __pyx_k_GDALVersion, sizeof(__pyx_k_GDALVersion), 0, 0, 1, 1},
11471   {&__pyx_n_u_GDALVersion, __pyx_k_GDALVersion, sizeof(__pyx_k_GDALVersion), 0, 1, 0, 1},
11472   {&__pyx_n_s_GDAL_DATA, __pyx_k_GDAL_DATA, sizeof(__pyx_k_GDAL_DATA), 0, 0, 1, 1},
11473   {&__pyx_n_u_GDAL_DATA, __pyx_k_GDAL_DATA, sizeof(__pyx_k_GDAL_DATA), 0, 1, 0, 1},
11474   {&__pyx_kp_u_GDAL_DATA_found_in_environment, __pyx_k_GDAL_DATA_found_in_environment, sizeof(__pyx_k_GDAL_DATA_found_in_environment), 0, 1, 0, 0},
11475   {&__pyx_kp_u_GDAL_data_files_are_available_at, __pyx_k_GDAL_data_files_are_available_at, sizeof(__pyx_k_GDAL_data_files_are_available_at), 0, 1, 0, 0},
11476   {&__pyx_kp_u_GDAL_data_found_in_other_locatio, __pyx_k_GDAL_data_found_in_other_locatio, sizeof(__pyx_k_GDAL_data_found_in_other_locatio), 0, 1, 0, 0},
11477   {&__pyx_kp_u_GDAL_data_found_in_package_path, __pyx_k_GDAL_data_found_in_package_path, sizeof(__pyx_k_GDAL_data_found_in_package_path), 0, 1, 0, 0},
11478   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
11479   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x26, __pyx_k_Incompatible_checksums_s_vs_0x26, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x26), 0, 0, 1, 0},
11480   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x93, __pyx_k_Incompatible_checksums_s_vs_0x93, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x93), 0, 0, 1, 0},
11481   {&__pyx_n_s_Lock, __pyx_k_Lock, sizeof(__pyx_k_Lock), 0, 0, 1, 1},
11482   {&__pyx_n_s_MainThread, __pyx_k_MainThread, sizeof(__pyx_k_MainThread), 0, 0, 1, 1},
11483   {&__pyx_n_u_OFF, __pyx_k_OFF, sizeof(__pyx_k_OFF), 0, 1, 0, 1},
11484   {&__pyx_n_u_ON, __pyx_k_ON, sizeof(__pyx_k_ON), 0, 1, 0, 1},
11485   {&__pyx_n_u_ObjectNull, __pyx_k_ObjectNull, sizeof(__pyx_k_ObjectNull), 0, 1, 0, 1},
11486   {&__pyx_n_s_PROJDataFinder, __pyx_k_PROJDataFinder, sizeof(__pyx_k_PROJDataFinder), 0, 0, 1, 1},
11487   {&__pyx_n_s_PROJDataFinder_has_data, __pyx_k_PROJDataFinder_has_data, sizeof(__pyx_k_PROJDataFinder_has_data), 0, 0, 1, 1},
11488   {&__pyx_n_s_PROJDataFinder_search, __pyx_k_PROJDataFinder_search, sizeof(__pyx_k_PROJDataFinder_search), 0, 0, 1, 1},
11489   {&__pyx_n_s_PROJDataFinder_search_prefix, __pyx_k_PROJDataFinder_search_prefix, sizeof(__pyx_k_PROJDataFinder_search_prefix), 0, 0, 1, 1},
11490   {&__pyx_n_s_PROJDataFinder_search_wheel, __pyx_k_PROJDataFinder_search_wheel, sizeof(__pyx_k_PROJDataFinder_search_wheel), 0, 0, 1, 1},
11491   {&__pyx_n_u_PROJ_LIB, __pyx_k_PROJ_LIB, sizeof(__pyx_k_PROJ_LIB), 0, 1, 0, 1},
11492   {&__pyx_kp_u_PROJ_LIB_found_in_environment, __pyx_k_PROJ_LIB_found_in_environment, sizeof(__pyx_k_PROJ_LIB_found_in_environment), 0, 1, 0, 0},
11493   {&__pyx_kp_u_PROJ_data_files_are_available_at, __pyx_k_PROJ_data_files_are_available_at, sizeof(__pyx_k_PROJ_data_files_are_available_at), 0, 1, 0, 0},
11494   {&__pyx_kp_u_PROJ_data_found_in_other_locatio, __pyx_k_PROJ_data_found_in_other_locatio, sizeof(__pyx_k_PROJ_data_found_in_other_locatio), 0, 1, 0, 0},
11495   {&__pyx_kp_u_PROJ_data_found_in_package_path, __pyx_k_PROJ_data_found_in_package_path, sizeof(__pyx_k_PROJ_data_found_in_package_path), 0, 1, 0, 0},
11496   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
11497   {&__pyx_kp_u_Started_GDALEnv_self_r, __pyx_k_Started_GDALEnv_self_r, sizeof(__pyx_k_Started_GDALEnv_self_r), 0, 1, 0, 0},
11498   {&__pyx_kp_u_Stopped_GDALEnv_r, __pyx_k_Stopped_GDALEnv_r, sizeof(__pyx_k_Stopped_GDALEnv_r), 0, 1, 0, 0},
11499   {&__pyx_kp_u_Stopping_GDALEnv_r, __pyx_k_Stopping_GDALEnv_r, sizeof(__pyx_k_Stopping_GDALEnv_r), 0, 1, 0, 0},
11500   {&__pyx_kp_u_Unknown_error_number_r, __pyx_k_Unknown_error_number_r, sizeof(__pyx_k_Unknown_error_number_r), 0, 1, 0, 0},
11501   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
11502   {&__pyx_n_s_WARNING, __pyx_k_WARNING, sizeof(__pyx_k_WARNING), 0, 0, 1, 1},
11503   {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
11504   {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
11505   {&__pyx_n_s_abspath, __pyx_k_abspath, sizeof(__pyx_k_abspath), 0, 0, 1, 1},
11506   {&__pyx_n_s_basename, __pyx_k_basename, sizeof(__pyx_k_basename), 0, 0, 1, 1},
11507   {&__pyx_n_s_basename_b, __pyx_k_basename_b, sizeof(__pyx_k_basename_b), 0, 0, 1, 1},
11508   {&__pyx_n_s_calc_gdal_version_num, __pyx_k_calc_gdal_version_num, sizeof(__pyx_k_calc_gdal_version_num), 0, 0, 1, 1},
11509   {&__pyx_n_s_certifi, __pyx_k_certifi, sizeof(__pyx_k_certifi), 0, 0, 1, 1},
11510   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
11511   {&__pyx_n_s_code_map, __pyx_k_code_map, sizeof(__pyx_k_code_map), 0, 0, 1, 1},
11512   {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
11513   {&__pyx_n_s_current_thread, __pyx_k_current_thread, sizeof(__pyx_k_current_thread), 0, 0, 1, 1},
11514   {&__pyx_n_s_datadir, __pyx_k_datadir, sizeof(__pyx_k_datadir), 0, 0, 1, 1},
11515   {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
11516   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
11517   {&__pyx_n_s_dirname, __pyx_k_dirname, sizeof(__pyx_k_dirname), 0, 0, 1, 1},
11518   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
11519   {&__pyx_n_s_driver_count, __pyx_k_driver_count, sizeof(__pyx_k_driver_count), 0, 0, 1, 1},
11520   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
11521   {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
11522   {&__pyx_n_s_environ, __pyx_k_environ, sizeof(__pyx_k_environ), 0, 0, 1, 1},
11523   {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
11524   {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
11525   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
11526   {&__pyx_n_s_find_file, __pyx_k_find_file, sizeof(__pyx_k_find_file), 0, 0, 1, 1},
11527   {&__pyx_n_s_fiona__env, __pyx_k_fiona__env, sizeof(__pyx_k_fiona__env), 0, 0, 1, 1},
11528   {&__pyx_kp_s_fiona__env_pyx, __pyx_k_fiona__env_pyx, sizeof(__pyx_k_fiona__env_pyx), 0, 0, 1, 0},
11529   {&__pyx_n_s_fiona__err, __pyx_k_fiona__err, sizeof(__pyx_k_fiona__err), 0, 0, 1, 1},
11530   {&__pyx_n_s_fiona_errors, __pyx_k_fiona_errors, sizeof(__pyx_k_fiona_errors), 0, 0, 1, 1},
11531   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
11532   {&__pyx_n_u_gdal, __pyx_k_gdal, sizeof(__pyx_k_gdal), 0, 1, 0, 1},
11533   {&__pyx_n_b_gdal_cachemax, __pyx_k_gdal_cachemax, sizeof(__pyx_k_gdal_cachemax), 0, 0, 0, 1},
11534   {&__pyx_n_u_gdal_data, __pyx_k_gdal_data, sizeof(__pyx_k_gdal_data), 0, 1, 0, 1},
11535   {&__pyx_n_s_gdal_release_name, __pyx_k_gdal_release_name, sizeof(__pyx_k_gdal_release_name), 0, 0, 1, 1},
11536   {&__pyx_n_s_gdal_version_num, __pyx_k_gdal_version_num, sizeof(__pyx_k_gdal_version_num), 0, 0, 1, 1},
11537   {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
11538   {&__pyx_n_s_get_gdal_release_name, __pyx_k_get_gdal_release_name, sizeof(__pyx_k_get_gdal_release_name), 0, 0, 1, 1},
11539   {&__pyx_n_s_get_gdal_version_num, __pyx_k_get_gdal_version_num, sizeof(__pyx_k_get_gdal_version_num), 0, 0, 1, 1},
11540   {&__pyx_n_s_get_gdal_version_tuple, __pyx_k_get_gdal_version_tuple, sizeof(__pyx_k_get_gdal_version_tuple), 0, 0, 1, 1},
11541   {&__pyx_n_s_get_proj_version_tuple, __pyx_k_get_proj_version_tuple, sizeof(__pyx_k_get_proj_version_tuple), 0, 0, 1, 1},
11542   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
11543   {&__pyx_n_s_has_data, __pyx_k_has_data, sizeof(__pyx_k_has_data), 0, 0, 1, 1},
11544   {&__pyx_kp_u_header_dxf, __pyx_k_header_dxf, sizeof(__pyx_k_header_dxf), 0, 1, 0, 0},
11545   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11546   {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
11547   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
11548   {&__pyx_n_s_isdigit, __pyx_k_isdigit, sizeof(__pyx_k_isdigit), 0, 0, 1, 1},
11549   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
11550   {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
11551   {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
11552   {&__pyx_n_s_level_map, __pyx_k_level_map, sizeof(__pyx_k_level_map), 0, 0, 1, 1},
11553   {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
11554   {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
11555   {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
11556   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11557   {&__pyx_n_s_maj, __pyx_k_maj, sizeof(__pyx_k_maj), 0, 0, 1, 1},
11558   {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
11559   {&__pyx_n_u_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 1, 0, 1},
11560   {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1},
11561   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
11562   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
11563   {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1},
11564   {&__pyx_n_u_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 1, 0, 1},
11565   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
11566   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11567   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
11568   {&__pyx_n_s_name_c, __pyx_k_name_c, sizeof(__pyx_k_name_c), 0, 0, 1, 1},
11569   {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
11570   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
11571   {&__pyx_n_s_normalize, __pyx_k_normalize, sizeof(__pyx_k_normalize), 0, 0, 1, 1},
11572   {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
11573   {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
11574   {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
11575   {&__pyx_n_s_osr, __pyx_k_osr, sizeof(__pyx_k_osr), 0, 0, 1, 1},
11576   {&__pyx_n_s_patch, __pyx_k_patch, sizeof(__pyx_k_patch), 0, 0, 1, 1},
11577   {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
11578   {&__pyx_n_s_path_c, __pyx_k_path_c, sizeof(__pyx_k_path_c), 0, 0, 1, 1},
11579   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
11580   {&__pyx_n_s_popitem, __pyx_k_popitem, sizeof(__pyx_k_popitem), 0, 0, 1, 1},
11581   {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
11582   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
11583   {&__pyx_n_u_proj, __pyx_k_proj, sizeof(__pyx_k_proj), 0, 1, 0, 1},
11584   {&__pyx_n_u_proj_data, __pyx_k_proj_data, sizeof(__pyx_k_proj_data), 0, 1, 0, 1},
11585   {&__pyx_n_s_proj_version, __pyx_k_proj_version, sizeof(__pyx_k_proj_version), 0, 0, 1, 1},
11586   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
11587   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
11588   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
11589   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
11590   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
11591   {&__pyx_n_s_pyx_unpickle_ConfigEnv, __pyx_k_pyx_unpickle_ConfigEnv, sizeof(__pyx_k_pyx_unpickle_ConfigEnv), 0, 0, 1, 1},
11592   {&__pyx_n_s_pyx_unpickle_GDALEnv, __pyx_k_pyx_unpickle_GDALEnv, sizeof(__pyx_k_pyx_unpickle_GDALEnv), 0, 0, 1, 1},
11593   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
11594   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11595   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
11596   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
11597   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
11598   {&__pyx_n_s_rev, __pyx_k_rev, sizeof(__pyx_k_rev), 0, 0, 1, 1},
11599   {&__pyx_n_s_revision, __pyx_k_revision, sizeof(__pyx_k_revision), 0, 0, 1, 1},
11600   {&__pyx_n_u_revision, __pyx_k_revision, sizeof(__pyx_k_revision), 0, 1, 0, 1},
11601   {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
11602   {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
11603   {&__pyx_n_s_search_debian, __pyx_k_search_debian, sizeof(__pyx_k_search_debian), 0, 0, 1, 1},
11604   {&__pyx_n_s_search_prefix, __pyx_k_search_prefix, sizeof(__pyx_k_search_prefix), 0, 0, 1, 1},
11605   {&__pyx_n_s_search_wheel, __pyx_k_search_wheel, sizeof(__pyx_k_search_wheel), 0, 0, 1, 1},
11606   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
11607   {&__pyx_n_s_set_proj_data_search_path, __pyx_k_set_proj_data_search_path, sizeof(__pyx_k_set_proj_data_search_path), 0, 0, 1, 1},
11608   {&__pyx_n_s_setdefault, __pyx_k_setdefault, sizeof(__pyx_k_setdefault), 0, 0, 1, 1},
11609   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
11610   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
11611   {&__pyx_n_u_share, __pyx_k_share, sizeof(__pyx_k_share), 0, 1, 0, 1},
11612   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
11613   {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
11614   {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
11615   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11616   {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
11617   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
11618   {&__pyx_n_s_update_config_options, __pyx_k_update_config_options, sizeof(__pyx_k_update_config_options), 0, 0, 1, 1},
11619   {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
11620   {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
11621   {&__pyx_n_s_where, __pyx_k_where, sizeof(__pyx_k_where), 0, 0, 1, 1},
11622   {0, 0, 0, 0, 0, 0, 0}
11623 };
__Pyx_InitCachedBuiltins(void)11624 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
11625   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 61, __pyx_L1_error)
11626   __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 269, __pyx_L1_error)
11627   __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 391, __pyx_L1_error)
11628   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 453, __pyx_L1_error)
11629   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 477, __pyx_L1_error)
11630   return 0;
11631   __pyx_L1_error:;
11632   return -1;
11633 }
11634 
__Pyx_InitCachedConstants(void)11635 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
11636   __Pyx_RefNannyDeclarations
11637   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11638 
11639   /* "fiona/_env.pyx":80
11640  *
11641  *     """
11642  *     if (maj, min, rev) >= (1, 10, 0):             # <<<<<<<<<<<<<<
11643  *         return int(maj * 1000000 + min * 10000 + rev * 100)
11644  *     else:
11645  */
11646   __pyx_tuple_ = PyTuple_Pack(3, __pyx_int_1, __pyx_int_10, __pyx_int_0); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 80, __pyx_L1_error)
11647   __Pyx_GOTREF(__pyx_tuple_);
11648   __Pyx_GIVEREF(__pyx_tuple_);
11649 
11650   /* "fiona/_env.pyx":130
11651  *     cdef int patch
11652  *     gdal_version_num = get_gdal_version_num()
11653  *     if gdal_version_num < calc_gdal_version_num(3, 0, 1):             # <<<<<<<<<<<<<<
11654  *         proj_version = None
11655  *     else:
11656  */
11657   __pyx_tuple__2 = PyTuple_Pack(3, __pyx_int_3, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 130, __pyx_L1_error)
11658   __Pyx_GOTREF(__pyx_tuple__2);
11659   __Pyx_GIVEREF(__pyx_tuple__2);
11660 
11661   /* "fiona/_env.pyx":329
11662  *         """Check Debian locations"""
11663  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
11664  *         datadir = os.path.join(prefix, 'share', 'gdal', '{}.{}'.format(*gdal_release_name.split('.')[:2]))             # <<<<<<<<<<<<<<
11665  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
11666  *
11667  */
11668   __pyx_slice__5 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 329, __pyx_L1_error)
11669   __Pyx_GOTREF(__pyx_slice__5);
11670   __Pyx_GIVEREF(__pyx_slice__5);
11671 
11672   /* "fiona/_env.pyx":453
11673  *                     if driver_count() == 0:
11674  *                         CPLPopErrorHandler()
11675  *                         raise ValueError("Drivers not registered.")             # <<<<<<<<<<<<<<
11676  *
11677  *                     # Flag the drivers as registered, otherwise every thread
11678  */
11679   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Drivers_not_registered); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 453, __pyx_L1_error)
11680   __Pyx_GOTREF(__pyx_tuple__6);
11681   __Pyx_GIVEREF(__pyx_tuple__6);
11682 
11683   /* "fiona/_env.pyx":401
11684  *         # potential race condition.
11685  *         if not self._have_registered_drivers:
11686  *             with threading.Lock():             # <<<<<<<<<<<<<<
11687  *                 if not self._have_registered_drivers:
11688  *
11689  */
11690   __pyx_tuple__7 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 401, __pyx_L1_error)
11691   __Pyx_GOTREF(__pyx_tuple__7);
11692   __Pyx_GIVEREF(__pyx_tuple__7);
11693 
11694   /* "fiona/_env.pyx":74
11695  *
11696  *
11697  * def calc_gdal_version_num(maj, min, rev):             # <<<<<<<<<<<<<<
11698  *     """Calculates the internal gdal version number based on major, minor and revision
11699  *
11700  */
11701   __pyx_tuple__8 = PyTuple_Pack(3, __pyx_n_s_maj, __pyx_n_s_min, __pyx_n_s_rev); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 74, __pyx_L1_error)
11702   __Pyx_GOTREF(__pyx_tuple__8);
11703   __Pyx_GIVEREF(__pyx_tuple__8);
11704   __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_calc_gdal_version_num, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 74, __pyx_L1_error)
11705 
11706   /* "fiona/_env.pyx":86
11707  *
11708  *
11709  * def get_gdal_version_num():             # <<<<<<<<<<<<<<
11710  *     """Return current internal version number of gdal"""
11711  *     return int(GDALVersionInfo("VERSION_NUM"))
11712  */
11713   __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_get_gdal_version_num, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 86, __pyx_L1_error)
11714 
11715   /* "fiona/_env.pyx":91
11716  *
11717  *
11718  * def get_gdal_release_name():             # <<<<<<<<<<<<<<
11719  *     """Return release name of gdal"""
11720  *     cdef const char *name_c = NULL
11721  */
11722   __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_name_c, __pyx_n_s_name_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 91, __pyx_L1_error)
11723   __Pyx_GOTREF(__pyx_tuple__11);
11724   __Pyx_GIVEREF(__pyx_tuple__11);
11725   __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_get_gdal_release_name, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 91, __pyx_L1_error)
11726 
11727   /* "fiona/_env.pyx":102
11728  *
11729  *
11730  * def get_gdal_version_tuple():             # <<<<<<<<<<<<<<
11731  *     """
11732  *     Calculates gdal version tuple from gdal's internal version number.
11733  */
11734   __pyx_tuple__13 = PyTuple_Pack(4, __pyx_n_s_gdal_version_num, __pyx_n_s_major, __pyx_n_s_minor, __pyx_n_s_revision); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 102, __pyx_L1_error)
11735   __Pyx_GOTREF(__pyx_tuple__13);
11736   __Pyx_GIVEREF(__pyx_tuple__13);
11737   __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_get_gdal_version_tuple, 102, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 102, __pyx_L1_error)
11738 
11739   /* "fiona/_env.pyx":122
11740  *
11741  *
11742  * def get_proj_version_tuple():             # <<<<<<<<<<<<<<
11743  *     """
11744  *     Returns proj version tuple for gdal >= 3.0.1, otherwise None
11745  */
11746   __pyx_tuple__15 = PyTuple_Pack(5, __pyx_n_s_major, __pyx_n_s_minor, __pyx_n_s_patch, __pyx_n_s_gdal_version_num, __pyx_n_s_proj_version); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 122, __pyx_L1_error)
11747   __Pyx_GOTREF(__pyx_tuple__15);
11748   __Pyx_GIVEREF(__pyx_tuple__15);
11749   __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_get_proj_version_tuple, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 122, __pyx_L1_error)
11750 
11751   /* "fiona/_env.pyx":158
11752  *
11753  *
11754  * def driver_count():             # <<<<<<<<<<<<<<
11755  *     """Return the count of all drivers"""
11756  *     return GDALGetDriverCount() + OGRGetDriverCount()
11757  */
11758   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_driver_count, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 158, __pyx_L1_error)
11759 
11760   /* "fiona/_env.pyx":269
11761  *
11762  *
11763  * class GDALDataFinder(object):             # <<<<<<<<<<<<<<
11764  *     """Finds GDAL data files
11765  *
11766  */
11767   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 269, __pyx_L1_error)
11768   __Pyx_GOTREF(__pyx_tuple__18);
11769   __Pyx_GIVEREF(__pyx_tuple__18);
11770 
11771   /* "fiona/_env.pyx":275
11772  *
11773  *     """
11774  *     def find_file(self, basename):             # <<<<<<<<<<<<<<
11775  *         """Returns path of a GDAL data file or None
11776  *
11777  */
11778   __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_basename, __pyx_n_s_path_c, __pyx_n_s_basename_b, __pyx_n_s_path); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 275, __pyx_L1_error)
11779   __Pyx_GOTREF(__pyx_tuple__19);
11780   __Pyx_GIVEREF(__pyx_tuple__19);
11781   __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_find_file, 275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 275, __pyx_L1_error)
11782 
11783   /* "fiona/_env.pyx":297
11784  *             return path
11785  *
11786  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
11787  *         """Returns GDAL data directory
11788  *
11789  */
11790   __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_path); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 297, __pyx_L1_error)
11791   __Pyx_GOTREF(__pyx_tuple__21);
11792   __Pyx_GIVEREF(__pyx_tuple__21);
11793   __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search, 297, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 297, __pyx_L1_error)
11794   __pyx_tuple__23 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 297, __pyx_L1_error)
11795   __Pyx_GOTREF(__pyx_tuple__23);
11796   __Pyx_GIVEREF(__pyx_tuple__23);
11797 
11798   /* "fiona/_env.pyx":314
11799  *         return path
11800  *
11801  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
11802  *         """Check wheel location"""
11803  *         if prefix is None:
11804  */
11805   __pyx_tuple__24 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_datadir); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 314, __pyx_L1_error)
11806   __Pyx_GOTREF(__pyx_tuple__24);
11807   __Pyx_GIVEREF(__pyx_tuple__24);
11808   __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search_wheel, 314, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 314, __pyx_L1_error)
11809   __pyx_tuple__26 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 314, __pyx_L1_error)
11810   __Pyx_GOTREF(__pyx_tuple__26);
11811   __Pyx_GIVEREF(__pyx_tuple__26);
11812 
11813   /* "fiona/_env.pyx":321
11814  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
11815  *
11816  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
11817  *         """Check sys.prefix location"""
11818  *         datadir = os.path.join(prefix, 'share', 'gdal')
11819  */
11820   __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_datadir); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 321, __pyx_L1_error)
11821   __Pyx_GOTREF(__pyx_tuple__27);
11822   __Pyx_GIVEREF(__pyx_tuple__27);
11823   __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search_prefix, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 321, __pyx_L1_error)
11824 
11825   /* "fiona/_env.pyx":326
11826  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
11827  *
11828  *     def search_debian(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
11829  *         """Check Debian locations"""
11830  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
11831  */
11832   __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_gdal_release_name, __pyx_n_s_datadir); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 326, __pyx_L1_error)
11833   __Pyx_GOTREF(__pyx_tuple__29);
11834   __Pyx_GIVEREF(__pyx_tuple__29);
11835   __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search_debian, 326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 326, __pyx_L1_error)
11836 
11837   /* "fiona/_env.pyx":333
11838  *
11839  *
11840  * class PROJDataFinder(object):             # <<<<<<<<<<<<<<
11841  *     """Finds PROJ data files
11842  *
11843  */
11844   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 333, __pyx_L1_error)
11845   __Pyx_GOTREF(__pyx_tuple__31);
11846   __Pyx_GIVEREF(__pyx_tuple__31);
11847 
11848   /* "fiona/_env.pyx":339
11849  *
11850  *     """
11851  *     def has_data(self):             # <<<<<<<<<<<<<<
11852  *         """Returns True if PROJ's data files can be found
11853  *
11854  */
11855   __pyx_tuple__32 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_osr); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 339, __pyx_L1_error)
11856   __Pyx_GOTREF(__pyx_tuple__32);
11857   __Pyx_GIVEREF(__pyx_tuple__32);
11858   __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_has_data, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 339, __pyx_L1_error)
11859 
11860   /* "fiona/_env.pyx":359
11861  *
11862  *
11863  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
11864  *         """Returns PROJ data directory
11865  *
11866  */
11867   __pyx_tuple__34 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_path); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 359, __pyx_L1_error)
11868   __Pyx_GOTREF(__pyx_tuple__34);
11869   __Pyx_GIVEREF(__pyx_tuple__34);
11870   __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 359, __pyx_L1_error)
11871   __pyx_tuple__36 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 359, __pyx_L1_error)
11872   __Pyx_GOTREF(__pyx_tuple__36);
11873   __Pyx_GIVEREF(__pyx_tuple__36);
11874 
11875   /* "fiona/_env.pyx":374
11876  *         return path
11877  *
11878  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
11879  *         """Check wheel location"""
11880  *         if prefix is None:
11881  */
11882   __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_datadir); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 374, __pyx_L1_error)
11883   __Pyx_GOTREF(__pyx_tuple__37);
11884   __Pyx_GIVEREF(__pyx_tuple__37);
11885   __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search_wheel, 374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 374, __pyx_L1_error)
11886   __pyx_tuple__39 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 374, __pyx_L1_error)
11887   __Pyx_GOTREF(__pyx_tuple__39);
11888   __Pyx_GIVEREF(__pyx_tuple__39);
11889 
11890   /* "fiona/_env.pyx":381
11891  *         return datadir if os.path.exists(datadir) else None
11892  *
11893  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
11894  *         """Check sys.prefix location"""
11895  *         datadir = os.path.join(prefix, 'share', 'proj')
11896  */
11897   __pyx_tuple__40 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_datadir); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 381, __pyx_L1_error)
11898   __Pyx_GOTREF(__pyx_tuple__40);
11899   __Pyx_GIVEREF(__pyx_tuple__40);
11900   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_search_prefix, 381, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 381, __pyx_L1_error)
11901 
11902   /* "fiona/_env.pyx":486
11903  *
11904  *
11905  * def set_proj_data_search_path(path):             # <<<<<<<<<<<<<<
11906  *     """Set PROJ data search path"""
11907  *     set_proj_search_path(path)
11908  */
11909   __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_path); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 486, __pyx_L1_error)
11910   __Pyx_GOTREF(__pyx_tuple__42);
11911   __Pyx_GIVEREF(__pyx_tuple__42);
11912   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fiona__env_pyx, __pyx_n_s_set_proj_data_search_path, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 486, __pyx_L1_error)
11913 
11914   /* "(tree fragment)":1
11915  * def __pyx_unpickle_ConfigEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
11916  *     cdef object __pyx_PickleError
11917  *     cdef object __pyx_result
11918  */
11919   __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 1, __pyx_L1_error)
11920   __Pyx_GOTREF(__pyx_tuple__44);
11921   __Pyx_GIVEREF(__pyx_tuple__44);
11922   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ConfigEnv, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 1, __pyx_L1_error)
11923   __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 1, __pyx_L1_error)
11924   __Pyx_GOTREF(__pyx_tuple__46);
11925   __Pyx_GIVEREF(__pyx_tuple__46);
11926   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_GDALEnv, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 1, __pyx_L1_error)
11927   __Pyx_RefNannyFinishContext();
11928   return 0;
11929   __pyx_L1_error:;
11930   __Pyx_RefNannyFinishContext();
11931   return -1;
11932 }
11933 
__Pyx_InitGlobals(void)11934 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
11935   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11936   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
11937   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
11938   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
11939   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
11940   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
11941   __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
11942   __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
11943   __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
11944   __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
11945   __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(0, 1, __pyx_L1_error)
11946   __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
11947   __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) __PYX_ERR(0, 1, __pyx_L1_error)
11948   __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error)
11949   __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) __PYX_ERR(0, 1, __pyx_L1_error)
11950   __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) __PYX_ERR(0, 1, __pyx_L1_error)
11951   __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error)
11952   __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
11953   __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
11954   __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
11955   __pyx_int_10000 = PyInt_FromLong(10000L); if (unlikely(!__pyx_int_10000)) __PYX_ERR(0, 1, __pyx_L1_error)
11956   __pyx_int_1000000 = PyInt_FromLong(1000000L); if (unlikely(!__pyx_int_1000000)) __PYX_ERR(0, 1, __pyx_L1_error)
11957   __pyx_int_40410864 = PyInt_FromLong(40410864L); if (unlikely(!__pyx_int_40410864)) __PYX_ERR(0, 1, __pyx_L1_error)
11958   __pyx_int_155035226 = PyInt_FromLong(155035226L); if (unlikely(!__pyx_int_155035226)) __PYX_ERR(0, 1, __pyx_L1_error)
11959   __pyx_int_4294967296 = PyInt_FromString((char *)"4294967296", 0, 0); if (unlikely(!__pyx_int_4294967296)) __PYX_ERR(0, 1, __pyx_L1_error)
11960   return 0;
11961   __pyx_L1_error:;
11962   return -1;
11963 }
11964 
11965 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
11966 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
11967 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
11968 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
11969 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
11970 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
11971 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
11972 
__Pyx_modinit_global_init_code(void)11973 static int __Pyx_modinit_global_init_code(void) {
11974   __Pyx_RefNannyDeclarations
11975   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
11976   /*--- Global init code ---*/
11977   __Pyx_RefNannyFinishContext();
11978   return 0;
11979 }
11980 
__Pyx_modinit_variable_export_code(void)11981 static int __Pyx_modinit_variable_export_code(void) {
11982   __Pyx_RefNannyDeclarations
11983   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
11984   /*--- Variable export code ---*/
11985   __Pyx_RefNannyFinishContext();
11986   return 0;
11987 }
11988 
__Pyx_modinit_function_export_code(void)11989 static int __Pyx_modinit_function_export_code(void) {
11990   __Pyx_RefNannyDeclarations
11991   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
11992   /*--- Function export code ---*/
11993   __Pyx_RefNannyFinishContext();
11994   return 0;
11995 }
11996 
__Pyx_modinit_type_init_code(void)11997 static int __Pyx_modinit_type_init_code(void) {
11998   __Pyx_RefNannyDeclarations
11999   int __pyx_lineno = 0;
12000   const char *__pyx_filename = NULL;
12001   int __pyx_clineno = 0;
12002   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
12003   /*--- Type init code ---*/
12004   if (PyType_Ready(&__pyx_type_5fiona_4_env_ConfigEnv) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
12005   #if PY_VERSION_HEX < 0x030800B1
12006   __pyx_type_5fiona_4_env_ConfigEnv.tp_print = 0;
12007   #endif
12008   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5fiona_4_env_ConfigEnv.tp_dictoffset && __pyx_type_5fiona_4_env_ConfigEnv.tp_getattro == PyObject_GenericGetAttr)) {
12009     __pyx_type_5fiona_4_env_ConfigEnv.tp_getattro = __Pyx_PyObject_GenericGetAttr;
12010   }
12011   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConfigEnv, (PyObject *)&__pyx_type_5fiona_4_env_ConfigEnv) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
12012   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5fiona_4_env_ConfigEnv) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
12013   __pyx_ptype_5fiona_4_env_ConfigEnv = &__pyx_type_5fiona_4_env_ConfigEnv;
12014   __pyx_type_5fiona_4_env_GDALEnv.tp_base = __pyx_ptype_5fiona_4_env_ConfigEnv;
12015   if (PyType_Ready(&__pyx_type_5fiona_4_env_GDALEnv) < 0) __PYX_ERR(0, 387, __pyx_L1_error)
12016   #if PY_VERSION_HEX < 0x030800B1
12017   __pyx_type_5fiona_4_env_GDALEnv.tp_print = 0;
12018   #endif
12019   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5fiona_4_env_GDALEnv.tp_dictoffset && __pyx_type_5fiona_4_env_GDALEnv.tp_getattro == PyObject_GenericGetAttr)) {
12020     __pyx_type_5fiona_4_env_GDALEnv.tp_getattro = __Pyx_PyObject_GenericGetAttr;
12021   }
12022   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_GDALEnv, (PyObject *)&__pyx_type_5fiona_4_env_GDALEnv) < 0) __PYX_ERR(0, 387, __pyx_L1_error)
12023   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5fiona_4_env_GDALEnv) < 0) __PYX_ERR(0, 387, __pyx_L1_error)
12024   __pyx_ptype_5fiona_4_env_GDALEnv = &__pyx_type_5fiona_4_env_GDALEnv;
12025   __Pyx_RefNannyFinishContext();
12026   return 0;
12027   __pyx_L1_error:;
12028   __Pyx_RefNannyFinishContext();
12029   return -1;
12030 }
12031 
__Pyx_modinit_type_import_code(void)12032 static int __Pyx_modinit_type_import_code(void) {
12033   __Pyx_RefNannyDeclarations
12034   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
12035   /*--- Type import code ---*/
12036   __Pyx_RefNannyFinishContext();
12037   return 0;
12038 }
12039 
__Pyx_modinit_variable_import_code(void)12040 static int __Pyx_modinit_variable_import_code(void) {
12041   __Pyx_RefNannyDeclarations
12042   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
12043   /*--- Variable import code ---*/
12044   __Pyx_RefNannyFinishContext();
12045   return 0;
12046 }
12047 
__Pyx_modinit_function_import_code(void)12048 static int __Pyx_modinit_function_import_code(void) {
12049   __Pyx_RefNannyDeclarations
12050   PyObject *__pyx_t_1 = NULL;
12051   int __pyx_lineno = 0;
12052   const char *__pyx_filename = NULL;
12053   int __pyx_clineno = 0;
12054   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
12055   /*--- Function import code ---*/
12056   __pyx_t_1 = PyImport_ImportModule("fiona._err"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
12057   __Pyx_GOTREF(__pyx_t_1);
12058   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_int", (void (**)(void))&__pyx_f_5fiona_4_err_exc_wrap_int, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12059   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_ogrerr", (void (**)(void))&__pyx_f_5fiona_4_err_exc_wrap_ogrerr, "OGRErr (OGRErr)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12060   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12061   __pyx_t_1 = PyImport_ImportModule("fiona._shim"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
12062   __Pyx_GOTREF(__pyx_t_1);
12063   if (__Pyx_ImportFunction(__pyx_t_1, "set_proj_search_path", (void (**)(void))&__pyx_f_5fiona_5_shim_set_proj_search_path, "void (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12064   if (__Pyx_ImportFunction(__pyx_t_1, "get_proj_version", (void (**)(void))&__pyx_f_5fiona_5_shim_get_proj_version, "void (int *, int *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12065   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12066   __Pyx_RefNannyFinishContext();
12067   return 0;
12068   __pyx_L1_error:;
12069   __Pyx_XDECREF(__pyx_t_1);
12070   __Pyx_RefNannyFinishContext();
12071   return -1;
12072 }
12073 
12074 
12075 #ifndef CYTHON_NO_PYINIT_EXPORT
12076 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
12077 #elif PY_MAJOR_VERSION < 3
12078 #ifdef __cplusplus
12079 #define __Pyx_PyMODINIT_FUNC extern "C" void
12080 #else
12081 #define __Pyx_PyMODINIT_FUNC void
12082 #endif
12083 #else
12084 #ifdef __cplusplus
12085 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
12086 #else
12087 #define __Pyx_PyMODINIT_FUNC PyObject *
12088 #endif
12089 #endif
12090 
12091 
12092 #if PY_MAJOR_VERSION < 3
12093 __Pyx_PyMODINIT_FUNC init_env(void) CYTHON_SMALL_CODE; /*proto*/
init_env(void)12094 __Pyx_PyMODINIT_FUNC init_env(void)
12095 #else
12096 __Pyx_PyMODINIT_FUNC PyInit__env(void) CYTHON_SMALL_CODE; /*proto*/
12097 __Pyx_PyMODINIT_FUNC PyInit__env(void)
12098 #if CYTHON_PEP489_MULTI_PHASE_INIT
12099 {
12100   return PyModuleDef_Init(&__pyx_moduledef);
12101 }
12102 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
12103     #if PY_VERSION_HEX >= 0x030700A1
12104     static PY_INT64_T main_interpreter_id = -1;
12105     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
12106     if (main_interpreter_id == -1) {
12107         main_interpreter_id = current_id;
12108         return (unlikely(current_id == -1)) ? -1 : 0;
12109     } else if (unlikely(main_interpreter_id != current_id))
12110     #else
12111     static PyInterpreterState *main_interpreter = NULL;
12112     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
12113     if (!main_interpreter) {
12114         main_interpreter = current_interpreter;
12115     } else if (unlikely(main_interpreter != current_interpreter))
12116     #endif
12117     {
12118         PyErr_SetString(
12119             PyExc_ImportError,
12120             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
12121         return -1;
12122     }
12123     return 0;
12124 }
12125 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
12126     PyObject *value = PyObject_GetAttrString(spec, from_name);
12127     int result = 0;
12128     if (likely(value)) {
12129         if (allow_none || value != Py_None) {
12130             result = PyDict_SetItemString(moddict, to_name, value);
12131         }
12132         Py_DECREF(value);
12133     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
12134         PyErr_Clear();
12135     } else {
12136         result = -1;
12137     }
12138     return result;
12139 }
12140 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
12141     PyObject *module = NULL, *moddict, *modname;
12142     if (__Pyx_check_single_interpreter())
12143         return NULL;
12144     if (__pyx_m)
12145         return __Pyx_NewRef(__pyx_m);
12146     modname = PyObject_GetAttrString(spec, "name");
12147     if (unlikely(!modname)) goto bad;
12148     module = PyModule_NewObject(modname);
12149     Py_DECREF(modname);
12150     if (unlikely(!module)) goto bad;
12151     moddict = PyModule_GetDict(module);
12152     if (unlikely(!moddict)) goto bad;
12153     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
12154     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
12155     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
12156     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
12157     return module;
12158 bad:
12159     Py_XDECREF(module);
12160     return NULL;
12161 }
12162 
12163 
12164 static CYTHON_SMALL_CODE int __pyx_pymod_exec__env(PyObject *__pyx_pyinit_module)
12165 #endif
12166 #endif
12167 {
12168   PyObject *__pyx_t_1 = NULL;
12169   PyObject *__pyx_t_2 = NULL;
12170   PyObject *__pyx_t_3 = NULL;
12171   PyObject *__pyx_t_4 = NULL;
12172   PyObject *__pyx_t_5 = NULL;
12173   PyObject *__pyx_t_6 = NULL;
12174   int __pyx_t_7;
12175   int __pyx_t_8;
12176   PyObject *__pyx_t_9 = NULL;
12177   PyObject *__pyx_t_10 = NULL;
12178   int __pyx_lineno = 0;
12179   const char *__pyx_filename = NULL;
12180   int __pyx_clineno = 0;
12181   __Pyx_RefNannyDeclarations
12182   #if CYTHON_PEP489_MULTI_PHASE_INIT
12183   if (__pyx_m) {
12184     if (__pyx_m == __pyx_pyinit_module) return 0;
12185     PyErr_SetString(PyExc_RuntimeError, "Module '_env' has already been imported. Re-initialisation is not supported.");
12186     return -1;
12187   }
12188   #elif PY_MAJOR_VERSION >= 3
12189   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
12190   #endif
12191   #if CYTHON_REFNANNY
12192 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
12193 if (!__Pyx_RefNanny) {
12194   PyErr_Clear();
12195   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
12196   if (!__Pyx_RefNanny)
12197       Py_FatalError("failed to import 'refnanny' module");
12198 }
12199 #endif
12200   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__env(void)", 0);
12201   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12202   #ifdef __Pxy_PyFrame_Initialize_Offsets
12203   __Pxy_PyFrame_Initialize_Offsets();
12204   #endif
12205   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
12206   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
12207   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
12208   #ifdef __Pyx_CyFunction_USED
12209   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12210   #endif
12211   #ifdef __Pyx_FusedFunction_USED
12212   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12213   #endif
12214   #ifdef __Pyx_Coroutine_USED
12215   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12216   #endif
12217   #ifdef __Pyx_Generator_USED
12218   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12219   #endif
12220   #ifdef __Pyx_AsyncGen_USED
12221   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12222   #endif
12223   #ifdef __Pyx_StopAsyncIteration_USED
12224   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12225   #endif
12226   /*--- Library function declarations ---*/
12227   /*--- Threads initialization code ---*/
12228   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
12229   #ifdef WITH_THREAD /* Python build with threading support? */
12230   PyEval_InitThreads();
12231   #endif
12232   #endif
12233   /*--- Module creation code ---*/
12234   #if CYTHON_PEP489_MULTI_PHASE_INIT
12235   __pyx_m = __pyx_pyinit_module;
12236   Py_INCREF(__pyx_m);
12237   #else
12238   #if PY_MAJOR_VERSION < 3
12239   __pyx_m = Py_InitModule4("_env", __pyx_methods, __pyx_k_GDAL_and_OGR_driver_and_configur, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
12240   #else
12241   __pyx_m = PyModule_Create(&__pyx_moduledef);
12242   #endif
12243   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
12244   #endif
12245   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
12246   Py_INCREF(__pyx_d);
12247   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
12248   Py_INCREF(__pyx_b);
12249   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
12250   Py_INCREF(__pyx_cython_runtime);
12251   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12252   /*--- Initialize various global constants etc. ---*/
12253   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12254   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
12255   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12256   #endif
12257   if (__pyx_module_is_main_fiona___env) {
12258     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12259   }
12260   #if PY_MAJOR_VERSION >= 3
12261   {
12262     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
12263     if (!PyDict_GetItemString(modules, "fiona._env")) {
12264       if (unlikely(PyDict_SetItemString(modules, "fiona._env", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
12265     }
12266   }
12267   #endif
12268   /*--- Builtin init code ---*/
12269   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12270   /*--- Constants init code ---*/
12271   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12272   /*--- Global type/function init code ---*/
12273   (void)__Pyx_modinit_global_init_code();
12274   (void)__Pyx_modinit_variable_export_code();
12275   (void)__Pyx_modinit_function_export_code();
12276   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
12277   (void)__Pyx_modinit_type_import_code();
12278   (void)__Pyx_modinit_variable_import_code();
12279   if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
12280   /*--- Execution code ---*/
12281   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
12282   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12283   #endif
12284 
12285   /* "fiona/_env.pyx":13
12286  * include "gdal.pxi"
12287  *
12288  * from collections import namedtuple             # <<<<<<<<<<<<<<
12289  * import logging
12290  * import os
12291  */
12292   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
12293   __Pyx_GOTREF(__pyx_t_1);
12294   __Pyx_INCREF(__pyx_n_s_namedtuple);
12295   __Pyx_GIVEREF(__pyx_n_s_namedtuple);
12296   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple);
12297   __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
12298   __Pyx_GOTREF(__pyx_t_2);
12299   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12300   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
12301   __Pyx_GOTREF(__pyx_t_1);
12302   if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
12303   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12304   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12305 
12306   /* "fiona/_env.pyx":14
12307  *
12308  * from collections import namedtuple
12309  * import logging             # <<<<<<<<<<<<<<
12310  * import os
12311  * import os.path
12312  */
12313   __pyx_t_2 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
12314   __Pyx_GOTREF(__pyx_t_2);
12315   if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
12316   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12317 
12318   /* "fiona/_env.pyx":15
12319  * from collections import namedtuple
12320  * import logging
12321  * import os             # <<<<<<<<<<<<<<
12322  * import os.path
12323  * import sys
12324  */
12325   __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
12326   __Pyx_GOTREF(__pyx_t_2);
12327   if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
12328   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12329 
12330   /* "fiona/_env.pyx":16
12331  * import logging
12332  * import os
12333  * import os.path             # <<<<<<<<<<<<<<
12334  * import sys
12335  * import threading
12336  */
12337   __pyx_t_2 = __Pyx_Import(__pyx_n_s_os_path, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
12338   __Pyx_GOTREF(__pyx_t_2);
12339   if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
12340   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12341 
12342   /* "fiona/_env.pyx":17
12343  * import os
12344  * import os.path
12345  * import sys             # <<<<<<<<<<<<<<
12346  * import threading
12347  *
12348  */
12349   __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
12350   __Pyx_GOTREF(__pyx_t_2);
12351   if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
12352   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12353 
12354   /* "fiona/_env.pyx":18
12355  * import os.path
12356  * import sys
12357  * import threading             # <<<<<<<<<<<<<<
12358  *
12359  * from fiona._err cimport exc_wrap_int, exc_wrap_ogrerr
12360  */
12361   __pyx_t_2 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
12362   __Pyx_GOTREF(__pyx_t_2);
12363   if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
12364   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12365 
12366   /* "fiona/_env.pyx":22
12367  * from fiona._err cimport exc_wrap_int, exc_wrap_ogrerr
12368  * from fiona._shim cimport set_proj_search_path, get_proj_version
12369  * from fiona._err import CPLE_BaseError             # <<<<<<<<<<<<<<
12370  * from fiona.errors import EnvError
12371  *
12372  */
12373   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
12374   __Pyx_GOTREF(__pyx_t_2);
12375   __Pyx_INCREF(__pyx_n_s_CPLE_BaseError);
12376   __Pyx_GIVEREF(__pyx_n_s_CPLE_BaseError);
12377   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CPLE_BaseError);
12378   __pyx_t_1 = __Pyx_Import(__pyx_n_s_fiona__err, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
12379   __Pyx_GOTREF(__pyx_t_1);
12380   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12381   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
12382   __Pyx_GOTREF(__pyx_t_2);
12383   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CPLE_BaseError, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
12384   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12385   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12386 
12387   /* "fiona/_env.pyx":23
12388  * from fiona._shim cimport set_proj_search_path, get_proj_version
12389  * from fiona._err import CPLE_BaseError
12390  * from fiona.errors import EnvError             # <<<<<<<<<<<<<<
12391  *
12392  *
12393  */
12394   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
12395   __Pyx_GOTREF(__pyx_t_1);
12396   __Pyx_INCREF(__pyx_n_s_EnvError);
12397   __Pyx_GIVEREF(__pyx_n_s_EnvError);
12398   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_EnvError);
12399   __pyx_t_2 = __Pyx_Import(__pyx_n_s_fiona_errors, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
12400   __Pyx_GOTREF(__pyx_t_2);
12401   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12402   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_EnvError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
12403   __Pyx_GOTREF(__pyx_t_1);
12404   if (PyDict_SetItem(__pyx_d, __pyx_n_s_EnvError, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
12405   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12406   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12407 
12408   /* "fiona/_env.pyx":27
12409  *
12410  * level_map = {
12411  *     0: 0,             # <<<<<<<<<<<<<<
12412  *     1: logging.DEBUG,
12413  *     2: logging.WARNING,
12414  */
12415   __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
12416   __Pyx_GOTREF(__pyx_t_2);
12417   if (PyDict_SetItem(__pyx_t_2, __pyx_int_0, __pyx_int_0) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
12418 
12419   /* "fiona/_env.pyx":28
12420  * level_map = {
12421  *     0: 0,
12422  *     1: logging.DEBUG,             # <<<<<<<<<<<<<<
12423  *     2: logging.WARNING,
12424  *     3: logging.ERROR,
12425  */
12426   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
12427   __Pyx_GOTREF(__pyx_t_1);
12428   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DEBUG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
12429   __Pyx_GOTREF(__pyx_t_3);
12430   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12431   if (PyDict_SetItem(__pyx_t_2, __pyx_int_1, __pyx_t_3) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
12432   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12433 
12434   /* "fiona/_env.pyx":29
12435  *     0: 0,
12436  *     1: logging.DEBUG,
12437  *     2: logging.WARNING,             # <<<<<<<<<<<<<<
12438  *     3: logging.ERROR,
12439  *     4: logging.CRITICAL }
12440  */
12441   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
12442   __Pyx_GOTREF(__pyx_t_3);
12443   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
12444   __Pyx_GOTREF(__pyx_t_1);
12445   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12446   if (PyDict_SetItem(__pyx_t_2, __pyx_int_2, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
12447   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12448 
12449   /* "fiona/_env.pyx":30
12450  *     1: logging.DEBUG,
12451  *     2: logging.WARNING,
12452  *     3: logging.ERROR,             # <<<<<<<<<<<<<<
12453  *     4: logging.CRITICAL }
12454  *
12455  */
12456   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
12457   __Pyx_GOTREF(__pyx_t_1);
12458   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
12459   __Pyx_GOTREF(__pyx_t_3);
12460   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12461   if (PyDict_SetItem(__pyx_t_2, __pyx_int_3, __pyx_t_3) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
12462   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12463 
12464   /* "fiona/_env.pyx":31
12465  *     2: logging.WARNING,
12466  *     3: logging.ERROR,
12467  *     4: logging.CRITICAL }             # <<<<<<<<<<<<<<
12468  *
12469  * code_map = {
12470  */
12471   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
12472   __Pyx_GOTREF(__pyx_t_3);
12473   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_CRITICAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
12474   __Pyx_GOTREF(__pyx_t_1);
12475   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12476   if (PyDict_SetItem(__pyx_t_2, __pyx_int_4, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
12477   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12478   if (PyDict_SetItem(__pyx_d, __pyx_n_s_level_map, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
12479   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12480 
12481   /* "fiona/_env.pyx":34
12482  *
12483  * code_map = {
12484  *     0: 'CPLE_None',             # <<<<<<<<<<<<<<
12485  *     1: 'CPLE_AppDefined',
12486  *     2: 'CPLE_OutOfMemory',
12487  */
12488   __pyx_t_2 = __Pyx_PyDict_NewPresized(17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
12489   __Pyx_GOTREF(__pyx_t_2);
12490   if (PyDict_SetItem(__pyx_t_2, __pyx_int_0, __pyx_n_u_CPLE_None) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12491   if (PyDict_SetItem(__pyx_t_2, __pyx_int_1, __pyx_n_u_CPLE_AppDefined) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12492   if (PyDict_SetItem(__pyx_t_2, __pyx_int_2, __pyx_n_u_CPLE_OutOfMemory) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12493   if (PyDict_SetItem(__pyx_t_2, __pyx_int_3, __pyx_n_u_CPLE_FileIO) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12494   if (PyDict_SetItem(__pyx_t_2, __pyx_int_4, __pyx_n_u_CPLE_OpenFailed) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12495   if (PyDict_SetItem(__pyx_t_2, __pyx_int_5, __pyx_n_u_CPLE_IllegalArg) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12496   if (PyDict_SetItem(__pyx_t_2, __pyx_int_6, __pyx_n_u_CPLE_NotSupported) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12497   if (PyDict_SetItem(__pyx_t_2, __pyx_int_7, __pyx_n_u_CPLE_AssertionFailed) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12498   if (PyDict_SetItem(__pyx_t_2, __pyx_int_8, __pyx_n_u_CPLE_NoWriteAccess) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12499   if (PyDict_SetItem(__pyx_t_2, __pyx_int_9, __pyx_n_u_CPLE_UserInterrupt) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12500   if (PyDict_SetItem(__pyx_t_2, __pyx_int_10, __pyx_n_u_ObjectNull) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12501   if (PyDict_SetItem(__pyx_t_2, __pyx_int_11, __pyx_n_u_CPLE_HttpResponse) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12502   if (PyDict_SetItem(__pyx_t_2, __pyx_int_12, __pyx_n_u_CPLE_AWSBucketNotFound) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12503   if (PyDict_SetItem(__pyx_t_2, __pyx_int_13, __pyx_n_u_CPLE_AWSObjectNotFound) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12504   if (PyDict_SetItem(__pyx_t_2, __pyx_int_14, __pyx_n_u_CPLE_AWSAccessDenied) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12505   if (PyDict_SetItem(__pyx_t_2, __pyx_int_15, __pyx_n_u_CPLE_AWSInvalidCredentials) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12506   if (PyDict_SetItem(__pyx_t_2, __pyx_int_16, __pyx_n_u_CPLE_AWSSignatureDoesNotMatch) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
12507   if (PyDict_SetItem(__pyx_d, __pyx_n_s_code_map, __pyx_t_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
12508   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12509 
12510   /* "fiona/_env.pyx":56
12511  *
12512  *
12513  * log = logging.getLogger(__name__)             # <<<<<<<<<<<<<<
12514  *
12515  * try:
12516  */
12517   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
12518   __Pyx_GOTREF(__pyx_t_2);
12519   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
12520   __Pyx_GOTREF(__pyx_t_1);
12521   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12522   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
12523   __Pyx_GOTREF(__pyx_t_2);
12524   __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
12525   __Pyx_GOTREF(__pyx_t_3);
12526   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12527   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12528   if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_3) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
12529   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12530 
12531   /* "fiona/_env.pyx":58
12532  * log = logging.getLogger(__name__)
12533  *
12534  * try:             # <<<<<<<<<<<<<<
12535  *     import certifi
12536  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())
12537  */
12538   {
12539     __Pyx_PyThreadState_declare
12540     __Pyx_PyThreadState_assign
12541     __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
12542     __Pyx_XGOTREF(__pyx_t_4);
12543     __Pyx_XGOTREF(__pyx_t_5);
12544     __Pyx_XGOTREF(__pyx_t_6);
12545     /*try:*/ {
12546 
12547       /* "fiona/_env.pyx":59
12548  *
12549  * try:
12550  *     import certifi             # <<<<<<<<<<<<<<
12551  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())
12552  * except ImportError:
12553  */
12554       __pyx_t_3 = __Pyx_Import(__pyx_n_s_certifi, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L2_error)
12555       __Pyx_GOTREF(__pyx_t_3);
12556       if (PyDict_SetItem(__pyx_d, __pyx_n_s_certifi, __pyx_t_3) < 0) __PYX_ERR(0, 59, __pyx_L2_error)
12557       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12558 
12559       /* "fiona/_env.pyx":60
12560  * try:
12561  *     import certifi
12562  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())             # <<<<<<<<<<<<<<
12563  * except ImportError:
12564  *     pass
12565  */
12566       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L2_error)
12567       __Pyx_GOTREF(__pyx_t_3);
12568       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_environ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L2_error)
12569       __Pyx_GOTREF(__pyx_t_2);
12570       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12571       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L2_error)
12572       __Pyx_GOTREF(__pyx_t_3);
12573       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12574       __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_certifi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L2_error)
12575       __Pyx_GOTREF(__pyx_t_2);
12576       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_where); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L2_error)
12577       __Pyx_GOTREF(__pyx_t_1);
12578       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12579       __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L2_error)
12580       __Pyx_GOTREF(__pyx_t_2);
12581       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12582       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L2_error)
12583       __Pyx_GOTREF(__pyx_t_1);
12584       __Pyx_INCREF(__pyx_n_u_CURL_CA_BUNDLE);
12585       __Pyx_GIVEREF(__pyx_n_u_CURL_CA_BUNDLE);
12586       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_CURL_CA_BUNDLE);
12587       __Pyx_GIVEREF(__pyx_t_2);
12588       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
12589       __pyx_t_2 = 0;
12590       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L2_error)
12591       __Pyx_GOTREF(__pyx_t_2);
12592       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12593       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12594       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12595 
12596       /* "fiona/_env.pyx":58
12597  * log = logging.getLogger(__name__)
12598  *
12599  * try:             # <<<<<<<<<<<<<<
12600  *     import certifi
12601  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())
12602  */
12603     }
12604     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12605     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12606     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12607     goto __pyx_L7_try_end;
12608     __pyx_L2_error:;
12609     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12610     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12611     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12612 
12613     /* "fiona/_env.pyx":61
12614  *     import certifi
12615  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())
12616  * except ImportError:             # <<<<<<<<<<<<<<
12617  *     pass
12618  *
12619  */
12620     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
12621     if (__pyx_t_7) {
12622       __Pyx_ErrRestore(0,0,0);
12623       goto __pyx_L3_exception_handled;
12624     }
12625     goto __pyx_L4_except_error;
12626     __pyx_L4_except_error:;
12627 
12628     /* "fiona/_env.pyx":58
12629  * log = logging.getLogger(__name__)
12630  *
12631  * try:             # <<<<<<<<<<<<<<
12632  *     import certifi
12633  *     os.environ.setdefault("CURL_CA_BUNDLE", certifi.where())
12634  */
12635     __Pyx_XGIVEREF(__pyx_t_4);
12636     __Pyx_XGIVEREF(__pyx_t_5);
12637     __Pyx_XGIVEREF(__pyx_t_6);
12638     __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
12639     goto __pyx_L1_error;
12640     __pyx_L3_exception_handled:;
12641     __Pyx_XGIVEREF(__pyx_t_4);
12642     __Pyx_XGIVEREF(__pyx_t_5);
12643     __Pyx_XGIVEREF(__pyx_t_6);
12644     __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
12645     __pyx_L7_try_end:;
12646   }
12647 
12648   /* "fiona/_env.pyx":64
12649  *     pass
12650  *
12651  * cdef bint is_64bit = sys.maxsize > 2 ** 32             # <<<<<<<<<<<<<<
12652  *
12653  *
12654  */
12655   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
12656   __Pyx_GOTREF(__pyx_t_2);
12657   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
12658   __Pyx_GOTREF(__pyx_t_1);
12659   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12660   __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_4294967296, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
12661   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12662   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error)
12663   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12664   __pyx_v_5fiona_4_env_is_64bit = __pyx_t_8;
12665 
12666   /* "fiona/_env.pyx":74
12667  *
12668  *
12669  * def calc_gdal_version_num(maj, min, rev):             # <<<<<<<<<<<<<<
12670  *     """Calculates the internal gdal version number based on major, minor and revision
12671  *
12672  */
12673   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_1calc_gdal_version_num, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
12674   __Pyx_GOTREF(__pyx_t_2);
12675   if (PyDict_SetItem(__pyx_d, __pyx_n_s_calc_gdal_version_num, __pyx_t_2) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
12676   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12677 
12678   /* "fiona/_env.pyx":86
12679  *
12680  *
12681  * def get_gdal_version_num():             # <<<<<<<<<<<<<<
12682  *     """Return current internal version number of gdal"""
12683  *     return int(GDALVersionInfo("VERSION_NUM"))
12684  */
12685   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_3get_gdal_version_num, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
12686   __Pyx_GOTREF(__pyx_t_2);
12687   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_gdal_version_num, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
12688   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12689 
12690   /* "fiona/_env.pyx":91
12691  *
12692  *
12693  * def get_gdal_release_name():             # <<<<<<<<<<<<<<
12694  *     """Return release name of gdal"""
12695  *     cdef const char *name_c = NULL
12696  */
12697   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_5get_gdal_release_name, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
12698   __Pyx_GOTREF(__pyx_t_2);
12699   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_gdal_release_name, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
12700   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12701 
12702   /* "fiona/_env.pyx":99
12703  *
12704  *
12705  * GDALVersion = namedtuple("GDALVersion", ["major", "minor", "revision"])             # <<<<<<<<<<<<<<
12706  *
12707  *
12708  */
12709   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
12710   __Pyx_GOTREF(__pyx_t_2);
12711   __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
12712   __Pyx_GOTREF(__pyx_t_1);
12713   __Pyx_INCREF(__pyx_n_u_major);
12714   __Pyx_GIVEREF(__pyx_n_u_major);
12715   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_major);
12716   __Pyx_INCREF(__pyx_n_u_minor);
12717   __Pyx_GIVEREF(__pyx_n_u_minor);
12718   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_minor);
12719   __Pyx_INCREF(__pyx_n_u_revision);
12720   __Pyx_GIVEREF(__pyx_n_u_revision);
12721   PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_revision);
12722   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
12723   __Pyx_GOTREF(__pyx_t_3);
12724   __Pyx_INCREF(__pyx_n_u_GDALVersion);
12725   __Pyx_GIVEREF(__pyx_n_u_GDALVersion);
12726   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_GDALVersion);
12727   __Pyx_GIVEREF(__pyx_t_1);
12728   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
12729   __pyx_t_1 = 0;
12730   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
12731   __Pyx_GOTREF(__pyx_t_1);
12732   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12733   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12734   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GDALVersion, __pyx_t_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
12735   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12736 
12737   /* "fiona/_env.pyx":102
12738  *
12739  *
12740  * def get_gdal_version_tuple():             # <<<<<<<<<<<<<<
12741  *     """
12742  *     Calculates gdal version tuple from gdal's internal version number.
12743  */
12744   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_7get_gdal_version_tuple, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
12745   __Pyx_GOTREF(__pyx_t_1);
12746   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_gdal_version_tuple, __pyx_t_1) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
12747   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12748 
12749   /* "fiona/_env.pyx":122
12750  *
12751  *
12752  * def get_proj_version_tuple():             # <<<<<<<<<<<<<<
12753  *     """
12754  *     Returns proj version tuple for gdal >= 3.0.1, otherwise None
12755  */
12756   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_9get_proj_version_tuple, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
12757   __Pyx_GOTREF(__pyx_t_1);
12758   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_proj_version_tuple, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error)
12759   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12760 
12761   /* "fiona/_env.pyx":158
12762  *
12763  *
12764  * def driver_count():             # <<<<<<<<<<<<<<
12765  *     """Return the count of all drivers"""
12766  *     return GDALGetDriverCount() + OGRGetDriverCount()
12767  */
12768   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_11driver_count, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
12769   __Pyx_GOTREF(__pyx_t_1);
12770   if (PyDict_SetItem(__pyx_d, __pyx_n_s_driver_count, __pyx_t_1) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
12771   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12772 
12773   /* "fiona/_env.pyx":269
12774  *
12775  *
12776  * class GDALDataFinder(object):             # <<<<<<<<<<<<<<
12777  *     """Finds GDAL data files
12778  *
12779  */
12780   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
12781   __Pyx_GOTREF(__pyx_t_1);
12782   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__18, __pyx_n_s_GDALDataFinder, __pyx_n_s_GDALDataFinder, (PyObject *) NULL, __pyx_n_s_fiona__env, __pyx_kp_s_Finds_GDAL_data_files_Note_this); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
12783   __Pyx_GOTREF(__pyx_t_3);
12784 
12785   /* "fiona/_env.pyx":275
12786  *
12787  *     """
12788  *     def find_file(self, basename):             # <<<<<<<<<<<<<<
12789  *         """Returns path of a GDAL data file or None
12790  *
12791  */
12792   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14GDALDataFinder_1find_file, 0, __pyx_n_s_GDALDataFinder_find_file, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
12793   __Pyx_GOTREF(__pyx_t_2);
12794   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_find_file, __pyx_t_2) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
12795   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12796 
12797   /* "fiona/_env.pyx":297
12798  *             return path
12799  *
12800  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
12801  *         """Returns GDAL data directory
12802  *
12803  */
12804   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14GDALDataFinder_3search, 0, __pyx_n_s_GDALDataFinder_search, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
12805   __Pyx_GOTREF(__pyx_t_2);
12806   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__23);
12807   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search, __pyx_t_2) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
12808   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12809 
12810   /* "fiona/_env.pyx":314
12811  *         return path
12812  *
12813  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
12814  *         """Check wheel location"""
12815  *         if prefix is None:
12816  */
12817   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14GDALDataFinder_5search_wheel, 0, __pyx_n_s_GDALDataFinder_search_wheel, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
12818   __Pyx_GOTREF(__pyx_t_2);
12819   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__26);
12820   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search_wheel, __pyx_t_2) < 0) __PYX_ERR(0, 314, __pyx_L1_error)
12821   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12822 
12823   /* "fiona/_env.pyx":321
12824  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
12825  *
12826  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
12827  *         """Check sys.prefix location"""
12828  *         datadir = os.path.join(prefix, 'share', 'gdal')
12829  */
12830   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14GDALDataFinder_7search_prefix, 0, __pyx_n_s_GDALDataFinder_search_prefix, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
12831   __Pyx_GOTREF(__pyx_t_2);
12832   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 321, __pyx_L1_error)
12833   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
12834   __Pyx_GOTREF(__pyx_t_9);
12835   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_prefix); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 321, __pyx_L1_error)
12836   __Pyx_GOTREF(__pyx_t_10);
12837   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12838   __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_prefix = __pyx_t_10;
12839   __Pyx_GIVEREF(__pyx_t_10);
12840   __pyx_t_10 = 0;
12841   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_5fiona_4_env_24__defaults__);
12842   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search_prefix, __pyx_t_2) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
12843   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12844 
12845   /* "fiona/_env.pyx":326
12846  *         return datadir if os.path.exists(os.path.join(datadir, 'header.dxf')) else None
12847  *
12848  *     def search_debian(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
12849  *         """Check Debian locations"""
12850  *         gdal_release_name = GDALVersionInfo("RELEASE_NAME")
12851  */
12852   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14GDALDataFinder_9search_debian, 0, __pyx_n_s_GDALDataFinder_search_debian, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error)
12853   __Pyx_GOTREF(__pyx_t_2);
12854   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults1), 1)) __PYX_ERR(0, 326, __pyx_L1_error)
12855   __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_sys); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 326, __pyx_L1_error)
12856   __Pyx_GOTREF(__pyx_t_10);
12857   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_prefix); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 326, __pyx_L1_error)
12858   __Pyx_GOTREF(__pyx_t_9);
12859   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12860   __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_prefix = __pyx_t_9;
12861   __Pyx_GIVEREF(__pyx_t_9);
12862   __pyx_t_9 = 0;
12863   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_5fiona_4_env_26__defaults__);
12864   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search_debian, __pyx_t_2) < 0) __PYX_ERR(0, 326, __pyx_L1_error)
12865   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12866 
12867   /* "fiona/_env.pyx":269
12868  *
12869  *
12870  * class GDALDataFinder(object):             # <<<<<<<<<<<<<<
12871  *     """Finds GDAL data files
12872  *
12873  */
12874   __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_GDALDataFinder, __pyx_tuple__18, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
12875   __Pyx_GOTREF(__pyx_t_2);
12876   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GDALDataFinder, __pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
12877   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12878   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12879   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12880 
12881   /* "fiona/_env.pyx":333
12882  *
12883  *
12884  * class PROJDataFinder(object):             # <<<<<<<<<<<<<<
12885  *     """Finds PROJ data files
12886  *
12887  */
12888   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__31); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
12889   __Pyx_GOTREF(__pyx_t_1);
12890   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__31, __pyx_n_s_PROJDataFinder, __pyx_n_s_PROJDataFinder, (PyObject *) NULL, __pyx_n_s_fiona__env, __pyx_kp_s_Finds_PROJ_data_files_Note_this); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
12891   __Pyx_GOTREF(__pyx_t_3);
12892 
12893   /* "fiona/_env.pyx":339
12894  *
12895  *     """
12896  *     def has_data(self):             # <<<<<<<<<<<<<<
12897  *         """Returns True if PROJ's data files can be found
12898  *
12899  */
12900   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14PROJDataFinder_1has_data, 0, __pyx_n_s_PROJDataFinder_has_data, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error)
12901   __Pyx_GOTREF(__pyx_t_2);
12902   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_has_data, __pyx_t_2) < 0) __PYX_ERR(0, 339, __pyx_L1_error)
12903   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12904 
12905   /* "fiona/_env.pyx":359
12906  *
12907  *
12908  *     def search(self, prefix=None):             # <<<<<<<<<<<<<<
12909  *         """Returns PROJ data directory
12910  *
12911  */
12912   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14PROJDataFinder_3search, 0, __pyx_n_s_PROJDataFinder_search, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error)
12913   __Pyx_GOTREF(__pyx_t_2);
12914   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__36);
12915   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search, __pyx_t_2) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
12916   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12917 
12918   /* "fiona/_env.pyx":374
12919  *         return path
12920  *
12921  *     def search_wheel(self, prefix=None):             # <<<<<<<<<<<<<<
12922  *         """Check wheel location"""
12923  *         if prefix is None:
12924  */
12925   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14PROJDataFinder_5search_wheel, 0, __pyx_n_s_PROJDataFinder_search_wheel, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error)
12926   __Pyx_GOTREF(__pyx_t_2);
12927   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__39);
12928   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search_wheel, __pyx_t_2) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
12929   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12930 
12931   /* "fiona/_env.pyx":381
12932  *         return datadir if os.path.exists(datadir) else None
12933  *
12934  *     def search_prefix(self, prefix=sys.prefix):             # <<<<<<<<<<<<<<
12935  *         """Check sys.prefix location"""
12936  *         datadir = os.path.join(prefix, 'share', 'proj')
12937  */
12938   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5fiona_4_env_14PROJDataFinder_7search_prefix, 0, __pyx_n_s_PROJDataFinder_search_prefix, NULL, __pyx_n_s_fiona__env, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
12939   __Pyx_GOTREF(__pyx_t_2);
12940   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults2), 1)) __PYX_ERR(0, 381, __pyx_L1_error)
12941   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 381, __pyx_L1_error)
12942   __Pyx_GOTREF(__pyx_t_9);
12943   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_prefix); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 381, __pyx_L1_error)
12944   __Pyx_GOTREF(__pyx_t_10);
12945   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12946   __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_2)->__pyx_arg_prefix = __pyx_t_10;
12947   __Pyx_GIVEREF(__pyx_t_10);
12948   __pyx_t_10 = 0;
12949   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_5fiona_4_env_28__defaults__);
12950   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_search_prefix, __pyx_t_2) < 0) __PYX_ERR(0, 381, __pyx_L1_error)
12951   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12952 
12953   /* "fiona/_env.pyx":333
12954  *
12955  *
12956  * class PROJDataFinder(object):             # <<<<<<<<<<<<<<
12957  *     """Finds PROJ data files
12958  *
12959  */
12960   __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PROJDataFinder, __pyx_tuple__31, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
12961   __Pyx_GOTREF(__pyx_t_2);
12962   if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROJDataFinder, __pyx_t_2) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
12963   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12964   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12965   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12966 
12967   /* "fiona/_env.pyx":486
12968  *
12969  *
12970  * def set_proj_data_search_path(path):             # <<<<<<<<<<<<<<
12971  *     """Set PROJ data search path"""
12972  *     set_proj_search_path(path)
12973  */
12974   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_19set_proj_data_search_path, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
12975   __Pyx_GOTREF(__pyx_t_1);
12976   if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_proj_data_search_path, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
12977   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12978 
12979   /* "(tree fragment)":1
12980  * def __pyx_unpickle_ConfigEnv(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
12981  *     cdef object __pyx_PickleError
12982  *     cdef object __pyx_result
12983  */
12984   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_21__pyx_unpickle_ConfigEnv, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
12985   __Pyx_GOTREF(__pyx_t_1);
12986   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ConfigEnv, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
12987   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12988 
12989   /* "(tree fragment)":11
12990  *         __pyx_unpickle_ConfigEnv__set_state(<ConfigEnv> __pyx_result, __pyx_state)
12991  *     return __pyx_result
12992  * cdef __pyx_unpickle_ConfigEnv__set_state(ConfigEnv __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
12993  *     __pyx_result.options = __pyx_state[0]
12994  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
12995  */
12996   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fiona_4_env_23__pyx_unpickle_GDALEnv, NULL, __pyx_n_s_fiona__env); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
12997   __Pyx_GOTREF(__pyx_t_1);
12998   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_GDALEnv, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
12999   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13000 
13001   /* "fiona/_env.pyx":1
13002  * # cython: c_string_type=unicode, c_string_encoding=utf8             # <<<<<<<<<<<<<<
13003  * """GDAL and OGR driver and configuration management
13004  *
13005  */
13006   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
13007   __Pyx_GOTREF(__pyx_t_1);
13008   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13009   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13010 
13011   /*--- Wrapped vars code ---*/
13012 
13013   goto __pyx_L0;
13014   __pyx_L1_error:;
13015   __Pyx_XDECREF(__pyx_t_1);
13016   __Pyx_XDECREF(__pyx_t_2);
13017   __Pyx_XDECREF(__pyx_t_3);
13018   __Pyx_XDECREF(__pyx_t_9);
13019   __Pyx_XDECREF(__pyx_t_10);
13020   if (__pyx_m) {
13021     if (__pyx_d) {
13022       __Pyx_AddTraceback("init fiona._env", __pyx_clineno, __pyx_lineno, __pyx_filename);
13023     }
13024     Py_CLEAR(__pyx_m);
13025   } else if (!PyErr_Occurred()) {
13026     PyErr_SetString(PyExc_ImportError, "init fiona._env");
13027   }
13028   __pyx_L0:;
13029   __Pyx_RefNannyFinishContext();
13030   #if CYTHON_PEP489_MULTI_PHASE_INIT
13031   return (__pyx_m != NULL) ? 0 : -1;
13032   #elif PY_MAJOR_VERSION >= 3
13033   return __pyx_m;
13034   #else
13035   return;
13036   #endif
13037 }
13038 
13039 /* --- Runtime support code --- */
13040 /* Refnanny */
13041 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)13042 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
13043     PyObject *m = NULL, *p = NULL;
13044     void *r = NULL;
13045     m = PyImport_ImportModule(modname);
13046     if (!m) goto end;
13047     p = PyObject_GetAttrString(m, "RefNannyAPI");
13048     if (!p) goto end;
13049     r = PyLong_AsVoidPtr(p);
13050 end:
13051     Py_XDECREF(p);
13052     Py_XDECREF(m);
13053     return (__Pyx_RefNannyAPIStruct *)r;
13054 }
13055 #endif
13056 
13057 /* PyObjectGetAttrStr */
13058 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)13059 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
13060     PyTypeObject* tp = Py_TYPE(obj);
13061     if (likely(tp->tp_getattro))
13062         return tp->tp_getattro(obj, attr_name);
13063 #if PY_MAJOR_VERSION < 3
13064     if (likely(tp->tp_getattr))
13065         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
13066 #endif
13067     return PyObject_GetAttr(obj, attr_name);
13068 }
13069 #endif
13070 
13071 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)13072 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
13073     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
13074     if (unlikely(!result)) {
13075         PyErr_Format(PyExc_NameError,
13076 #if PY_MAJOR_VERSION >= 3
13077             "name '%U' is not defined", name);
13078 #else
13079             "name '%.200s' is not defined", PyString_AS_STRING(name));
13080 #endif
13081     }
13082     return result;
13083 }
13084 
13085 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)13086 static void __Pyx_RaiseArgtupleInvalid(
13087     const char* func_name,
13088     int exact,
13089     Py_ssize_t num_min,
13090     Py_ssize_t num_max,
13091     Py_ssize_t num_found)
13092 {
13093     Py_ssize_t num_expected;
13094     const char *more_or_less;
13095     if (num_found < num_min) {
13096         num_expected = num_min;
13097         more_or_less = "at least";
13098     } else {
13099         num_expected = num_max;
13100         more_or_less = "at most";
13101     }
13102     if (exact) {
13103         more_or_less = "exactly";
13104     }
13105     PyErr_Format(PyExc_TypeError,
13106                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
13107                  func_name, more_or_less, num_expected,
13108                  (num_expected == 1) ? "" : "s", num_found);
13109 }
13110 
13111 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)13112 static void __Pyx_RaiseDoubleKeywordsError(
13113     const char* func_name,
13114     PyObject* kw_name)
13115 {
13116     PyErr_Format(PyExc_TypeError,
13117         #if PY_MAJOR_VERSION >= 3
13118         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
13119         #else
13120         "%s() got multiple values for keyword argument '%s'", func_name,
13121         PyString_AsString(kw_name));
13122         #endif
13123 }
13124 
13125 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)13126 static int __Pyx_ParseOptionalKeywords(
13127     PyObject *kwds,
13128     PyObject **argnames[],
13129     PyObject *kwds2,
13130     PyObject *values[],
13131     Py_ssize_t num_pos_args,
13132     const char* function_name)
13133 {
13134     PyObject *key = 0, *value = 0;
13135     Py_ssize_t pos = 0;
13136     PyObject*** name;
13137     PyObject*** first_kw_arg = argnames + num_pos_args;
13138     while (PyDict_Next(kwds, &pos, &key, &value)) {
13139         name = first_kw_arg;
13140         while (*name && (**name != key)) name++;
13141         if (*name) {
13142             values[name-argnames] = value;
13143             continue;
13144         }
13145         name = first_kw_arg;
13146         #if PY_MAJOR_VERSION < 3
13147         if (likely(PyString_Check(key))) {
13148             while (*name) {
13149                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
13150                         && _PyString_Eq(**name, key)) {
13151                     values[name-argnames] = value;
13152                     break;
13153                 }
13154                 name++;
13155             }
13156             if (*name) continue;
13157             else {
13158                 PyObject*** argname = argnames;
13159                 while (argname != first_kw_arg) {
13160                     if ((**argname == key) || (
13161                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
13162                              && _PyString_Eq(**argname, key))) {
13163                         goto arg_passed_twice;
13164                     }
13165                     argname++;
13166                 }
13167             }
13168         } else
13169         #endif
13170         if (likely(PyUnicode_Check(key))) {
13171             while (*name) {
13172                 int cmp = (**name == key) ? 0 :
13173                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13174                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13175                 #endif
13176                     PyUnicode_Compare(**name, key);
13177                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13178                 if (cmp == 0) {
13179                     values[name-argnames] = value;
13180                     break;
13181                 }
13182                 name++;
13183             }
13184             if (*name) continue;
13185             else {
13186                 PyObject*** argname = argnames;
13187                 while (argname != first_kw_arg) {
13188                     int cmp = (**argname == key) ? 0 :
13189                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13190                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13191                     #endif
13192                         PyUnicode_Compare(**argname, key);
13193                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13194                     if (cmp == 0) goto arg_passed_twice;
13195                     argname++;
13196                 }
13197             }
13198         } else
13199             goto invalid_keyword_type;
13200         if (kwds2) {
13201             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
13202         } else {
13203             goto invalid_keyword;
13204         }
13205     }
13206     return 0;
13207 arg_passed_twice:
13208     __Pyx_RaiseDoubleKeywordsError(function_name, key);
13209     goto bad;
13210 invalid_keyword_type:
13211     PyErr_Format(PyExc_TypeError,
13212         "%.200s() keywords must be strings", function_name);
13213     goto bad;
13214 invalid_keyword:
13215     PyErr_Format(PyExc_TypeError,
13216     #if PY_MAJOR_VERSION < 3
13217         "%.200s() got an unexpected keyword argument '%.200s'",
13218         function_name, PyString_AsString(key));
13219     #else
13220         "%s() got an unexpected keyword argument '%U'",
13221         function_name, key);
13222     #endif
13223 bad:
13224     return -1;
13225 }
13226 
13227 /* PyCFunctionFastCall */
13228 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)13229 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
13230     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
13231     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
13232     PyObject *self = PyCFunction_GET_SELF(func);
13233     int flags = PyCFunction_GET_FLAGS(func);
13234     assert(PyCFunction_Check(func));
13235     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
13236     assert(nargs >= 0);
13237     assert(nargs == 0 || args != NULL);
13238     /* _PyCFunction_FastCallDict() must not be called with an exception set,
13239        because it may clear it (directly or indirectly) and so the
13240        caller loses its exception */
13241     assert(!PyErr_Occurred());
13242     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
13243         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
13244     } else {
13245         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
13246     }
13247 }
13248 #endif
13249 
13250 /* PyFunctionFastCall */
13251 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)13252 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
13253                                                PyObject *globals) {
13254     PyFrameObject *f;
13255     PyThreadState *tstate = __Pyx_PyThreadState_Current;
13256     PyObject **fastlocals;
13257     Py_ssize_t i;
13258     PyObject *result;
13259     assert(globals != NULL);
13260     /* XXX Perhaps we should create a specialized
13261        PyFrame_New() that doesn't take locals, but does
13262        take builtins without sanity checking them.
13263        */
13264     assert(tstate != NULL);
13265     f = PyFrame_New(tstate, co, globals, NULL);
13266     if (f == NULL) {
13267         return NULL;
13268     }
13269     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
13270     for (i = 0; i < na; i++) {
13271         Py_INCREF(*args);
13272         fastlocals[i] = *args++;
13273     }
13274     result = PyEval_EvalFrameEx(f,0);
13275     ++tstate->recursion_depth;
13276     Py_DECREF(f);
13277     --tstate->recursion_depth;
13278     return result;
13279 }
13280 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)13281 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
13282     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
13283     PyObject *globals = PyFunction_GET_GLOBALS(func);
13284     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
13285     PyObject *closure;
13286 #if PY_MAJOR_VERSION >= 3
13287     PyObject *kwdefs;
13288 #endif
13289     PyObject *kwtuple, **k;
13290     PyObject **d;
13291     Py_ssize_t nd;
13292     Py_ssize_t nk;
13293     PyObject *result;
13294     assert(kwargs == NULL || PyDict_Check(kwargs));
13295     nk = kwargs ? PyDict_Size(kwargs) : 0;
13296     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
13297         return NULL;
13298     }
13299     if (
13300 #if PY_MAJOR_VERSION >= 3
13301             co->co_kwonlyargcount == 0 &&
13302 #endif
13303             likely(kwargs == NULL || nk == 0) &&
13304             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
13305         if (argdefs == NULL && co->co_argcount == nargs) {
13306             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
13307             goto done;
13308         }
13309         else if (nargs == 0 && argdefs != NULL
13310                  && co->co_argcount == Py_SIZE(argdefs)) {
13311             /* function called with no arguments, but all parameters have
13312                a default value: use default values as arguments .*/
13313             args = &PyTuple_GET_ITEM(argdefs, 0);
13314             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
13315             goto done;
13316         }
13317     }
13318     if (kwargs != NULL) {
13319         Py_ssize_t pos, i;
13320         kwtuple = PyTuple_New(2 * nk);
13321         if (kwtuple == NULL) {
13322             result = NULL;
13323             goto done;
13324         }
13325         k = &PyTuple_GET_ITEM(kwtuple, 0);
13326         pos = i = 0;
13327         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
13328             Py_INCREF(k[i]);
13329             Py_INCREF(k[i+1]);
13330             i += 2;
13331         }
13332         nk = i / 2;
13333     }
13334     else {
13335         kwtuple = NULL;
13336         k = NULL;
13337     }
13338     closure = PyFunction_GET_CLOSURE(func);
13339 #if PY_MAJOR_VERSION >= 3
13340     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
13341 #endif
13342     if (argdefs != NULL) {
13343         d = &PyTuple_GET_ITEM(argdefs, 0);
13344         nd = Py_SIZE(argdefs);
13345     }
13346     else {
13347         d = NULL;
13348         nd = 0;
13349     }
13350 #if PY_MAJOR_VERSION >= 3
13351     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
13352                                args, (int)nargs,
13353                                k, (int)nk,
13354                                d, (int)nd, kwdefs, closure);
13355 #else
13356     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
13357                                args, (int)nargs,
13358                                k, (int)nk,
13359                                d, (int)nd, closure);
13360 #endif
13361     Py_XDECREF(kwtuple);
13362 done:
13363     Py_LeaveRecursiveCall();
13364     return result;
13365 }
13366 #endif
13367 #endif
13368 
13369 /* PyObjectCall */
13370 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)13371 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13372     PyObject *result;
13373     ternaryfunc call = func->ob_type->tp_call;
13374     if (unlikely(!call))
13375         return PyObject_Call(func, arg, kw);
13376     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13377         return NULL;
13378     result = (*call)(func, arg, kw);
13379     Py_LeaveRecursiveCall();
13380     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13381         PyErr_SetString(
13382             PyExc_SystemError,
13383             "NULL result without error in PyObject_Call");
13384     }
13385     return result;
13386 }
13387 #endif
13388 
13389 /* PyObjectCallMethO */
13390 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)13391 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
13392     PyObject *self, *result;
13393     PyCFunction cfunc;
13394     cfunc = PyCFunction_GET_FUNCTION(func);
13395     self = PyCFunction_GET_SELF(func);
13396     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13397         return NULL;
13398     result = cfunc(self, arg);
13399     Py_LeaveRecursiveCall();
13400     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13401         PyErr_SetString(
13402             PyExc_SystemError,
13403             "NULL result without error in PyObject_Call");
13404     }
13405     return result;
13406 }
13407 #endif
13408 
13409 /* PyObjectCallOneArg */
13410 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)13411 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13412     PyObject *result;
13413     PyObject *args = PyTuple_New(1);
13414     if (unlikely(!args)) return NULL;
13415     Py_INCREF(arg);
13416     PyTuple_SET_ITEM(args, 0, arg);
13417     result = __Pyx_PyObject_Call(func, args, NULL);
13418     Py_DECREF(args);
13419     return result;
13420 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)13421 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13422 #if CYTHON_FAST_PYCALL
13423     if (PyFunction_Check(func)) {
13424         return __Pyx_PyFunction_FastCall(func, &arg, 1);
13425     }
13426 #endif
13427     if (likely(PyCFunction_Check(func))) {
13428         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
13429             return __Pyx_PyObject_CallMethO(func, arg);
13430 #if CYTHON_FAST_PYCCALL
13431         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
13432             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
13433 #endif
13434         }
13435     }
13436     return __Pyx__PyObject_CallOneArg(func, arg);
13437 }
13438 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)13439 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13440     PyObject *result;
13441     PyObject *args = PyTuple_Pack(1, arg);
13442     if (unlikely(!args)) return NULL;
13443     result = __Pyx_PyObject_Call(func, args, NULL);
13444     Py_DECREF(args);
13445     return result;
13446 }
13447 #endif
13448 
13449 /* PyDictVersioning */
13450 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)13451 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
13452     PyObject *dict = Py_TYPE(obj)->tp_dict;
13453     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
13454 }
__Pyx_get_object_dict_version(PyObject * obj)13455 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
13456     PyObject **dictptr = NULL;
13457     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
13458     if (offset) {
13459 #if CYTHON_COMPILING_IN_CPYTHON
13460         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
13461 #else
13462         dictptr = _PyObject_GetDictPtr(obj);
13463 #endif
13464     }
13465     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
13466 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)13467 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
13468     PyObject *dict = Py_TYPE(obj)->tp_dict;
13469     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
13470         return 0;
13471     return obj_dict_version == __Pyx_get_object_dict_version(obj);
13472 }
13473 #endif
13474 
13475 /* GetModuleGlobalName */
13476 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)13477 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
13478 #else
13479 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
13480 #endif
13481 {
13482     PyObject *result;
13483 #if !CYTHON_AVOID_BORROWED_REFS
13484 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
13485     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
13486     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13487     if (likely(result)) {
13488         return __Pyx_NewRef(result);
13489     } else if (unlikely(PyErr_Occurred())) {
13490         return NULL;
13491     }
13492 #else
13493     result = PyDict_GetItem(__pyx_d, name);
13494     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13495     if (likely(result)) {
13496         return __Pyx_NewRef(result);
13497     }
13498 #endif
13499 #else
13500     result = PyObject_GetItem(__pyx_d, name);
13501     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13502     if (likely(result)) {
13503         return __Pyx_NewRef(result);
13504     }
13505     PyErr_Clear();
13506 #endif
13507     return __Pyx_GetBuiltinName(name);
13508 }
13509 
13510 /* PyObjectCallNoArg */
13511 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)13512 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
13513 #if CYTHON_FAST_PYCALL
13514     if (PyFunction_Check(func)) {
13515         return __Pyx_PyFunction_FastCall(func, NULL, 0);
13516     }
13517 #endif
13518 #ifdef __Pyx_CyFunction_USED
13519     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
13520 #else
13521     if (likely(PyCFunction_Check(func)))
13522 #endif
13523     {
13524         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
13525             return __Pyx_PyObject_CallMethO(func, NULL);
13526         }
13527     }
13528     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
13529 }
13530 #endif
13531 
13532 /* PyIntBinop */
13533 #if !CYTHON_COMPILING_IN_PYPY
13534 #if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
13535 #define __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(operand)\
13536     if (unlikely(zerodivision_check && ((operand) == 0))) {\
13537         PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
13538         return NULL;\
13539     }
13540 #endif
__Pyx_PyInt_FloorDivideObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)13541 static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
13542     (void)inplace;
13543     (void)zerodivision_check;
13544     #if PY_MAJOR_VERSION < 3
13545     if (likely(PyInt_CheckExact(op1))) {
13546         const long b = intval;
13547         long x;
13548         long a = PyInt_AS_LONG(op1);
13549             __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b)
13550             if (unlikely(b == -1 && ((unsigned long)a) == 0-(unsigned long)a))
13551                 return PyInt_Type.tp_as_number->nb_floor_divide(op1, op2);
13552             else {
13553                 long q, r;
13554                 q = a / b;
13555                 r = a - q*b;
13556                 q -= ((r != 0) & ((r ^ b) < 0));
13557                 x = q;
13558             }
13559             return PyInt_FromLong(x);
13560     }
13561     #endif
13562     #if CYTHON_USE_PYLONG_INTERNALS
13563     if (likely(PyLong_CheckExact(op1))) {
13564         const long b = intval;
13565         long a, x;
13566 #ifdef HAVE_LONG_LONG
13567         const PY_LONG_LONG llb = intval;
13568         PY_LONG_LONG lla, llx;
13569 #endif
13570         const digit* digits = ((PyLongObject*)op1)->ob_digit;
13571         const Py_ssize_t size = Py_SIZE(op1);
13572         if (likely(__Pyx_sst_abs(size) <= 1)) {
13573             a = likely(size) ? digits[0] : 0;
13574             if (size == -1) a = -a;
13575         } else {
13576             switch (size) {
13577                 case -2:
13578                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13579                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13580                         break;
13581 #ifdef HAVE_LONG_LONG
13582                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
13583                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13584                         goto long_long;
13585 #endif
13586                     }
13587                     CYTHON_FALLTHROUGH;
13588                 case 2:
13589                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13590                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13591                         break;
13592 #ifdef HAVE_LONG_LONG
13593                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
13594                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13595                         goto long_long;
13596 #endif
13597                     }
13598                     CYTHON_FALLTHROUGH;
13599                 case -3:
13600                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13601                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13602                         break;
13603 #ifdef HAVE_LONG_LONG
13604                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
13605                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13606                         goto long_long;
13607 #endif
13608                     }
13609                     CYTHON_FALLTHROUGH;
13610                 case 3:
13611                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13612                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13613                         break;
13614 #ifdef HAVE_LONG_LONG
13615                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
13616                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13617                         goto long_long;
13618 #endif
13619                     }
13620                     CYTHON_FALLTHROUGH;
13621                 case -4:
13622                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13623                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13624                         break;
13625 #ifdef HAVE_LONG_LONG
13626                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
13627                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13628                         goto long_long;
13629 #endif
13630                     }
13631                     CYTHON_FALLTHROUGH;
13632                 case 4:
13633                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13634                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
13635                         break;
13636 #ifdef HAVE_LONG_LONG
13637                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
13638                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
13639                         goto long_long;
13640 #endif
13641                     }
13642                     CYTHON_FALLTHROUGH;
13643                 default: return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2);
13644             }
13645         }
13646                 __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b)
13647                 {
13648                     long q, r;
13649                     q = a / b;
13650                     r = a - q*b;
13651                     q -= ((r != 0) & ((r ^ b) < 0));
13652                     x = q;
13653                 }
13654             return PyLong_FromLong(x);
13655 #ifdef HAVE_LONG_LONG
13656         long_long:
13657                 {
13658                     PY_LONG_LONG q, r;
13659                     q = lla / llb;
13660                     r = lla - q*llb;
13661                     q -= ((r != 0) & ((r ^ llb) < 0));
13662                     llx = q;
13663                 }
13664             return PyLong_FromLongLong(llx);
13665 #endif
13666 
13667 
13668     }
13669     #endif
13670     return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
13671 }
13672 #endif
13673 
13674 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)13675 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
13676     PyObject *args, *result = NULL;
13677     #if CYTHON_FAST_PYCALL
13678     if (PyFunction_Check(function)) {
13679         PyObject *args[2] = {arg1, arg2};
13680         return __Pyx_PyFunction_FastCall(function, args, 2);
13681     }
13682     #endif
13683     #if CYTHON_FAST_PYCCALL
13684     if (__Pyx_PyFastCFunction_Check(function)) {
13685         PyObject *args[2] = {arg1, arg2};
13686         return __Pyx_PyCFunction_FastCall(function, args, 2);
13687     }
13688     #endif
13689     args = PyTuple_New(2);
13690     if (unlikely(!args)) goto done;
13691     Py_INCREF(arg1);
13692     PyTuple_SET_ITEM(args, 0, arg1);
13693     Py_INCREF(arg2);
13694     PyTuple_SET_ITEM(args, 1, arg2);
13695     Py_INCREF(function);
13696     result = __Pyx_PyObject_Call(function, args, NULL);
13697     Py_DECREF(args);
13698     Py_DECREF(function);
13699 done:
13700     return result;
13701 }
13702 
13703 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)13704 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
13705     PyObject *r;
13706     if (!j) return NULL;
13707     r = PyObject_GetItem(o, j);
13708     Py_DECREF(j);
13709     return r;
13710 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13711 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
13712                                                               CYTHON_NCP_UNUSED int wraparound,
13713                                                               CYTHON_NCP_UNUSED int boundscheck) {
13714 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13715     Py_ssize_t wrapped_i = i;
13716     if (wraparound & unlikely(i < 0)) {
13717         wrapped_i += PyList_GET_SIZE(o);
13718     }
13719     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
13720         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
13721         Py_INCREF(r);
13722         return r;
13723     }
13724     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13725 #else
13726     return PySequence_GetItem(o, i);
13727 #endif
13728 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13729 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
13730                                                               CYTHON_NCP_UNUSED int wraparound,
13731                                                               CYTHON_NCP_UNUSED int boundscheck) {
13732 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13733     Py_ssize_t wrapped_i = i;
13734     if (wraparound & unlikely(i < 0)) {
13735         wrapped_i += PyTuple_GET_SIZE(o);
13736     }
13737     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
13738         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
13739         Py_INCREF(r);
13740         return r;
13741     }
13742     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13743 #else
13744     return PySequence_GetItem(o, i);
13745 #endif
13746 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13747 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
13748                                                      CYTHON_NCP_UNUSED int wraparound,
13749                                                      CYTHON_NCP_UNUSED int boundscheck) {
13750 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
13751     if (is_list || PyList_CheckExact(o)) {
13752         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
13753         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
13754             PyObject *r = PyList_GET_ITEM(o, n);
13755             Py_INCREF(r);
13756             return r;
13757         }
13758     }
13759     else if (PyTuple_CheckExact(o)) {
13760         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
13761         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
13762             PyObject *r = PyTuple_GET_ITEM(o, n);
13763             Py_INCREF(r);
13764             return r;
13765         }
13766     } else {
13767         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
13768         if (likely(m && m->sq_item)) {
13769             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
13770                 Py_ssize_t l = m->sq_length(o);
13771                 if (likely(l >= 0)) {
13772                     i += l;
13773                 } else {
13774                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
13775                         return NULL;
13776                     PyErr_Clear();
13777                 }
13778             }
13779             return m->sq_item(o, i);
13780         }
13781     }
13782 #else
13783     if (is_list || PySequence_Check(o)) {
13784         return PySequence_GetItem(o, i);
13785     }
13786 #endif
13787     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13788 }
13789 
13790 /* ObjectGetItem */
13791 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)13792 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
13793     PyObject *runerr;
13794     Py_ssize_t key_value;
13795     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
13796     if (unlikely(!(m && m->sq_item))) {
13797         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
13798         return NULL;
13799     }
13800     key_value = __Pyx_PyIndex_AsSsize_t(index);
13801     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
13802         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
13803     }
13804     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
13805         PyErr_Clear();
13806         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
13807     }
13808     return NULL;
13809 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)13810 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
13811     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
13812     if (likely(m && m->mp_subscript)) {
13813         return m->mp_subscript(obj, key);
13814     }
13815     return __Pyx_PyObject_GetIndex(obj, key);
13816 }
13817 #endif
13818 
13819 /* PyErrFetchRestore */
13820 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)13821 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
13822     PyObject *tmp_type, *tmp_value, *tmp_tb;
13823     tmp_type = tstate->curexc_type;
13824     tmp_value = tstate->curexc_value;
13825     tmp_tb = tstate->curexc_traceback;
13826     tstate->curexc_type = type;
13827     tstate->curexc_value = value;
13828     tstate->curexc_traceback = tb;
13829     Py_XDECREF(tmp_type);
13830     Py_XDECREF(tmp_value);
13831     Py_XDECREF(tmp_tb);
13832 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)13833 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13834     *type = tstate->curexc_type;
13835     *value = tstate->curexc_value;
13836     *tb = tstate->curexc_traceback;
13837     tstate->curexc_type = 0;
13838     tstate->curexc_value = 0;
13839     tstate->curexc_traceback = 0;
13840 }
13841 #endif
13842 
13843 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)13844 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
13845                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
13846                                   int full_traceback, CYTHON_UNUSED int nogil) {
13847     PyObject *old_exc, *old_val, *old_tb;
13848     PyObject *ctx;
13849     __Pyx_PyThreadState_declare
13850 #ifdef WITH_THREAD
13851     PyGILState_STATE state;
13852     if (nogil)
13853         state = PyGILState_Ensure();
13854 #ifdef _MSC_VER
13855     else state = (PyGILState_STATE)-1;
13856 #endif
13857 #endif
13858     __Pyx_PyThreadState_assign
13859     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
13860     if (full_traceback) {
13861         Py_XINCREF(old_exc);
13862         Py_XINCREF(old_val);
13863         Py_XINCREF(old_tb);
13864         __Pyx_ErrRestore(old_exc, old_val, old_tb);
13865         PyErr_PrintEx(1);
13866     }
13867     #if PY_MAJOR_VERSION < 3
13868     ctx = PyString_FromString(name);
13869     #else
13870     ctx = PyUnicode_FromString(name);
13871     #endif
13872     __Pyx_ErrRestore(old_exc, old_val, old_tb);
13873     if (!ctx) {
13874         PyErr_WriteUnraisable(Py_None);
13875     } else {
13876         PyErr_WriteUnraisable(ctx);
13877         Py_DECREF(ctx);
13878     }
13879 #ifdef WITH_THREAD
13880     if (nogil)
13881         PyGILState_Release(state);
13882 #endif
13883 }
13884 
13885 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)13886 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
13887 #if CYTHON_COMPILING_IN_PYPY
13888     return PyObject_RichCompareBool(s1, s2, equals);
13889 #else
13890     if (s1 == s2) {
13891         return (equals == Py_EQ);
13892     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
13893         const char *ps1, *ps2;
13894         Py_ssize_t length = PyBytes_GET_SIZE(s1);
13895         if (length != PyBytes_GET_SIZE(s2))
13896             return (equals == Py_NE);
13897         ps1 = PyBytes_AS_STRING(s1);
13898         ps2 = PyBytes_AS_STRING(s2);
13899         if (ps1[0] != ps2[0]) {
13900             return (equals == Py_NE);
13901         } else if (length == 1) {
13902             return (equals == Py_EQ);
13903         } else {
13904             int result;
13905 #if CYTHON_USE_UNICODE_INTERNALS
13906             Py_hash_t hash1, hash2;
13907             hash1 = ((PyBytesObject*)s1)->ob_shash;
13908             hash2 = ((PyBytesObject*)s2)->ob_shash;
13909             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13910                 return (equals == Py_NE);
13911             }
13912 #endif
13913             result = memcmp(ps1, ps2, (size_t)length);
13914             return (equals == Py_EQ) ? (result == 0) : (result != 0);
13915         }
13916     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
13917         return (equals == Py_NE);
13918     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
13919         return (equals == Py_NE);
13920     } else {
13921         int result;
13922         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
13923         if (!py_result)
13924             return -1;
13925         result = __Pyx_PyObject_IsTrue(py_result);
13926         Py_DECREF(py_result);
13927         return result;
13928     }
13929 #endif
13930 }
13931 
13932 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)13933 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
13934 #if CYTHON_COMPILING_IN_PYPY
13935     return PyObject_RichCompareBool(s1, s2, equals);
13936 #else
13937 #if PY_MAJOR_VERSION < 3
13938     PyObject* owned_ref = NULL;
13939 #endif
13940     int s1_is_unicode, s2_is_unicode;
13941     if (s1 == s2) {
13942         goto return_eq;
13943     }
13944     s1_is_unicode = PyUnicode_CheckExact(s1);
13945     s2_is_unicode = PyUnicode_CheckExact(s2);
13946 #if PY_MAJOR_VERSION < 3
13947     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
13948         owned_ref = PyUnicode_FromObject(s2);
13949         if (unlikely(!owned_ref))
13950             return -1;
13951         s2 = owned_ref;
13952         s2_is_unicode = 1;
13953     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
13954         owned_ref = PyUnicode_FromObject(s1);
13955         if (unlikely(!owned_ref))
13956             return -1;
13957         s1 = owned_ref;
13958         s1_is_unicode = 1;
13959     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
13960         return __Pyx_PyBytes_Equals(s1, s2, equals);
13961     }
13962 #endif
13963     if (s1_is_unicode & s2_is_unicode) {
13964         Py_ssize_t length;
13965         int kind;
13966         void *data1, *data2;
13967         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
13968             return -1;
13969         length = __Pyx_PyUnicode_GET_LENGTH(s1);
13970         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
13971             goto return_ne;
13972         }
13973 #if CYTHON_USE_UNICODE_INTERNALS
13974         {
13975             Py_hash_t hash1, hash2;
13976         #if CYTHON_PEP393_ENABLED
13977             hash1 = ((PyASCIIObject*)s1)->hash;
13978             hash2 = ((PyASCIIObject*)s2)->hash;
13979         #else
13980             hash1 = ((PyUnicodeObject*)s1)->hash;
13981             hash2 = ((PyUnicodeObject*)s2)->hash;
13982         #endif
13983             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13984                 goto return_ne;
13985             }
13986         }
13987 #endif
13988         kind = __Pyx_PyUnicode_KIND(s1);
13989         if (kind != __Pyx_PyUnicode_KIND(s2)) {
13990             goto return_ne;
13991         }
13992         data1 = __Pyx_PyUnicode_DATA(s1);
13993         data2 = __Pyx_PyUnicode_DATA(s2);
13994         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
13995             goto return_ne;
13996         } else if (length == 1) {
13997             goto return_eq;
13998         } else {
13999             int result = memcmp(data1, data2, (size_t)(length * kind));
14000             #if PY_MAJOR_VERSION < 3
14001             Py_XDECREF(owned_ref);
14002             #endif
14003             return (equals == Py_EQ) ? (result == 0) : (result != 0);
14004         }
14005     } else if ((s1 == Py_None) & s2_is_unicode) {
14006         goto return_ne;
14007     } else if ((s2 == Py_None) & s1_is_unicode) {
14008         goto return_ne;
14009     } else {
14010         int result;
14011         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14012         #if PY_MAJOR_VERSION < 3
14013         Py_XDECREF(owned_ref);
14014         #endif
14015         if (!py_result)
14016             return -1;
14017         result = __Pyx_PyObject_IsTrue(py_result);
14018         Py_DECREF(py_result);
14019         return result;
14020     }
14021 return_eq:
14022     #if PY_MAJOR_VERSION < 3
14023     Py_XDECREF(owned_ref);
14024     #endif
14025     return (equals == Py_EQ);
14026 return_ne:
14027     #if PY_MAJOR_VERSION < 3
14028     Py_XDECREF(owned_ref);
14029     #endif
14030     return (equals == Py_NE);
14031 #endif
14032 }
14033 
14034 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)14035 static int __Pyx_CheckKeywordStrings(
14036     PyObject *kwdict,
14037     const char* function_name,
14038     int kw_allowed)
14039 {
14040     PyObject* key = 0;
14041     Py_ssize_t pos = 0;
14042 #if CYTHON_COMPILING_IN_PYPY
14043     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
14044         goto invalid_keyword;
14045     return 1;
14046 #else
14047     while (PyDict_Next(kwdict, &pos, &key, 0)) {
14048         #if PY_MAJOR_VERSION < 3
14049         if (unlikely(!PyString_Check(key)))
14050         #endif
14051             if (unlikely(!PyUnicode_Check(key)))
14052                 goto invalid_keyword_type;
14053     }
14054     if ((!kw_allowed) && unlikely(key))
14055         goto invalid_keyword;
14056     return 1;
14057 invalid_keyword_type:
14058     PyErr_Format(PyExc_TypeError,
14059         "%.200s() keywords must be strings", function_name);
14060     return 0;
14061 #endif
14062 invalid_keyword:
14063     PyErr_Format(PyExc_TypeError,
14064     #if PY_MAJOR_VERSION < 3
14065         "%.200s() got an unexpected keyword argument '%.200s'",
14066         function_name, PyString_AsString(key));
14067     #else
14068         "%s() got an unexpected keyword argument '%U'",
14069         function_name, key);
14070     #endif
14071     return 0;
14072 }
14073 
14074 /* IterFinish */
__Pyx_IterFinish(void)14075 static CYTHON_INLINE int __Pyx_IterFinish(void) {
14076 #if CYTHON_FAST_THREAD_STATE
14077     PyThreadState *tstate = __Pyx_PyThreadState_Current;
14078     PyObject* exc_type = tstate->curexc_type;
14079     if (unlikely(exc_type)) {
14080         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
14081             PyObject *exc_value, *exc_tb;
14082             exc_value = tstate->curexc_value;
14083             exc_tb = tstate->curexc_traceback;
14084             tstate->curexc_type = 0;
14085             tstate->curexc_value = 0;
14086             tstate->curexc_traceback = 0;
14087             Py_DECREF(exc_type);
14088             Py_XDECREF(exc_value);
14089             Py_XDECREF(exc_tb);
14090             return 0;
14091         } else {
14092             return -1;
14093         }
14094     }
14095     return 0;
14096 #else
14097     if (unlikely(PyErr_Occurred())) {
14098         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
14099             PyErr_Clear();
14100             return 0;
14101         } else {
14102             return -1;
14103         }
14104     }
14105     return 0;
14106 #endif
14107 }
14108 
14109 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)14110 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
14111     PyObject *attr;
14112 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
14113     PyTypeObject *tp = Py_TYPE(obj);
14114     PyObject *descr;
14115     descrgetfunc f = NULL;
14116     PyObject **dictptr, *dict;
14117     int meth_found = 0;
14118     assert (*method == NULL);
14119     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
14120         attr = __Pyx_PyObject_GetAttrStr(obj, name);
14121         goto try_unpack;
14122     }
14123     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
14124         return 0;
14125     }
14126     descr = _PyType_Lookup(tp, name);
14127     if (likely(descr != NULL)) {
14128         Py_INCREF(descr);
14129 #if PY_MAJOR_VERSION >= 3
14130         #ifdef __Pyx_CyFunction_USED
14131         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
14132         #else
14133         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
14134         #endif
14135 #else
14136         #ifdef __Pyx_CyFunction_USED
14137         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
14138         #else
14139         if (likely(PyFunction_Check(descr)))
14140         #endif
14141 #endif
14142         {
14143             meth_found = 1;
14144         } else {
14145             f = Py_TYPE(descr)->tp_descr_get;
14146             if (f != NULL && PyDescr_IsData(descr)) {
14147                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
14148                 Py_DECREF(descr);
14149                 goto try_unpack;
14150             }
14151         }
14152     }
14153     dictptr = _PyObject_GetDictPtr(obj);
14154     if (dictptr != NULL && (dict = *dictptr) != NULL) {
14155         Py_INCREF(dict);
14156         attr = __Pyx_PyDict_GetItemStr(dict, name);
14157         if (attr != NULL) {
14158             Py_INCREF(attr);
14159             Py_DECREF(dict);
14160             Py_XDECREF(descr);
14161             goto try_unpack;
14162         }
14163         Py_DECREF(dict);
14164     }
14165     if (meth_found) {
14166         *method = descr;
14167         return 1;
14168     }
14169     if (f != NULL) {
14170         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
14171         Py_DECREF(descr);
14172         goto try_unpack;
14173     }
14174     if (descr != NULL) {
14175         *method = descr;
14176         return 0;
14177     }
14178     PyErr_Format(PyExc_AttributeError,
14179 #if PY_MAJOR_VERSION >= 3
14180                  "'%.50s' object has no attribute '%U'",
14181                  tp->tp_name, name);
14182 #else
14183                  "'%.50s' object has no attribute '%.400s'",
14184                  tp->tp_name, PyString_AS_STRING(name));
14185 #endif
14186     return 0;
14187 #else
14188     attr = __Pyx_PyObject_GetAttrStr(obj, name);
14189     goto try_unpack;
14190 #endif
14191 try_unpack:
14192 #if CYTHON_UNPACK_METHODS
14193     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
14194         PyObject *function = PyMethod_GET_FUNCTION(attr);
14195         Py_INCREF(function);
14196         Py_DECREF(attr);
14197         *method = function;
14198         return 1;
14199     }
14200 #endif
14201     *method = attr;
14202     return 0;
14203 }
14204 
14205 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)14206 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
14207     PyObject *method = NULL, *result = NULL;
14208     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
14209     if (likely(is_method)) {
14210         result = __Pyx_PyObject_CallOneArg(method, obj);
14211         Py_DECREF(method);
14212         return result;
14213     }
14214     if (unlikely(!method)) goto bad;
14215     result = __Pyx_PyObject_CallNoArg(method);
14216     Py_DECREF(method);
14217 bad:
14218     return result;
14219 }
14220 
14221 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)14222 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
14223     PyErr_Format(PyExc_ValueError,
14224                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
14225                  index, (index == 1) ? "" : "s");
14226 }
14227 
14228 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)14229 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
14230     PyErr_Format(PyExc_ValueError,
14231                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
14232 }
14233 
14234 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)14235 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
14236     if (unlikely(retval)) {
14237         Py_DECREF(retval);
14238         __Pyx_RaiseTooManyValuesError(expected);
14239         return -1;
14240     } else {
14241         return __Pyx_IterFinish();
14242     }
14243     return 0;
14244 }
14245 
14246 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)14247 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
14248     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
14249 }
14250 
14251 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)14252 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
14253     if (t == Py_None) {
14254       __Pyx_RaiseNoneNotIterableError();
14255     } else if (PyTuple_GET_SIZE(t) < index) {
14256       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
14257     } else {
14258       __Pyx_RaiseTooManyValuesError(index);
14259     }
14260 }
14261 
14262 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)14263 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
14264         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
14265     PyObject *value1 = NULL, *value2 = NULL;
14266 #if CYTHON_COMPILING_IN_PYPY
14267     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
14268     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
14269 #else
14270     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
14271     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
14272 #endif
14273     if (decref_tuple) {
14274         Py_DECREF(tuple);
14275     }
14276     *pvalue1 = value1;
14277     *pvalue2 = value2;
14278     return 0;
14279 #if CYTHON_COMPILING_IN_PYPY
14280 bad:
14281     Py_XDECREF(value1);
14282     Py_XDECREF(value2);
14283     if (decref_tuple) { Py_XDECREF(tuple); }
14284     return -1;
14285 #endif
14286 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)14287 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
14288                                        int has_known_size, int decref_tuple) {
14289     Py_ssize_t index;
14290     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
14291     iternextfunc iternext;
14292     iter = PyObject_GetIter(tuple);
14293     if (unlikely(!iter)) goto bad;
14294     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
14295     iternext = Py_TYPE(iter)->tp_iternext;
14296     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
14297     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
14298     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
14299     Py_DECREF(iter);
14300     *pvalue1 = value1;
14301     *pvalue2 = value2;
14302     return 0;
14303 unpacking_failed:
14304     if (!has_known_size && __Pyx_IterFinish() == 0)
14305         __Pyx_RaiseNeedMoreValuesError(index);
14306 bad:
14307     Py_XDECREF(iter);
14308     Py_XDECREF(value1);
14309     Py_XDECREF(value2);
14310     if (decref_tuple) { Py_XDECREF(tuple); }
14311     return -1;
14312 }
14313 
14314 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)14315 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
14316                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
14317     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
14318     *p_source_is_dict = is_dict;
14319     if (is_dict) {
14320 #if !CYTHON_COMPILING_IN_PYPY
14321         *p_orig_length = PyDict_Size(iterable);
14322         Py_INCREF(iterable);
14323         return iterable;
14324 #elif PY_MAJOR_VERSION >= 3
14325         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
14326         PyObject **pp = NULL;
14327         if (method_name) {
14328             const char *name = PyUnicode_AsUTF8(method_name);
14329             if (strcmp(name, "iteritems") == 0) pp = &py_items;
14330             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
14331             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
14332             if (pp) {
14333                 if (!*pp) {
14334                     *pp = PyUnicode_FromString(name + 4);
14335                     if (!*pp)
14336                         return NULL;
14337                 }
14338                 method_name = *pp;
14339             }
14340         }
14341 #endif
14342     }
14343     *p_orig_length = 0;
14344     if (method_name) {
14345         PyObject* iter;
14346         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
14347         if (!iterable)
14348             return NULL;
14349 #if !CYTHON_COMPILING_IN_PYPY
14350         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
14351             return iterable;
14352 #endif
14353         iter = PyObject_GetIter(iterable);
14354         Py_DECREF(iterable);
14355         return iter;
14356     }
14357     return PyObject_GetIter(iterable);
14358 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)14359 static CYTHON_INLINE int __Pyx_dict_iter_next(
14360         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
14361         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
14362     PyObject* next_item;
14363 #if !CYTHON_COMPILING_IN_PYPY
14364     if (source_is_dict) {
14365         PyObject *key, *value;
14366         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
14367             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
14368             return -1;
14369         }
14370         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
14371             return 0;
14372         }
14373         if (pitem) {
14374             PyObject* tuple = PyTuple_New(2);
14375             if (unlikely(!tuple)) {
14376                 return -1;
14377             }
14378             Py_INCREF(key);
14379             Py_INCREF(value);
14380             PyTuple_SET_ITEM(tuple, 0, key);
14381             PyTuple_SET_ITEM(tuple, 1, value);
14382             *pitem = tuple;
14383         } else {
14384             if (pkey) {
14385                 Py_INCREF(key);
14386                 *pkey = key;
14387             }
14388             if (pvalue) {
14389                 Py_INCREF(value);
14390                 *pvalue = value;
14391             }
14392         }
14393         return 1;
14394     } else if (PyTuple_CheckExact(iter_obj)) {
14395         Py_ssize_t pos = *ppos;
14396         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
14397         *ppos = pos + 1;
14398         next_item = PyTuple_GET_ITEM(iter_obj, pos);
14399         Py_INCREF(next_item);
14400     } else if (PyList_CheckExact(iter_obj)) {
14401         Py_ssize_t pos = *ppos;
14402         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
14403         *ppos = pos + 1;
14404         next_item = PyList_GET_ITEM(iter_obj, pos);
14405         Py_INCREF(next_item);
14406     } else
14407 #endif
14408     {
14409         next_item = PyIter_Next(iter_obj);
14410         if (unlikely(!next_item)) {
14411             return __Pyx_IterFinish();
14412         }
14413     }
14414     if (pitem) {
14415         *pitem = next_item;
14416     } else if (pkey && pvalue) {
14417         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
14418             return -1;
14419     } else if (pkey) {
14420         *pkey = next_item;
14421     } else {
14422         *pvalue = next_item;
14423     }
14424     return 1;
14425 }
14426 
14427 /* PyErrExceptionMatches */
14428 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)14429 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14430     Py_ssize_t i, n;
14431     n = PyTuple_GET_SIZE(tuple);
14432 #if PY_MAJOR_VERSION >= 3
14433     for (i=0; i<n; i++) {
14434         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14435     }
14436 #endif
14437     for (i=0; i<n; i++) {
14438         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
14439     }
14440     return 0;
14441 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)14442 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
14443     PyObject *exc_type = tstate->curexc_type;
14444     if (exc_type == err) return 1;
14445     if (unlikely(!exc_type)) return 0;
14446     if (unlikely(PyTuple_Check(err)))
14447         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
14448     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
14449 }
14450 #endif
14451 
14452 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)14453 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
14454 #if CYTHON_USE_TYPE_SLOTS
14455 #if PY_MAJOR_VERSION >= 3
14456     if (likely(PyUnicode_Check(n)))
14457 #else
14458     if (likely(PyString_Check(n)))
14459 #endif
14460         return __Pyx_PyObject_GetAttrStr(o, n);
14461 #endif
14462     return PyObject_GetAttr(o, n);
14463 }
14464 
14465 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)14466 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
14467     __Pyx_PyThreadState_declare
14468     __Pyx_PyThreadState_assign
14469     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
14470         return NULL;
14471     __Pyx_PyErr_Clear();
14472     Py_INCREF(d);
14473     return d;
14474 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)14475 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
14476     PyObject *r = __Pyx_GetAttr(o, n);
14477     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
14478 }
14479 
14480 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)14481 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
14482         Py_ssize_t cstart, Py_ssize_t cstop,
14483         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
14484         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
14485 #if CYTHON_USE_TYPE_SLOTS
14486     PyMappingMethods* mp;
14487 #if PY_MAJOR_VERSION < 3
14488     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
14489     if (likely(ms && ms->sq_slice)) {
14490         if (!has_cstart) {
14491             if (_py_start && (*_py_start != Py_None)) {
14492                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
14493                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
14494             } else
14495                 cstart = 0;
14496         }
14497         if (!has_cstop) {
14498             if (_py_stop && (*_py_stop != Py_None)) {
14499                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
14500                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
14501             } else
14502                 cstop = PY_SSIZE_T_MAX;
14503         }
14504         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
14505             Py_ssize_t l = ms->sq_length(obj);
14506             if (likely(l >= 0)) {
14507                 if (cstop < 0) {
14508                     cstop += l;
14509                     if (cstop < 0) cstop = 0;
14510                 }
14511                 if (cstart < 0) {
14512                     cstart += l;
14513                     if (cstart < 0) cstart = 0;
14514                 }
14515             } else {
14516                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
14517                     goto bad;
14518                 PyErr_Clear();
14519             }
14520         }
14521         return ms->sq_slice(obj, cstart, cstop);
14522     }
14523 #endif
14524     mp = Py_TYPE(obj)->tp_as_mapping;
14525     if (likely(mp && mp->mp_subscript))
14526 #endif
14527     {
14528         PyObject* result;
14529         PyObject *py_slice, *py_start, *py_stop;
14530         if (_py_slice) {
14531             py_slice = *_py_slice;
14532         } else {
14533             PyObject* owned_start = NULL;
14534             PyObject* owned_stop = NULL;
14535             if (_py_start) {
14536                 py_start = *_py_start;
14537             } else {
14538                 if (has_cstart) {
14539                     owned_start = py_start = PyInt_FromSsize_t(cstart);
14540                     if (unlikely(!py_start)) goto bad;
14541                 } else
14542                     py_start = Py_None;
14543             }
14544             if (_py_stop) {
14545                 py_stop = *_py_stop;
14546             } else {
14547                 if (has_cstop) {
14548                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
14549                     if (unlikely(!py_stop)) {
14550                         Py_XDECREF(owned_start);
14551                         goto bad;
14552                     }
14553                 } else
14554                     py_stop = Py_None;
14555             }
14556             py_slice = PySlice_New(py_start, py_stop, Py_None);
14557             Py_XDECREF(owned_start);
14558             Py_XDECREF(owned_stop);
14559             if (unlikely(!py_slice)) goto bad;
14560         }
14561 #if CYTHON_USE_TYPE_SLOTS
14562         result = mp->mp_subscript(obj, py_slice);
14563 #else
14564         result = PyObject_GetItem(obj, py_slice);
14565 #endif
14566         if (!_py_slice) {
14567             Py_DECREF(py_slice);
14568         }
14569         return result;
14570     }
14571     PyErr_Format(PyExc_TypeError,
14572         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
14573 bad:
14574     return NULL;
14575 }
14576 
14577 /* GetTopmostException */
14578 #if CYTHON_USE_EXC_INFO_STACK
14579 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)14580 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
14581 {
14582     _PyErr_StackItem *exc_info = tstate->exc_info;
14583     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
14584            exc_info->previous_item != NULL)
14585     {
14586         exc_info = exc_info->previous_item;
14587     }
14588     return exc_info;
14589 }
14590 #endif
14591 
14592 /* SaveResetException */
14593 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14594 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14595     #if CYTHON_USE_EXC_INFO_STACK
14596     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
14597     *type = exc_info->exc_type;
14598     *value = exc_info->exc_value;
14599     *tb = exc_info->exc_traceback;
14600     #else
14601     *type = tstate->exc_type;
14602     *value = tstate->exc_value;
14603     *tb = tstate->exc_traceback;
14604     #endif
14605     Py_XINCREF(*type);
14606     Py_XINCREF(*value);
14607     Py_XINCREF(*tb);
14608 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)14609 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14610     PyObject *tmp_type, *tmp_value, *tmp_tb;
14611     #if CYTHON_USE_EXC_INFO_STACK
14612     _PyErr_StackItem *exc_info = tstate->exc_info;
14613     tmp_type = exc_info->exc_type;
14614     tmp_value = exc_info->exc_value;
14615     tmp_tb = exc_info->exc_traceback;
14616     exc_info->exc_type = type;
14617     exc_info->exc_value = value;
14618     exc_info->exc_traceback = tb;
14619     #else
14620     tmp_type = tstate->exc_type;
14621     tmp_value = tstate->exc_value;
14622     tmp_tb = tstate->exc_traceback;
14623     tstate->exc_type = type;
14624     tstate->exc_value = value;
14625     tstate->exc_traceback = tb;
14626     #endif
14627     Py_XDECREF(tmp_type);
14628     Py_XDECREF(tmp_value);
14629     Py_XDECREF(tmp_tb);
14630 }
14631 #endif
14632 
14633 /* FastTypeChecks */
14634 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)14635 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
14636     while (a) {
14637         a = a->tp_base;
14638         if (a == b)
14639             return 1;
14640     }
14641     return b == &PyBaseObject_Type;
14642 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)14643 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
14644     PyObject *mro;
14645     if (a == b) return 1;
14646     mro = a->tp_mro;
14647     if (likely(mro)) {
14648         Py_ssize_t i, n;
14649         n = PyTuple_GET_SIZE(mro);
14650         for (i = 0; i < n; i++) {
14651             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
14652                 return 1;
14653         }
14654         return 0;
14655     }
14656     return __Pyx_InBases(a, b);
14657 }
14658 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14659 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
14660     PyObject *exception, *value, *tb;
14661     int res;
14662     __Pyx_PyThreadState_declare
14663     __Pyx_PyThreadState_assign
14664     __Pyx_ErrFetch(&exception, &value, &tb);
14665     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
14666     if (unlikely(res == -1)) {
14667         PyErr_WriteUnraisable(err);
14668         res = 0;
14669     }
14670     if (!res) {
14671         res = PyObject_IsSubclass(err, exc_type2);
14672         if (unlikely(res == -1)) {
14673             PyErr_WriteUnraisable(err);
14674             res = 0;
14675         }
14676     }
14677     __Pyx_ErrRestore(exception, value, tb);
14678     return res;
14679 }
14680 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14681 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
14682     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
14683     if (!res) {
14684         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14685     }
14686     return res;
14687 }
14688 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)14689 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14690     Py_ssize_t i, n;
14691     assert(PyExceptionClass_Check(exc_type));
14692     n = PyTuple_GET_SIZE(tuple);
14693 #if PY_MAJOR_VERSION >= 3
14694     for (i=0; i<n; i++) {
14695         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14696     }
14697 #endif
14698     for (i=0; i<n; i++) {
14699         PyObject *t = PyTuple_GET_ITEM(tuple, i);
14700         #if PY_MAJOR_VERSION < 3
14701         if (likely(exc_type == t)) return 1;
14702         #endif
14703         if (likely(PyExceptionClass_Check(t))) {
14704             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14705         } else {
14706         }
14707     }
14708     return 0;
14709 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)14710 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14711     if (likely(err == exc_type)) return 1;
14712     if (likely(PyExceptionClass_Check(err))) {
14713         if (likely(PyExceptionClass_Check(exc_type))) {
14714             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14715         } else if (likely(PyTuple_Check(exc_type))) {
14716             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14717         } else {
14718         }
14719     }
14720     return PyErr_GivenExceptionMatches(err, exc_type);
14721 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14722 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14723     assert(PyExceptionClass_Check(exc_type1));
14724     assert(PyExceptionClass_Check(exc_type2));
14725     if (likely(err == exc_type1 || err == exc_type2)) return 1;
14726     if (likely(PyExceptionClass_Check(err))) {
14727         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14728     }
14729     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14730 }
14731 #endif
14732 
14733 /* GetException */
14734 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14735 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
14736 #else
14737 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
14738 #endif
14739 {
14740     PyObject *local_type, *local_value, *local_tb;
14741 #if CYTHON_FAST_THREAD_STATE
14742     PyObject *tmp_type, *tmp_value, *tmp_tb;
14743     local_type = tstate->curexc_type;
14744     local_value = tstate->curexc_value;
14745     local_tb = tstate->curexc_traceback;
14746     tstate->curexc_type = 0;
14747     tstate->curexc_value = 0;
14748     tstate->curexc_traceback = 0;
14749 #else
14750     PyErr_Fetch(&local_type, &local_value, &local_tb);
14751 #endif
14752     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14753 #if CYTHON_FAST_THREAD_STATE
14754     if (unlikely(tstate->curexc_type))
14755 #else
14756     if (unlikely(PyErr_Occurred()))
14757 #endif
14758         goto bad;
14759     #if PY_MAJOR_VERSION >= 3
14760     if (local_tb) {
14761         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14762             goto bad;
14763     }
14764     #endif
14765     Py_XINCREF(local_tb);
14766     Py_XINCREF(local_type);
14767     Py_XINCREF(local_value);
14768     *type = local_type;
14769     *value = local_value;
14770     *tb = local_tb;
14771 #if CYTHON_FAST_THREAD_STATE
14772     #if CYTHON_USE_EXC_INFO_STACK
14773     {
14774         _PyErr_StackItem *exc_info = tstate->exc_info;
14775         tmp_type = exc_info->exc_type;
14776         tmp_value = exc_info->exc_value;
14777         tmp_tb = exc_info->exc_traceback;
14778         exc_info->exc_type = local_type;
14779         exc_info->exc_value = local_value;
14780         exc_info->exc_traceback = local_tb;
14781     }
14782     #else
14783     tmp_type = tstate->exc_type;
14784     tmp_value = tstate->exc_value;
14785     tmp_tb = tstate->exc_traceback;
14786     tstate->exc_type = local_type;
14787     tstate->exc_value = local_value;
14788     tstate->exc_traceback = local_tb;
14789     #endif
14790     Py_XDECREF(tmp_type);
14791     Py_XDECREF(tmp_value);
14792     Py_XDECREF(tmp_tb);
14793 #else
14794     PyErr_SetExcInfo(local_type, local_value, local_tb);
14795 #endif
14796     return 0;
14797 bad:
14798     *type = 0;
14799     *value = 0;
14800     *tb = 0;
14801     Py_XDECREF(local_type);
14802     Py_XDECREF(local_value);
14803     Py_XDECREF(local_tb);
14804     return -1;
14805 }
14806 
14807 /* SwapException */
14808 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14809 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14810     PyObject *tmp_type, *tmp_value, *tmp_tb;
14811     #if CYTHON_USE_EXC_INFO_STACK
14812     _PyErr_StackItem *exc_info = tstate->exc_info;
14813     tmp_type = exc_info->exc_type;
14814     tmp_value = exc_info->exc_value;
14815     tmp_tb = exc_info->exc_traceback;
14816     exc_info->exc_type = *type;
14817     exc_info->exc_value = *value;
14818     exc_info->exc_traceback = *tb;
14819     #else
14820     tmp_type = tstate->exc_type;
14821     tmp_value = tstate->exc_value;
14822     tmp_tb = tstate->exc_traceback;
14823     tstate->exc_type = *type;
14824     tstate->exc_value = *value;
14825     tstate->exc_traceback = *tb;
14826     #endif
14827     *type = tmp_type;
14828     *value = tmp_value;
14829     *tb = tmp_tb;
14830 }
14831 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)14832 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
14833     PyObject *tmp_type, *tmp_value, *tmp_tb;
14834     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
14835     PyErr_SetExcInfo(*type, *value, *tb);
14836     *type = tmp_type;
14837     *value = tmp_value;
14838     *tb = tmp_tb;
14839 }
14840 #endif
14841 
14842 /* DictGetItem */
14843 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)14844 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
14845     PyObject *value;
14846     value = PyDict_GetItemWithError(d, key);
14847     if (unlikely(!value)) {
14848         if (!PyErr_Occurred()) {
14849             if (unlikely(PyTuple_Check(key))) {
14850                 PyObject* args = PyTuple_Pack(1, key);
14851                 if (likely(args)) {
14852                     PyErr_SetObject(PyExc_KeyError, args);
14853                     Py_DECREF(args);
14854                 }
14855             } else {
14856                 PyErr_SetObject(PyExc_KeyError, key);
14857             }
14858         }
14859         return NULL;
14860     }
14861     Py_INCREF(value);
14862     return value;
14863 }
14864 #endif
14865 
14866 /* PyIntCompare */
__Pyx_PyInt_EqObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)14867 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
14868     if (op1 == op2) {
14869         Py_RETURN_TRUE;
14870     }
14871     #if PY_MAJOR_VERSION < 3
14872     if (likely(PyInt_CheckExact(op1))) {
14873         const long b = intval;
14874         long a = PyInt_AS_LONG(op1);
14875         if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
14876     }
14877     #endif
14878     #if CYTHON_USE_PYLONG_INTERNALS
14879     if (likely(PyLong_CheckExact(op1))) {
14880         int unequal;
14881         unsigned long uintval;
14882         Py_ssize_t size = Py_SIZE(op1);
14883         const digit* digits = ((PyLongObject*)op1)->ob_digit;
14884         if (intval == 0) {
14885             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
14886         } else if (intval < 0) {
14887             if (size >= 0)
14888                 Py_RETURN_FALSE;
14889             intval = -intval;
14890             size = -size;
14891         } else {
14892             if (size <= 0)
14893                 Py_RETURN_FALSE;
14894         }
14895         uintval = (unsigned long) intval;
14896 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
14897         if (uintval >> (PyLong_SHIFT * 4)) {
14898             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
14899                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
14900         } else
14901 #endif
14902 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
14903         if (uintval >> (PyLong_SHIFT * 3)) {
14904             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
14905                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
14906         } else
14907 #endif
14908 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
14909         if (uintval >> (PyLong_SHIFT * 2)) {
14910             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
14911                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
14912         } else
14913 #endif
14914 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
14915         if (uintval >> (PyLong_SHIFT * 1)) {
14916             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
14917                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
14918         } else
14919 #endif
14920             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
14921         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
14922     }
14923     #endif
14924     if (PyFloat_CheckExact(op1)) {
14925         const long b = intval;
14926         double a = PyFloat_AS_DOUBLE(op1);
14927         if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
14928     }
14929     return (
14930         PyObject_RichCompare(op1, op2, Py_EQ));
14931 }
14932 
14933 /* RaiseException */
14934 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)14935 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
14936                         CYTHON_UNUSED PyObject *cause) {
14937     __Pyx_PyThreadState_declare
14938     Py_XINCREF(type);
14939     if (!value || value == Py_None)
14940         value = NULL;
14941     else
14942         Py_INCREF(value);
14943     if (!tb || tb == Py_None)
14944         tb = NULL;
14945     else {
14946         Py_INCREF(tb);
14947         if (!PyTraceBack_Check(tb)) {
14948             PyErr_SetString(PyExc_TypeError,
14949                 "raise: arg 3 must be a traceback or None");
14950             goto raise_error;
14951         }
14952     }
14953     if (PyType_Check(type)) {
14954 #if CYTHON_COMPILING_IN_PYPY
14955         if (!value) {
14956             Py_INCREF(Py_None);
14957             value = Py_None;
14958         }
14959 #endif
14960         PyErr_NormalizeException(&type, &value, &tb);
14961     } else {
14962         if (value) {
14963             PyErr_SetString(PyExc_TypeError,
14964                 "instance exception may not have a separate value");
14965             goto raise_error;
14966         }
14967         value = type;
14968         type = (PyObject*) Py_TYPE(type);
14969         Py_INCREF(type);
14970         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
14971             PyErr_SetString(PyExc_TypeError,
14972                 "raise: exception class must be a subclass of BaseException");
14973             goto raise_error;
14974         }
14975     }
14976     __Pyx_PyThreadState_assign
14977     __Pyx_ErrRestore(type, value, tb);
14978     return;
14979 raise_error:
14980     Py_XDECREF(value);
14981     Py_XDECREF(type);
14982     Py_XDECREF(tb);
14983     return;
14984 }
14985 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)14986 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
14987     PyObject* owned_instance = NULL;
14988     if (tb == Py_None) {
14989         tb = 0;
14990     } else if (tb && !PyTraceBack_Check(tb)) {
14991         PyErr_SetString(PyExc_TypeError,
14992             "raise: arg 3 must be a traceback or None");
14993         goto bad;
14994     }
14995     if (value == Py_None)
14996         value = 0;
14997     if (PyExceptionInstance_Check(type)) {
14998         if (value) {
14999             PyErr_SetString(PyExc_TypeError,
15000                 "instance exception may not have a separate value");
15001             goto bad;
15002         }
15003         value = type;
15004         type = (PyObject*) Py_TYPE(value);
15005     } else if (PyExceptionClass_Check(type)) {
15006         PyObject *instance_class = NULL;
15007         if (value && PyExceptionInstance_Check(value)) {
15008             instance_class = (PyObject*) Py_TYPE(value);
15009             if (instance_class != type) {
15010                 int is_subclass = PyObject_IsSubclass(instance_class, type);
15011                 if (!is_subclass) {
15012                     instance_class = NULL;
15013                 } else if (unlikely(is_subclass == -1)) {
15014                     goto bad;
15015                 } else {
15016                     type = instance_class;
15017                 }
15018             }
15019         }
15020         if (!instance_class) {
15021             PyObject *args;
15022             if (!value)
15023                 args = PyTuple_New(0);
15024             else if (PyTuple_Check(value)) {
15025                 Py_INCREF(value);
15026                 args = value;
15027             } else
15028                 args = PyTuple_Pack(1, value);
15029             if (!args)
15030                 goto bad;
15031             owned_instance = PyObject_Call(type, args, NULL);
15032             Py_DECREF(args);
15033             if (!owned_instance)
15034                 goto bad;
15035             value = owned_instance;
15036             if (!PyExceptionInstance_Check(value)) {
15037                 PyErr_Format(PyExc_TypeError,
15038                              "calling %R should have returned an instance of "
15039                              "BaseException, not %R",
15040                              type, Py_TYPE(value));
15041                 goto bad;
15042             }
15043         }
15044     } else {
15045         PyErr_SetString(PyExc_TypeError,
15046             "raise: exception class must be a subclass of BaseException");
15047         goto bad;
15048     }
15049     if (cause) {
15050         PyObject *fixed_cause;
15051         if (cause == Py_None) {
15052             fixed_cause = NULL;
15053         } else if (PyExceptionClass_Check(cause)) {
15054             fixed_cause = PyObject_CallObject(cause, NULL);
15055             if (fixed_cause == NULL)
15056                 goto bad;
15057         } else if (PyExceptionInstance_Check(cause)) {
15058             fixed_cause = cause;
15059             Py_INCREF(fixed_cause);
15060         } else {
15061             PyErr_SetString(PyExc_TypeError,
15062                             "exception causes must derive from "
15063                             "BaseException");
15064             goto bad;
15065         }
15066         PyException_SetCause(value, fixed_cause);
15067     }
15068     PyErr_SetObject(type, value);
15069     if (tb) {
15070 #if CYTHON_COMPILING_IN_PYPY
15071         PyObject *tmp_type, *tmp_value, *tmp_tb;
15072         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
15073         Py_INCREF(tb);
15074         PyErr_Restore(tmp_type, tmp_value, tb);
15075         Py_XDECREF(tmp_tb);
15076 #else
15077         PyThreadState *tstate = __Pyx_PyThreadState_Current;
15078         PyObject* tmp_tb = tstate->curexc_traceback;
15079         if (tb != tmp_tb) {
15080             Py_INCREF(tb);
15081             tstate->curexc_traceback = tb;
15082             Py_XDECREF(tmp_tb);
15083         }
15084 #endif
15085     }
15086 bad:
15087     Py_XDECREF(owned_instance);
15088     return;
15089 }
15090 #endif
15091 
15092 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)15093 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
15094     PyObject *empty_list = 0;
15095     PyObject *module = 0;
15096     PyObject *global_dict = 0;
15097     PyObject *empty_dict = 0;
15098     PyObject *list;
15099     #if PY_MAJOR_VERSION < 3
15100     PyObject *py_import;
15101     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
15102     if (!py_import)
15103         goto bad;
15104     #endif
15105     if (from_list)
15106         list = from_list;
15107     else {
15108         empty_list = PyList_New(0);
15109         if (!empty_list)
15110             goto bad;
15111         list = empty_list;
15112     }
15113     global_dict = PyModule_GetDict(__pyx_m);
15114     if (!global_dict)
15115         goto bad;
15116     empty_dict = PyDict_New();
15117     if (!empty_dict)
15118         goto bad;
15119     {
15120         #if PY_MAJOR_VERSION >= 3
15121         if (level == -1) {
15122             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
15123                 module = PyImport_ImportModuleLevelObject(
15124                     name, global_dict, empty_dict, list, 1);
15125                 if (!module) {
15126                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
15127                         goto bad;
15128                     PyErr_Clear();
15129                 }
15130             }
15131             level = 0;
15132         }
15133         #endif
15134         if (!module) {
15135             #if PY_MAJOR_VERSION < 3
15136             PyObject *py_level = PyInt_FromLong(level);
15137             if (!py_level)
15138                 goto bad;
15139             module = PyObject_CallFunctionObjArgs(py_import,
15140                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
15141             Py_DECREF(py_level);
15142             #else
15143             module = PyImport_ImportModuleLevelObject(
15144                 name, global_dict, empty_dict, list, level);
15145             #endif
15146         }
15147     }
15148 bad:
15149     #if PY_MAJOR_VERSION < 3
15150     Py_XDECREF(py_import);
15151     #endif
15152     Py_XDECREF(empty_list);
15153     Py_XDECREF(empty_dict);
15154     return module;
15155 }
15156 
15157 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)15158 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
15159     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
15160     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
15161         PyErr_Format(PyExc_ImportError,
15162         #if PY_MAJOR_VERSION < 3
15163             "cannot import name %.230s", PyString_AS_STRING(name));
15164         #else
15165             "cannot import name %S", name);
15166         #endif
15167     }
15168     return value;
15169 }
15170 
15171 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)15172 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
15173     PyObject *r;
15174     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
15175         PyErr_SetString(PyExc_TypeError,
15176                         "hasattr(): attribute name must be string");
15177         return -1;
15178     }
15179     r = __Pyx_GetAttr(o, n);
15180     if (unlikely(!r)) {
15181         PyErr_Clear();
15182         return 0;
15183     } else {
15184         Py_DECREF(r);
15185         return 1;
15186     }
15187 }
15188 
15189 /* PyObject_GenericGetAttrNoDict */
15190 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)15191 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
15192     PyErr_Format(PyExc_AttributeError,
15193 #if PY_MAJOR_VERSION >= 3
15194                  "'%.50s' object has no attribute '%U'",
15195                  tp->tp_name, attr_name);
15196 #else
15197                  "'%.50s' object has no attribute '%.400s'",
15198                  tp->tp_name, PyString_AS_STRING(attr_name));
15199 #endif
15200     return NULL;
15201 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)15202 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
15203     PyObject *descr;
15204     PyTypeObject *tp = Py_TYPE(obj);
15205     if (unlikely(!PyString_Check(attr_name))) {
15206         return PyObject_GenericGetAttr(obj, attr_name);
15207     }
15208     assert(!tp->tp_dictoffset);
15209     descr = _PyType_Lookup(tp, attr_name);
15210     if (unlikely(!descr)) {
15211         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
15212     }
15213     Py_INCREF(descr);
15214     #if PY_MAJOR_VERSION < 3
15215     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
15216     #endif
15217     {
15218         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
15219         if (unlikely(f)) {
15220             PyObject *res = f(descr, obj, (PyObject *)tp);
15221             Py_DECREF(descr);
15222             return res;
15223         }
15224     }
15225     return descr;
15226 }
15227 #endif
15228 
15229 /* PyObject_GenericGetAttr */
15230 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)15231 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
15232     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
15233         return PyObject_GenericGetAttr(obj, attr_name);
15234     }
15235     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
15236 }
15237 #endif
15238 
15239 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)15240 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
15241     __Pyx_PyThreadState_declare
15242     __Pyx_PyThreadState_assign
15243     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
15244         __Pyx_PyErr_Clear();
15245 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)15246 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
15247     PyObject *result;
15248 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
15249     PyTypeObject* tp = Py_TYPE(obj);
15250     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
15251         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
15252     }
15253 #endif
15254     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
15255     if (unlikely(!result)) {
15256         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
15257     }
15258     return result;
15259 }
15260 
15261 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)15262 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
15263   int ret;
15264   PyObject *name_attr;
15265   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
15266   if (likely(name_attr)) {
15267       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
15268   } else {
15269       ret = -1;
15270   }
15271   if (unlikely(ret < 0)) {
15272       PyErr_Clear();
15273       ret = 0;
15274   }
15275   Py_XDECREF(name_attr);
15276   return ret;
15277 }
__Pyx_setup_reduce(PyObject * type_obj)15278 static int __Pyx_setup_reduce(PyObject* type_obj) {
15279     int ret = 0;
15280     PyObject *object_reduce = NULL;
15281     PyObject *object_reduce_ex = NULL;
15282     PyObject *reduce = NULL;
15283     PyObject *reduce_ex = NULL;
15284     PyObject *reduce_cython = NULL;
15285     PyObject *setstate = NULL;
15286     PyObject *setstate_cython = NULL;
15287 #if CYTHON_USE_PYTYPE_LOOKUP
15288     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
15289 #else
15290     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
15291 #endif
15292 #if CYTHON_USE_PYTYPE_LOOKUP
15293     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
15294 #else
15295     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
15296 #endif
15297     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
15298     if (reduce_ex == object_reduce_ex) {
15299 #if CYTHON_USE_PYTYPE_LOOKUP
15300         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
15301 #else
15302         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
15303 #endif
15304         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
15305         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
15306             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
15307             if (likely(reduce_cython)) {
15308                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
15309                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
15310             } else if (reduce == object_reduce || PyErr_Occurred()) {
15311                 goto __PYX_BAD;
15312             }
15313             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
15314             if (!setstate) PyErr_Clear();
15315             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
15316                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
15317                 if (likely(setstate_cython)) {
15318                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
15319                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
15320                 } else if (!setstate || PyErr_Occurred()) {
15321                     goto __PYX_BAD;
15322                 }
15323             }
15324             PyType_Modified((PyTypeObject*)type_obj);
15325         }
15326     }
15327     goto __PYX_GOOD;
15328 __PYX_BAD:
15329     if (!PyErr_Occurred())
15330         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
15331     ret = -1;
15332 __PYX_GOOD:
15333 #if !CYTHON_USE_PYTYPE_LOOKUP
15334     Py_XDECREF(object_reduce);
15335     Py_XDECREF(object_reduce_ex);
15336 #endif
15337     Py_XDECREF(reduce);
15338     Py_XDECREF(reduce_ex);
15339     Py_XDECREF(reduce_cython);
15340     Py_XDECREF(setstate);
15341     Py_XDECREF(setstate_cython);
15342     return ret;
15343 }
15344 
15345 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)15346 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
15347     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
15348     for (i=0; i < nbases; i++) {
15349         PyTypeObject *tmptype;
15350         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
15351         tmptype = Py_TYPE(tmp);
15352 #if PY_MAJOR_VERSION < 3
15353         if (tmptype == &PyClass_Type)
15354             continue;
15355 #endif
15356         if (!metaclass) {
15357             metaclass = tmptype;
15358             continue;
15359         }
15360         if (PyType_IsSubtype(metaclass, tmptype))
15361             continue;
15362         if (PyType_IsSubtype(tmptype, metaclass)) {
15363             metaclass = tmptype;
15364             continue;
15365         }
15366         PyErr_SetString(PyExc_TypeError,
15367                         "metaclass conflict: "
15368                         "the metaclass of a derived class "
15369                         "must be a (non-strict) subclass "
15370                         "of the metaclasses of all its bases");
15371         return NULL;
15372     }
15373     if (!metaclass) {
15374 #if PY_MAJOR_VERSION < 3
15375         metaclass = &PyClass_Type;
15376 #else
15377         metaclass = &PyType_Type;
15378 #endif
15379     }
15380     Py_INCREF((PyObject*) metaclass);
15381     return (PyObject*) metaclass;
15382 }
15383 
15384 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)15385 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
15386     PyObject* fake_module;
15387     PyTypeObject* cached_type = NULL;
15388     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
15389     if (!fake_module) return NULL;
15390     Py_INCREF(fake_module);
15391     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
15392     if (cached_type) {
15393         if (!PyType_Check((PyObject*)cached_type)) {
15394             PyErr_Format(PyExc_TypeError,
15395                 "Shared Cython type %.200s is not a type object",
15396                 type->tp_name);
15397             goto bad;
15398         }
15399         if (cached_type->tp_basicsize != type->tp_basicsize) {
15400             PyErr_Format(PyExc_TypeError,
15401                 "Shared Cython type %.200s has the wrong size, try recompiling",
15402                 type->tp_name);
15403             goto bad;
15404         }
15405     } else {
15406         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
15407         PyErr_Clear();
15408         if (PyType_Ready(type) < 0) goto bad;
15409         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
15410             goto bad;
15411         Py_INCREF(type);
15412         cached_type = type;
15413     }
15414 done:
15415     Py_DECREF(fake_module);
15416     return cached_type;
15417 bad:
15418     Py_XDECREF(cached_type);
15419     cached_type = NULL;
15420     goto done;
15421 }
15422 
15423 /* CythonFunctionShared */
15424 #include <structmember.h>
15425 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)15426 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
15427 {
15428     if (unlikely(op->func_doc == NULL)) {
15429         if (op->func.m_ml->ml_doc) {
15430 #if PY_MAJOR_VERSION >= 3
15431             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
15432 #else
15433             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
15434 #endif
15435             if (unlikely(op->func_doc == NULL))
15436                 return NULL;
15437         } else {
15438             Py_INCREF(Py_None);
15439             return Py_None;
15440         }
15441     }
15442     Py_INCREF(op->func_doc);
15443     return op->func_doc;
15444 }
15445 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15446 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15447 {
15448     PyObject *tmp = op->func_doc;
15449     if (value == NULL) {
15450         value = Py_None;
15451     }
15452     Py_INCREF(value);
15453     op->func_doc = value;
15454     Py_XDECREF(tmp);
15455     return 0;
15456 }
15457 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15458 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15459 {
15460     if (unlikely(op->func_name == NULL)) {
15461 #if PY_MAJOR_VERSION >= 3
15462         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
15463 #else
15464         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
15465 #endif
15466         if (unlikely(op->func_name == NULL))
15467             return NULL;
15468     }
15469     Py_INCREF(op->func_name);
15470     return op->func_name;
15471 }
15472 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15473 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15474 {
15475     PyObject *tmp;
15476 #if PY_MAJOR_VERSION >= 3
15477     if (unlikely(value == NULL || !PyUnicode_Check(value)))
15478 #else
15479     if (unlikely(value == NULL || !PyString_Check(value)))
15480 #endif
15481     {
15482         PyErr_SetString(PyExc_TypeError,
15483                         "__name__ must be set to a string object");
15484         return -1;
15485     }
15486     tmp = op->func_name;
15487     Py_INCREF(value);
15488     op->func_name = value;
15489     Py_XDECREF(tmp);
15490     return 0;
15491 }
15492 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15493 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15494 {
15495     Py_INCREF(op->func_qualname);
15496     return op->func_qualname;
15497 }
15498 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15499 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15500 {
15501     PyObject *tmp;
15502 #if PY_MAJOR_VERSION >= 3
15503     if (unlikely(value == NULL || !PyUnicode_Check(value)))
15504 #else
15505     if (unlikely(value == NULL || !PyString_Check(value)))
15506 #endif
15507     {
15508         PyErr_SetString(PyExc_TypeError,
15509                         "__qualname__ must be set to a string object");
15510         return -1;
15511     }
15512     tmp = op->func_qualname;
15513     Py_INCREF(value);
15514     op->func_qualname = value;
15515     Py_XDECREF(tmp);
15516     return 0;
15517 }
15518 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)15519 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
15520 {
15521     PyObject *self;
15522     self = m->func_closure;
15523     if (self == NULL)
15524         self = Py_None;
15525     Py_INCREF(self);
15526     return self;
15527 }
15528 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15529 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15530 {
15531     if (unlikely(op->func_dict == NULL)) {
15532         op->func_dict = PyDict_New();
15533         if (unlikely(op->func_dict == NULL))
15534             return NULL;
15535     }
15536     Py_INCREF(op->func_dict);
15537     return op->func_dict;
15538 }
15539 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15540 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15541 {
15542     PyObject *tmp;
15543     if (unlikely(value == NULL)) {
15544         PyErr_SetString(PyExc_TypeError,
15545                "function's dictionary may not be deleted");
15546         return -1;
15547     }
15548     if (unlikely(!PyDict_Check(value))) {
15549         PyErr_SetString(PyExc_TypeError,
15550                "setting function's dictionary to a non-dict");
15551         return -1;
15552     }
15553     tmp = op->func_dict;
15554     Py_INCREF(value);
15555     op->func_dict = value;
15556     Py_XDECREF(tmp);
15557     return 0;
15558 }
15559 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15560 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15561 {
15562     Py_INCREF(op->func_globals);
15563     return op->func_globals;
15564 }
15565 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15566 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15567 {
15568     Py_INCREF(Py_None);
15569     return Py_None;
15570 }
15571 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15572 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15573 {
15574     PyObject* result = (op->func_code) ? op->func_code : Py_None;
15575     Py_INCREF(result);
15576     return result;
15577 }
15578 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)15579 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
15580     int result = 0;
15581     PyObject *res = op->defaults_getter((PyObject *) op);
15582     if (unlikely(!res))
15583         return -1;
15584     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15585     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
15586     Py_INCREF(op->defaults_tuple);
15587     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
15588     Py_INCREF(op->defaults_kwdict);
15589     #else
15590     op->defaults_tuple = PySequence_ITEM(res, 0);
15591     if (unlikely(!op->defaults_tuple)) result = -1;
15592     else {
15593         op->defaults_kwdict = PySequence_ITEM(res, 1);
15594         if (unlikely(!op->defaults_kwdict)) result = -1;
15595     }
15596     #endif
15597     Py_DECREF(res);
15598     return result;
15599 }
15600 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15601 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15602     PyObject* tmp;
15603     if (!value) {
15604         value = Py_None;
15605     } else if (value != Py_None && !PyTuple_Check(value)) {
15606         PyErr_SetString(PyExc_TypeError,
15607                         "__defaults__ must be set to a tuple object");
15608         return -1;
15609     }
15610     Py_INCREF(value);
15611     tmp = op->defaults_tuple;
15612     op->defaults_tuple = value;
15613     Py_XDECREF(tmp);
15614     return 0;
15615 }
15616 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15617 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15618     PyObject* result = op->defaults_tuple;
15619     if (unlikely(!result)) {
15620         if (op->defaults_getter) {
15621             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
15622             result = op->defaults_tuple;
15623         } else {
15624             result = Py_None;
15625         }
15626     }
15627     Py_INCREF(result);
15628     return result;
15629 }
15630 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15631 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15632     PyObject* tmp;
15633     if (!value) {
15634         value = Py_None;
15635     } else if (value != Py_None && !PyDict_Check(value)) {
15636         PyErr_SetString(PyExc_TypeError,
15637                         "__kwdefaults__ must be set to a dict object");
15638         return -1;
15639     }
15640     Py_INCREF(value);
15641     tmp = op->defaults_kwdict;
15642     op->defaults_kwdict = value;
15643     Py_XDECREF(tmp);
15644     return 0;
15645 }
15646 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15647 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15648     PyObject* result = op->defaults_kwdict;
15649     if (unlikely(!result)) {
15650         if (op->defaults_getter) {
15651             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
15652             result = op->defaults_kwdict;
15653         } else {
15654             result = Py_None;
15655         }
15656     }
15657     Py_INCREF(result);
15658     return result;
15659 }
15660 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)15661 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15662     PyObject* tmp;
15663     if (!value || value == Py_None) {
15664         value = NULL;
15665     } else if (!PyDict_Check(value)) {
15666         PyErr_SetString(PyExc_TypeError,
15667                         "__annotations__ must be set to a dict object");
15668         return -1;
15669     }
15670     Py_XINCREF(value);
15671     tmp = op->func_annotations;
15672     op->func_annotations = value;
15673     Py_XDECREF(tmp);
15674     return 0;
15675 }
15676 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)15677 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15678     PyObject* result = op->func_annotations;
15679     if (unlikely(!result)) {
15680         result = PyDict_New();
15681         if (unlikely(!result)) return NULL;
15682         op->func_annotations = result;
15683     }
15684     Py_INCREF(result);
15685     return result;
15686 }
15687 static PyGetSetDef __pyx_CyFunction_getsets[] = {
15688     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15689     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15690     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15691     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15692     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
15693     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
15694     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15695     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15696     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15697     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15698     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15699     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15700     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15701     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15702     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15703     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15704     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
15705     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
15706     {0, 0, 0, 0, 0}
15707 };
15708 static PyMemberDef __pyx_CyFunction_members[] = {
15709     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
15710     {0, 0, 0,  0, 0}
15711 };
15712 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)15713 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
15714 {
15715 #if PY_MAJOR_VERSION >= 3
15716     return PyUnicode_FromString(m->func.m_ml->ml_name);
15717 #else
15718     return PyString_FromString(m->func.m_ml->ml_name);
15719 #endif
15720 }
15721 static PyMethodDef __pyx_CyFunction_methods[] = {
15722     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
15723     {0, 0, 0, 0}
15724 };
15725 #if PY_VERSION_HEX < 0x030500A0
15726 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
15727 #else
15728 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
15729 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)15730 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
15731                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
15732     if (unlikely(op == NULL))
15733         return NULL;
15734     op->flags = flags;
15735     __Pyx_CyFunction_weakreflist(op) = NULL;
15736     op->func.m_ml = ml;
15737     op->func.m_self = (PyObject *) op;
15738     Py_XINCREF(closure);
15739     op->func_closure = closure;
15740     Py_XINCREF(module);
15741     op->func.m_module = module;
15742     op->func_dict = NULL;
15743     op->func_name = NULL;
15744     Py_INCREF(qualname);
15745     op->func_qualname = qualname;
15746     op->func_doc = NULL;
15747     op->func_classobj = NULL;
15748     op->func_globals = globals;
15749     Py_INCREF(op->func_globals);
15750     Py_XINCREF(code);
15751     op->func_code = code;
15752     op->defaults_pyobjects = 0;
15753     op->defaults_size = 0;
15754     op->defaults = NULL;
15755     op->defaults_tuple = NULL;
15756     op->defaults_kwdict = NULL;
15757     op->defaults_getter = NULL;
15758     op->func_annotations = NULL;
15759     return (PyObject *) op;
15760 }
15761 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)15762 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
15763 {
15764     Py_CLEAR(m->func_closure);
15765     Py_CLEAR(m->func.m_module);
15766     Py_CLEAR(m->func_dict);
15767     Py_CLEAR(m->func_name);
15768     Py_CLEAR(m->func_qualname);
15769     Py_CLEAR(m->func_doc);
15770     Py_CLEAR(m->func_globals);
15771     Py_CLEAR(m->func_code);
15772     Py_CLEAR(m->func_classobj);
15773     Py_CLEAR(m->defaults_tuple);
15774     Py_CLEAR(m->defaults_kwdict);
15775     Py_CLEAR(m->func_annotations);
15776     if (m->defaults) {
15777         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15778         int i;
15779         for (i = 0; i < m->defaults_pyobjects; i++)
15780             Py_XDECREF(pydefaults[i]);
15781         PyObject_Free(m->defaults);
15782         m->defaults = NULL;
15783     }
15784     return 0;
15785 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)15786 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
15787 {
15788     if (__Pyx_CyFunction_weakreflist(m) != NULL)
15789         PyObject_ClearWeakRefs((PyObject *) m);
15790     __Pyx_CyFunction_clear(m);
15791     PyObject_GC_Del(m);
15792 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)15793 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
15794 {
15795     PyObject_GC_UnTrack(m);
15796     __Pyx__CyFunction_dealloc(m);
15797 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)15798 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
15799 {
15800     Py_VISIT(m->func_closure);
15801     Py_VISIT(m->func.m_module);
15802     Py_VISIT(m->func_dict);
15803     Py_VISIT(m->func_name);
15804     Py_VISIT(m->func_qualname);
15805     Py_VISIT(m->func_doc);
15806     Py_VISIT(m->func_globals);
15807     Py_VISIT(m->func_code);
15808     Py_VISIT(m->func_classobj);
15809     Py_VISIT(m->defaults_tuple);
15810     Py_VISIT(m->defaults_kwdict);
15811     if (m->defaults) {
15812         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15813         int i;
15814         for (i = 0; i < m->defaults_pyobjects; i++)
15815             Py_VISIT(pydefaults[i]);
15816     }
15817     return 0;
15818 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)15819 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
15820 {
15821 #if PY_MAJOR_VERSION < 3
15822     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15823     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
15824         Py_INCREF(func);
15825         return func;
15826     }
15827     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
15828         if (type == NULL)
15829             type = (PyObject *)(Py_TYPE(obj));
15830         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
15831     }
15832     if (obj == Py_None)
15833         obj = NULL;
15834 #endif
15835     return __Pyx_PyMethod_New(func, obj, type);
15836 }
15837 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)15838 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
15839 {
15840 #if PY_MAJOR_VERSION >= 3
15841     return PyUnicode_FromFormat("<cyfunction %U at %p>",
15842                                 op->func_qualname, (void *)op);
15843 #else
15844     return PyString_FromFormat("<cyfunction %s at %p>",
15845                                PyString_AsString(op->func_qualname), (void *)op);
15846 #endif
15847 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)15848 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
15849     PyCFunctionObject* f = (PyCFunctionObject*)func;
15850     PyCFunction meth = f->m_ml->ml_meth;
15851     Py_ssize_t size;
15852     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
15853     case METH_VARARGS:
15854         if (likely(kw == NULL || PyDict_Size(kw) == 0))
15855             return (*meth)(self, arg);
15856         break;
15857     case METH_VARARGS | METH_KEYWORDS:
15858         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
15859     case METH_NOARGS:
15860         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15861             size = PyTuple_GET_SIZE(arg);
15862             if (likely(size == 0))
15863                 return (*meth)(self, NULL);
15864             PyErr_Format(PyExc_TypeError,
15865                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
15866                 f->m_ml->ml_name, size);
15867             return NULL;
15868         }
15869         break;
15870     case METH_O:
15871         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15872             size = PyTuple_GET_SIZE(arg);
15873             if (likely(size == 1)) {
15874                 PyObject *result, *arg0;
15875                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15876                 arg0 = PyTuple_GET_ITEM(arg, 0);
15877                 #else
15878                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
15879                 #endif
15880                 result = (*meth)(self, arg0);
15881                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
15882                 Py_DECREF(arg0);
15883                 #endif
15884                 return result;
15885             }
15886             PyErr_Format(PyExc_TypeError,
15887                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
15888                 f->m_ml->ml_name, size);
15889             return NULL;
15890         }
15891         break;
15892     default:
15893         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
15894                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
15895                         "longer supported!");
15896         return NULL;
15897     }
15898     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
15899                  f->m_ml->ml_name);
15900     return NULL;
15901 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)15902 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
15903     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
15904 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)15905 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
15906     PyObject *result;
15907     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
15908     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
15909         Py_ssize_t argc;
15910         PyObject *new_args;
15911         PyObject *self;
15912         argc = PyTuple_GET_SIZE(args);
15913         new_args = PyTuple_GetSlice(args, 1, argc);
15914         if (unlikely(!new_args))
15915             return NULL;
15916         self = PyTuple_GetItem(args, 0);
15917         if (unlikely(!self)) {
15918             Py_DECREF(new_args);
15919             return NULL;
15920         }
15921         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
15922         Py_DECREF(new_args);
15923     } else {
15924         result = __Pyx_CyFunction_Call(func, args, kw);
15925     }
15926     return result;
15927 }
15928 static PyTypeObject __pyx_CyFunctionType_type = {
15929     PyVarObject_HEAD_INIT(0, 0)
15930     "cython_function_or_method",
15931     sizeof(__pyx_CyFunctionObject),
15932     0,
15933     (destructor) __Pyx_CyFunction_dealloc,
15934     0,
15935     0,
15936     0,
15937 #if PY_MAJOR_VERSION < 3
15938     0,
15939 #else
15940     0,
15941 #endif
15942     (reprfunc) __Pyx_CyFunction_repr,
15943     0,
15944     0,
15945     0,
15946     0,
15947     __Pyx_CyFunction_CallAsMethod,
15948     0,
15949     0,
15950     0,
15951     0,
15952     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
15953     0,
15954     (traverseproc) __Pyx_CyFunction_traverse,
15955     (inquiry) __Pyx_CyFunction_clear,
15956     0,
15957 #if PY_VERSION_HEX < 0x030500A0
15958     offsetof(__pyx_CyFunctionObject, func_weakreflist),
15959 #else
15960     offsetof(PyCFunctionObject, m_weakreflist),
15961 #endif
15962     0,
15963     0,
15964     __pyx_CyFunction_methods,
15965     __pyx_CyFunction_members,
15966     __pyx_CyFunction_getsets,
15967     0,
15968     0,
15969     __Pyx_CyFunction_descr_get,
15970     0,
15971     offsetof(__pyx_CyFunctionObject, func_dict),
15972     0,
15973     0,
15974     0,
15975     0,
15976     0,
15977     0,
15978     0,
15979     0,
15980     0,
15981     0,
15982     0,
15983     0,
15984 #if PY_VERSION_HEX >= 0x030400a1
15985     0,
15986 #endif
15987 #if PY_VERSION_HEX >= 0x030800b1
15988     0,
15989 #endif
15990 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15991     0,
15992 #endif
15993 };
__pyx_CyFunction_init(void)15994 static int __pyx_CyFunction_init(void) {
15995     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
15996     if (unlikely(__pyx_CyFunctionType == NULL)) {
15997         return -1;
15998     }
15999     return 0;
16000 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)16001 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
16002     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16003     m->defaults = PyObject_Malloc(size);
16004     if (unlikely(!m->defaults))
16005         return PyErr_NoMemory();
16006     memset(m->defaults, 0, size);
16007     m->defaults_pyobjects = pyobjects;
16008     m->defaults_size = size;
16009     return m->defaults;
16010 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)16011 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
16012     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16013     m->defaults_tuple = tuple;
16014     Py_INCREF(tuple);
16015 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)16016 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
16017     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16018     m->defaults_kwdict = dict;
16019     Py_INCREF(dict);
16020 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)16021 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
16022     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16023     m->func_annotations = dict;
16024     Py_INCREF(dict);
16025 }
16026 
16027 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)16028 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
16029                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
16030     PyObject *op = __Pyx_CyFunction_Init(
16031         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
16032         ml, flags, qualname, closure, module, globals, code
16033     );
16034     if (likely(op)) {
16035         PyObject_GC_Track(op);
16036     }
16037     return op;
16038 }
16039 
16040 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)16041 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
16042                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
16043     PyObject *ns;
16044     if (metaclass) {
16045         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
16046         if (prep) {
16047             PyObject *pargs = PyTuple_Pack(2, name, bases);
16048             if (unlikely(!pargs)) {
16049                 Py_DECREF(prep);
16050                 return NULL;
16051             }
16052             ns = PyObject_Call(prep, pargs, mkw);
16053             Py_DECREF(prep);
16054             Py_DECREF(pargs);
16055         } else {
16056             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
16057                 return NULL;
16058             PyErr_Clear();
16059             ns = PyDict_New();
16060         }
16061     } else {
16062         ns = PyDict_New();
16063     }
16064     if (unlikely(!ns))
16065         return NULL;
16066     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
16067     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
16068     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
16069     return ns;
16070 bad:
16071     Py_DECREF(ns);
16072     return NULL;
16073 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)16074 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
16075                                       PyObject *dict, PyObject *mkw,
16076                                       int calculate_metaclass, int allow_py2_metaclass) {
16077     PyObject *result, *margs;
16078     PyObject *owned_metaclass = NULL;
16079     if (allow_py2_metaclass) {
16080         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
16081         if (owned_metaclass) {
16082             metaclass = owned_metaclass;
16083         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
16084             PyErr_Clear();
16085         } else {
16086             return NULL;
16087         }
16088     }
16089     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
16090         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
16091         Py_XDECREF(owned_metaclass);
16092         if (unlikely(!metaclass))
16093             return NULL;
16094         owned_metaclass = metaclass;
16095     }
16096     margs = PyTuple_Pack(3, name, bases, dict);
16097     if (unlikely(!margs)) {
16098         result = NULL;
16099     } else {
16100         result = PyObject_Call(metaclass, margs, mkw);
16101         Py_DECREF(margs);
16102     }
16103     Py_XDECREF(owned_metaclass);
16104     return result;
16105 }
16106 
16107 /* CLineInTraceback */
16108 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)16109 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
16110     PyObject *use_cline;
16111     PyObject *ptype, *pvalue, *ptraceback;
16112 #if CYTHON_COMPILING_IN_CPYTHON
16113     PyObject **cython_runtime_dict;
16114 #endif
16115     if (unlikely(!__pyx_cython_runtime)) {
16116         return c_line;
16117     }
16118     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
16119 #if CYTHON_COMPILING_IN_CPYTHON
16120     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
16121     if (likely(cython_runtime_dict)) {
16122         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
16123             use_cline, *cython_runtime_dict,
16124             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
16125     } else
16126 #endif
16127     {
16128       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
16129       if (use_cline_obj) {
16130         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
16131         Py_DECREF(use_cline_obj);
16132       } else {
16133         PyErr_Clear();
16134         use_cline = NULL;
16135       }
16136     }
16137     if (!use_cline) {
16138         c_line = 0;
16139         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
16140     }
16141     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
16142         c_line = 0;
16143     }
16144     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
16145     return c_line;
16146 }
16147 #endif
16148 
16149 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)16150 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
16151     int start = 0, mid = 0, end = count - 1;
16152     if (end >= 0 && code_line > entries[end].code_line) {
16153         return count;
16154     }
16155     while (start < end) {
16156         mid = start + (end - start) / 2;
16157         if (code_line < entries[mid].code_line) {
16158             end = mid;
16159         } else if (code_line > entries[mid].code_line) {
16160              start = mid + 1;
16161         } else {
16162             return mid;
16163         }
16164     }
16165     if (code_line <= entries[mid].code_line) {
16166         return mid;
16167     } else {
16168         return mid + 1;
16169     }
16170 }
__pyx_find_code_object(int code_line)16171 static PyCodeObject *__pyx_find_code_object(int code_line) {
16172     PyCodeObject* code_object;
16173     int pos;
16174     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
16175         return NULL;
16176     }
16177     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16178     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
16179         return NULL;
16180     }
16181     code_object = __pyx_code_cache.entries[pos].code_object;
16182     Py_INCREF(code_object);
16183     return code_object;
16184 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)16185 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
16186     int pos, i;
16187     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
16188     if (unlikely(!code_line)) {
16189         return;
16190     }
16191     if (unlikely(!entries)) {
16192         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
16193         if (likely(entries)) {
16194             __pyx_code_cache.entries = entries;
16195             __pyx_code_cache.max_count = 64;
16196             __pyx_code_cache.count = 1;
16197             entries[0].code_line = code_line;
16198             entries[0].code_object = code_object;
16199             Py_INCREF(code_object);
16200         }
16201         return;
16202     }
16203     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16204     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
16205         PyCodeObject* tmp = entries[pos].code_object;
16206         entries[pos].code_object = code_object;
16207         Py_DECREF(tmp);
16208         return;
16209     }
16210     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
16211         int new_max = __pyx_code_cache.max_count + 64;
16212         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
16213             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
16214         if (unlikely(!entries)) {
16215             return;
16216         }
16217         __pyx_code_cache.entries = entries;
16218         __pyx_code_cache.max_count = new_max;
16219     }
16220     for (i=__pyx_code_cache.count; i>pos; i--) {
16221         entries[i] = entries[i-1];
16222     }
16223     entries[pos].code_line = code_line;
16224     entries[pos].code_object = code_object;
16225     __pyx_code_cache.count++;
16226     Py_INCREF(code_object);
16227 }
16228 
16229 /* AddTraceback */
16230 #include "compile.h"
16231 #include "frameobject.h"
16232 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)16233 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
16234             const char *funcname, int c_line,
16235             int py_line, const char *filename) {
16236     PyCodeObject *py_code = 0;
16237     PyObject *py_srcfile = 0;
16238     PyObject *py_funcname = 0;
16239     #if PY_MAJOR_VERSION < 3
16240     py_srcfile = PyString_FromString(filename);
16241     #else
16242     py_srcfile = PyUnicode_FromString(filename);
16243     #endif
16244     if (!py_srcfile) goto bad;
16245     if (c_line) {
16246         #if PY_MAJOR_VERSION < 3
16247         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16248         #else
16249         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16250         #endif
16251     }
16252     else {
16253         #if PY_MAJOR_VERSION < 3
16254         py_funcname = PyString_FromString(funcname);
16255         #else
16256         py_funcname = PyUnicode_FromString(funcname);
16257         #endif
16258     }
16259     if (!py_funcname) goto bad;
16260     py_code = __Pyx_PyCode_New(
16261         0,
16262         0,
16263         0,
16264         0,
16265         0,
16266         __pyx_empty_bytes, /*PyObject *code,*/
16267         __pyx_empty_tuple, /*PyObject *consts,*/
16268         __pyx_empty_tuple, /*PyObject *names,*/
16269         __pyx_empty_tuple, /*PyObject *varnames,*/
16270         __pyx_empty_tuple, /*PyObject *freevars,*/
16271         __pyx_empty_tuple, /*PyObject *cellvars,*/
16272         py_srcfile,   /*PyObject *filename,*/
16273         py_funcname,  /*PyObject *name,*/
16274         py_line,
16275         __pyx_empty_bytes  /*PyObject *lnotab*/
16276     );
16277     Py_DECREF(py_srcfile);
16278     Py_DECREF(py_funcname);
16279     return py_code;
16280 bad:
16281     Py_XDECREF(py_srcfile);
16282     Py_XDECREF(py_funcname);
16283     return NULL;
16284 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)16285 static void __Pyx_AddTraceback(const char *funcname, int c_line,
16286                                int py_line, const char *filename) {
16287     PyCodeObject *py_code = 0;
16288     PyFrameObject *py_frame = 0;
16289     PyThreadState *tstate = __Pyx_PyThreadState_Current;
16290     if (c_line) {
16291         c_line = __Pyx_CLineForTraceback(tstate, c_line);
16292     }
16293     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
16294     if (!py_code) {
16295         py_code = __Pyx_CreateCodeObjectForTraceback(
16296             funcname, c_line, py_line, filename);
16297         if (!py_code) goto bad;
16298         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
16299     }
16300     py_frame = PyFrame_New(
16301         tstate,            /*PyThreadState *tstate,*/
16302         py_code,           /*PyCodeObject *code,*/
16303         __pyx_d,    /*PyObject *globals,*/
16304         0                  /*PyObject *locals*/
16305     );
16306     if (!py_frame) goto bad;
16307     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
16308     PyTraceBack_Here(py_frame);
16309 bad:
16310     Py_XDECREF(py_code);
16311     Py_XDECREF(py_frame);
16312 }
16313 
16314 /* CIntFromPyVerify */
16315 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
16316     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
16317 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
16318     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
16319 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
16320     {\
16321         func_type value = func_value;\
16322         if (sizeof(target_type) < sizeof(func_type)) {\
16323             if (unlikely(value != (func_type) (target_type) value)) {\
16324                 func_type zero = 0;\
16325                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
16326                     return (target_type) -1;\
16327                 if (is_unsigned && unlikely(value < zero))\
16328                     goto raise_neg_overflow;\
16329                 else\
16330                     goto raise_overflow;\
16331             }\
16332         }\
16333         return (target_type) value;\
16334     }
16335 
16336 /* CIntToPy */
__Pyx_PyInt_From_int(int value)16337 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
16338     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
16339     const int is_unsigned = neg_one > const_zero;
16340     if (is_unsigned) {
16341         if (sizeof(int) < sizeof(long)) {
16342             return PyInt_FromLong((long) value);
16343         } else if (sizeof(int) <= sizeof(unsigned long)) {
16344             return PyLong_FromUnsignedLong((unsigned long) value);
16345 #ifdef HAVE_LONG_LONG
16346         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
16347             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16348 #endif
16349         }
16350     } else {
16351         if (sizeof(int) <= sizeof(long)) {
16352             return PyInt_FromLong((long) value);
16353 #ifdef HAVE_LONG_LONG
16354         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
16355             return PyLong_FromLongLong((PY_LONG_LONG) value);
16356 #endif
16357         }
16358     }
16359     {
16360         int one = 1; int little = (int)*(unsigned char *)&one;
16361         unsigned char *bytes = (unsigned char *)&value;
16362         return _PyLong_FromByteArray(bytes, sizeof(int),
16363                                      little, !is_unsigned);
16364     }
16365 }
16366 
16367 /* CIntToPy */
__Pyx_PyInt_From_CPLErr(CPLErr value)16368 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_CPLErr(CPLErr value) {
16369     const CPLErr neg_one = (CPLErr) ((CPLErr) 0 - (CPLErr) 1), const_zero = (CPLErr) 0;
16370     const int is_unsigned = neg_one > const_zero;
16371     if (is_unsigned) {
16372         if (sizeof(CPLErr) < sizeof(long)) {
16373             return PyInt_FromLong((long) value);
16374         } else if (sizeof(CPLErr) <= sizeof(unsigned long)) {
16375             return PyLong_FromUnsignedLong((unsigned long) value);
16376 #ifdef HAVE_LONG_LONG
16377         } else if (sizeof(CPLErr) <= sizeof(unsigned PY_LONG_LONG)) {
16378             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16379 #endif
16380         }
16381     } else {
16382         if (sizeof(CPLErr) <= sizeof(long)) {
16383             return PyInt_FromLong((long) value);
16384 #ifdef HAVE_LONG_LONG
16385         } else if (sizeof(CPLErr) <= sizeof(PY_LONG_LONG)) {
16386             return PyLong_FromLongLong((PY_LONG_LONG) value);
16387 #endif
16388         }
16389     }
16390     {
16391         int one = 1; int little = (int)*(unsigned char *)&one;
16392         unsigned char *bytes = (unsigned char *)&value;
16393         return _PyLong_FromByteArray(bytes, sizeof(CPLErr),
16394                                      little, !is_unsigned);
16395     }
16396 }
16397 
16398 /* CIntToPy */
__Pyx_PyInt_From_GIntBig(GIntBig value)16399 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GIntBig(GIntBig value) {
16400     const GIntBig neg_one = (GIntBig) ((GIntBig) 0 - (GIntBig) 1), const_zero = (GIntBig) 0;
16401     const int is_unsigned = neg_one > const_zero;
16402     if (is_unsigned) {
16403         if (sizeof(GIntBig) < sizeof(long)) {
16404             return PyInt_FromLong((long) value);
16405         } else if (sizeof(GIntBig) <= sizeof(unsigned long)) {
16406             return PyLong_FromUnsignedLong((unsigned long) value);
16407 #ifdef HAVE_LONG_LONG
16408         } else if (sizeof(GIntBig) <= sizeof(unsigned PY_LONG_LONG)) {
16409             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16410 #endif
16411         }
16412     } else {
16413         if (sizeof(GIntBig) <= sizeof(long)) {
16414             return PyInt_FromLong((long) value);
16415 #ifdef HAVE_LONG_LONG
16416         } else if (sizeof(GIntBig) <= sizeof(PY_LONG_LONG)) {
16417             return PyLong_FromLongLong((PY_LONG_LONG) value);
16418 #endif
16419         }
16420     }
16421     {
16422         int one = 1; int little = (int)*(unsigned char *)&one;
16423         unsigned char *bytes = (unsigned char *)&value;
16424         return _PyLong_FromByteArray(bytes, sizeof(GIntBig),
16425                                      little, !is_unsigned);
16426     }
16427 }
16428 
16429 /* CIntToPy */
__Pyx_PyInt_From_long(long value)16430 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
16431     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
16432     const int is_unsigned = neg_one > const_zero;
16433     if (is_unsigned) {
16434         if (sizeof(long) < sizeof(long)) {
16435             return PyInt_FromLong((long) value);
16436         } else if (sizeof(long) <= sizeof(unsigned long)) {
16437             return PyLong_FromUnsignedLong((unsigned long) value);
16438 #ifdef HAVE_LONG_LONG
16439         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16440             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16441 #endif
16442         }
16443     } else {
16444         if (sizeof(long) <= sizeof(long)) {
16445             return PyInt_FromLong((long) value);
16446 #ifdef HAVE_LONG_LONG
16447         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16448             return PyLong_FromLongLong((PY_LONG_LONG) value);
16449 #endif
16450         }
16451     }
16452     {
16453         int one = 1; int little = (int)*(unsigned char *)&one;
16454         unsigned char *bytes = (unsigned char *)&value;
16455         return _PyLong_FromByteArray(bytes, sizeof(long),
16456                                      little, !is_unsigned);
16457     }
16458 }
16459 
16460 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)16461 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
16462     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
16463     const int is_unsigned = neg_one > const_zero;
16464 #if PY_MAJOR_VERSION < 3
16465     if (likely(PyInt_Check(x))) {
16466         if (sizeof(long) < sizeof(long)) {
16467             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
16468         } else {
16469             long val = PyInt_AS_LONG(x);
16470             if (is_unsigned && unlikely(val < 0)) {
16471                 goto raise_neg_overflow;
16472             }
16473             return (long) val;
16474         }
16475     } else
16476 #endif
16477     if (likely(PyLong_Check(x))) {
16478         if (is_unsigned) {
16479 #if CYTHON_USE_PYLONG_INTERNALS
16480             const digit* digits = ((PyLongObject*)x)->ob_digit;
16481             switch (Py_SIZE(x)) {
16482                 case  0: return (long) 0;
16483                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
16484                 case 2:
16485                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
16486                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16487                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16488                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
16489                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16490                         }
16491                     }
16492                     break;
16493                 case 3:
16494                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
16495                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16496                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16497                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
16498                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16499                         }
16500                     }
16501                     break;
16502                 case 4:
16503                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
16504                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16505                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16506                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
16507                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16508                         }
16509                     }
16510                     break;
16511             }
16512 #endif
16513 #if CYTHON_COMPILING_IN_CPYTHON
16514             if (unlikely(Py_SIZE(x) < 0)) {
16515                 goto raise_neg_overflow;
16516             }
16517 #else
16518             {
16519                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16520                 if (unlikely(result < 0))
16521                     return (long) -1;
16522                 if (unlikely(result == 1))
16523                     goto raise_neg_overflow;
16524             }
16525 #endif
16526             if (sizeof(long) <= sizeof(unsigned long)) {
16527                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
16528 #ifdef HAVE_LONG_LONG
16529             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16530                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16531 #endif
16532             }
16533         } else {
16534 #if CYTHON_USE_PYLONG_INTERNALS
16535             const digit* digits = ((PyLongObject*)x)->ob_digit;
16536             switch (Py_SIZE(x)) {
16537                 case  0: return (long) 0;
16538                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
16539                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
16540                 case -2:
16541                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
16542                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16543                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16544                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16545                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16546                         }
16547                     }
16548                     break;
16549                 case 2:
16550                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
16551                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16552                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16553                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16554                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16555                         }
16556                     }
16557                     break;
16558                 case -3:
16559                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16560                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16561                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16562                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16563                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16564                         }
16565                     }
16566                     break;
16567                 case 3:
16568                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
16569                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16570                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16571                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16572                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16573                         }
16574                     }
16575                     break;
16576                 case -4:
16577                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16578                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16579                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16580                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
16581                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16582                         }
16583                     }
16584                     break;
16585                 case 4:
16586                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
16587                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16588                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16589                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
16590                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16591                         }
16592                     }
16593                     break;
16594             }
16595 #endif
16596             if (sizeof(long) <= sizeof(long)) {
16597                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
16598 #ifdef HAVE_LONG_LONG
16599             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16600                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
16601 #endif
16602             }
16603         }
16604         {
16605 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16606             PyErr_SetString(PyExc_RuntimeError,
16607                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16608 #else
16609             long val;
16610             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16611  #if PY_MAJOR_VERSION < 3
16612             if (likely(v) && !PyLong_Check(v)) {
16613                 PyObject *tmp = v;
16614                 v = PyNumber_Long(tmp);
16615                 Py_DECREF(tmp);
16616             }
16617  #endif
16618             if (likely(v)) {
16619                 int one = 1; int is_little = (int)*(unsigned char *)&one;
16620                 unsigned char *bytes = (unsigned char *)&val;
16621                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16622                                               bytes, sizeof(val),
16623                                               is_little, !is_unsigned);
16624                 Py_DECREF(v);
16625                 if (likely(!ret))
16626                     return val;
16627             }
16628 #endif
16629             return (long) -1;
16630         }
16631     } else {
16632         long val;
16633         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16634         if (!tmp) return (long) -1;
16635         val = __Pyx_PyInt_As_long(tmp);
16636         Py_DECREF(tmp);
16637         return val;
16638     }
16639 raise_overflow:
16640     PyErr_SetString(PyExc_OverflowError,
16641         "value too large to convert to long");
16642     return (long) -1;
16643 raise_neg_overflow:
16644     PyErr_SetString(PyExc_OverflowError,
16645         "can't convert negative value to long");
16646     return (long) -1;
16647 }
16648 
16649 /* CIntFromPy */
__Pyx_PyInt_As_GIntBig(PyObject * x)16650 static CYTHON_INLINE GIntBig __Pyx_PyInt_As_GIntBig(PyObject *x) {
16651     const GIntBig neg_one = (GIntBig) ((GIntBig) 0 - (GIntBig) 1), const_zero = (GIntBig) 0;
16652     const int is_unsigned = neg_one > const_zero;
16653 #if PY_MAJOR_VERSION < 3
16654     if (likely(PyInt_Check(x))) {
16655         if (sizeof(GIntBig) < sizeof(long)) {
16656             __PYX_VERIFY_RETURN_INT(GIntBig, long, PyInt_AS_LONG(x))
16657         } else {
16658             long val = PyInt_AS_LONG(x);
16659             if (is_unsigned && unlikely(val < 0)) {
16660                 goto raise_neg_overflow;
16661             }
16662             return (GIntBig) val;
16663         }
16664     } else
16665 #endif
16666     if (likely(PyLong_Check(x))) {
16667         if (is_unsigned) {
16668 #if CYTHON_USE_PYLONG_INTERNALS
16669             const digit* digits = ((PyLongObject*)x)->ob_digit;
16670             switch (Py_SIZE(x)) {
16671                 case  0: return (GIntBig) 0;
16672                 case  1: __PYX_VERIFY_RETURN_INT(GIntBig, digit, digits[0])
16673                 case 2:
16674                     if (8 * sizeof(GIntBig) > 1 * PyLong_SHIFT) {
16675                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16676                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16677                         } else if (8 * sizeof(GIntBig) >= 2 * PyLong_SHIFT) {
16678                             return (GIntBig) (((((GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0]));
16679                         }
16680                     }
16681                     break;
16682                 case 3:
16683                     if (8 * sizeof(GIntBig) > 2 * PyLong_SHIFT) {
16684                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16685                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16686                         } else if (8 * sizeof(GIntBig) >= 3 * PyLong_SHIFT) {
16687                             return (GIntBig) (((((((GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0]));
16688                         }
16689                     }
16690                     break;
16691                 case 4:
16692                     if (8 * sizeof(GIntBig) > 3 * PyLong_SHIFT) {
16693                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16694                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16695                         } else if (8 * sizeof(GIntBig) >= 4 * PyLong_SHIFT) {
16696                             return (GIntBig) (((((((((GIntBig)digits[3]) << PyLong_SHIFT) | (GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0]));
16697                         }
16698                     }
16699                     break;
16700             }
16701 #endif
16702 #if CYTHON_COMPILING_IN_CPYTHON
16703             if (unlikely(Py_SIZE(x) < 0)) {
16704                 goto raise_neg_overflow;
16705             }
16706 #else
16707             {
16708                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16709                 if (unlikely(result < 0))
16710                     return (GIntBig) -1;
16711                 if (unlikely(result == 1))
16712                     goto raise_neg_overflow;
16713             }
16714 #endif
16715             if (sizeof(GIntBig) <= sizeof(unsigned long)) {
16716                 __PYX_VERIFY_RETURN_INT_EXC(GIntBig, unsigned long, PyLong_AsUnsignedLong(x))
16717 #ifdef HAVE_LONG_LONG
16718             } else if (sizeof(GIntBig) <= sizeof(unsigned PY_LONG_LONG)) {
16719                 __PYX_VERIFY_RETURN_INT_EXC(GIntBig, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16720 #endif
16721             }
16722         } else {
16723 #if CYTHON_USE_PYLONG_INTERNALS
16724             const digit* digits = ((PyLongObject*)x)->ob_digit;
16725             switch (Py_SIZE(x)) {
16726                 case  0: return (GIntBig) 0;
16727                 case -1: __PYX_VERIFY_RETURN_INT(GIntBig, sdigit, (sdigit) (-(sdigit)digits[0]))
16728                 case  1: __PYX_VERIFY_RETURN_INT(GIntBig,  digit, +digits[0])
16729                 case -2:
16730                     if (8 * sizeof(GIntBig) - 1 > 1 * PyLong_SHIFT) {
16731                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16732                             __PYX_VERIFY_RETURN_INT(GIntBig, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16733                         } else if (8 * sizeof(GIntBig) - 1 > 2 * PyLong_SHIFT) {
16734                             return (GIntBig) (((GIntBig)-1)*(((((GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16735                         }
16736                     }
16737                     break;
16738                 case 2:
16739                     if (8 * sizeof(GIntBig) > 1 * PyLong_SHIFT) {
16740                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16741                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16742                         } else if (8 * sizeof(GIntBig) - 1 > 2 * PyLong_SHIFT) {
16743                             return (GIntBig) ((((((GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16744                         }
16745                     }
16746                     break;
16747                 case -3:
16748                     if (8 * sizeof(GIntBig) - 1 > 2 * PyLong_SHIFT) {
16749                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16750                             __PYX_VERIFY_RETURN_INT(GIntBig, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16751                         } else if (8 * sizeof(GIntBig) - 1 > 3 * PyLong_SHIFT) {
16752                             return (GIntBig) (((GIntBig)-1)*(((((((GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16753                         }
16754                     }
16755                     break;
16756                 case 3:
16757                     if (8 * sizeof(GIntBig) > 2 * PyLong_SHIFT) {
16758                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16759                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16760                         } else if (8 * sizeof(GIntBig) - 1 > 3 * PyLong_SHIFT) {
16761                             return (GIntBig) ((((((((GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16762                         }
16763                     }
16764                     break;
16765                 case -4:
16766                     if (8 * sizeof(GIntBig) - 1 > 3 * PyLong_SHIFT) {
16767                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16768                             __PYX_VERIFY_RETURN_INT(GIntBig, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16769                         } else if (8 * sizeof(GIntBig) - 1 > 4 * PyLong_SHIFT) {
16770                             return (GIntBig) (((GIntBig)-1)*(((((((((GIntBig)digits[3]) << PyLong_SHIFT) | (GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16771                         }
16772                     }
16773                     break;
16774                 case 4:
16775                     if (8 * sizeof(GIntBig) > 3 * PyLong_SHIFT) {
16776                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16777                             __PYX_VERIFY_RETURN_INT(GIntBig, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16778                         } else if (8 * sizeof(GIntBig) - 1 > 4 * PyLong_SHIFT) {
16779                             return (GIntBig) ((((((((((GIntBig)digits[3]) << PyLong_SHIFT) | (GIntBig)digits[2]) << PyLong_SHIFT) | (GIntBig)digits[1]) << PyLong_SHIFT) | (GIntBig)digits[0])));
16780                         }
16781                     }
16782                     break;
16783             }
16784 #endif
16785             if (sizeof(GIntBig) <= sizeof(long)) {
16786                 __PYX_VERIFY_RETURN_INT_EXC(GIntBig, long, PyLong_AsLong(x))
16787 #ifdef HAVE_LONG_LONG
16788             } else if (sizeof(GIntBig) <= sizeof(PY_LONG_LONG)) {
16789                 __PYX_VERIFY_RETURN_INT_EXC(GIntBig, PY_LONG_LONG, PyLong_AsLongLong(x))
16790 #endif
16791             }
16792         }
16793         {
16794 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16795             PyErr_SetString(PyExc_RuntimeError,
16796                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16797 #else
16798             GIntBig val;
16799             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16800  #if PY_MAJOR_VERSION < 3
16801             if (likely(v) && !PyLong_Check(v)) {
16802                 PyObject *tmp = v;
16803                 v = PyNumber_Long(tmp);
16804                 Py_DECREF(tmp);
16805             }
16806  #endif
16807             if (likely(v)) {
16808                 int one = 1; int is_little = (int)*(unsigned char *)&one;
16809                 unsigned char *bytes = (unsigned char *)&val;
16810                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16811                                               bytes, sizeof(val),
16812                                               is_little, !is_unsigned);
16813                 Py_DECREF(v);
16814                 if (likely(!ret))
16815                     return val;
16816             }
16817 #endif
16818             return (GIntBig) -1;
16819         }
16820     } else {
16821         GIntBig val;
16822         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16823         if (!tmp) return (GIntBig) -1;
16824         val = __Pyx_PyInt_As_GIntBig(tmp);
16825         Py_DECREF(tmp);
16826         return val;
16827     }
16828 raise_overflow:
16829     PyErr_SetString(PyExc_OverflowError,
16830         "value too large to convert to GIntBig");
16831     return (GIntBig) -1;
16832 raise_neg_overflow:
16833     PyErr_SetString(PyExc_OverflowError,
16834         "can't convert negative value to GIntBig");
16835     return (GIntBig) -1;
16836 }
16837 
16838 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)16839 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
16840     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
16841     const int is_unsigned = neg_one > const_zero;
16842 #if PY_MAJOR_VERSION < 3
16843     if (likely(PyInt_Check(x))) {
16844         if (sizeof(int) < sizeof(long)) {
16845             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
16846         } else {
16847             long val = PyInt_AS_LONG(x);
16848             if (is_unsigned && unlikely(val < 0)) {
16849                 goto raise_neg_overflow;
16850             }
16851             return (int) val;
16852         }
16853     } else
16854 #endif
16855     if (likely(PyLong_Check(x))) {
16856         if (is_unsigned) {
16857 #if CYTHON_USE_PYLONG_INTERNALS
16858             const digit* digits = ((PyLongObject*)x)->ob_digit;
16859             switch (Py_SIZE(x)) {
16860                 case  0: return (int) 0;
16861                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
16862                 case 2:
16863                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
16864                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16865                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16866                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
16867                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16868                         }
16869                     }
16870                     break;
16871                 case 3:
16872                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
16873                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16874                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16875                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
16876                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16877                         }
16878                     }
16879                     break;
16880                 case 4:
16881                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
16882                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16883                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16884                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
16885                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16886                         }
16887                     }
16888                     break;
16889             }
16890 #endif
16891 #if CYTHON_COMPILING_IN_CPYTHON
16892             if (unlikely(Py_SIZE(x) < 0)) {
16893                 goto raise_neg_overflow;
16894             }
16895 #else
16896             {
16897                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16898                 if (unlikely(result < 0))
16899                     return (int) -1;
16900                 if (unlikely(result == 1))
16901                     goto raise_neg_overflow;
16902             }
16903 #endif
16904             if (sizeof(int) <= sizeof(unsigned long)) {
16905                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
16906 #ifdef HAVE_LONG_LONG
16907             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
16908                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16909 #endif
16910             }
16911         } else {
16912 #if CYTHON_USE_PYLONG_INTERNALS
16913             const digit* digits = ((PyLongObject*)x)->ob_digit;
16914             switch (Py_SIZE(x)) {
16915                 case  0: return (int) 0;
16916                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
16917                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
16918                 case -2:
16919                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
16920                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16921                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16922                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16923                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16924                         }
16925                     }
16926                     break;
16927                 case 2:
16928                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
16929                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16930                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16931                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16932                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16933                         }
16934                     }
16935                     break;
16936                 case -3:
16937                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16938                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16939                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16940                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16941                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16942                         }
16943                     }
16944                     break;
16945                 case 3:
16946                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
16947                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16948                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16949                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16950                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16951                         }
16952                     }
16953                     break;
16954                 case -4:
16955                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16956                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16957                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16958                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
16959                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16960                         }
16961                     }
16962                     break;
16963                 case 4:
16964                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
16965                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16966                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16967                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
16968                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16969                         }
16970                     }
16971                     break;
16972             }
16973 #endif
16974             if (sizeof(int) <= sizeof(long)) {
16975                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
16976 #ifdef HAVE_LONG_LONG
16977             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
16978                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
16979 #endif
16980             }
16981         }
16982         {
16983 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16984             PyErr_SetString(PyExc_RuntimeError,
16985                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16986 #else
16987             int val;
16988             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16989  #if PY_MAJOR_VERSION < 3
16990             if (likely(v) && !PyLong_Check(v)) {
16991                 PyObject *tmp = v;
16992                 v = PyNumber_Long(tmp);
16993                 Py_DECREF(tmp);
16994             }
16995  #endif
16996             if (likely(v)) {
16997                 int one = 1; int is_little = (int)*(unsigned char *)&one;
16998                 unsigned char *bytes = (unsigned char *)&val;
16999                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
17000                                               bytes, sizeof(val),
17001                                               is_little, !is_unsigned);
17002                 Py_DECREF(v);
17003                 if (likely(!ret))
17004                     return val;
17005             }
17006 #endif
17007             return (int) -1;
17008         }
17009     } else {
17010         int val;
17011         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
17012         if (!tmp) return (int) -1;
17013         val = __Pyx_PyInt_As_int(tmp);
17014         Py_DECREF(tmp);
17015         return val;
17016     }
17017 raise_overflow:
17018     PyErr_SetString(PyExc_OverflowError,
17019         "value too large to convert to int");
17020     return (int) -1;
17021 raise_neg_overflow:
17022     PyErr_SetString(PyExc_OverflowError,
17023         "can't convert negative value to int");
17024     return (int) -1;
17025 }
17026 
17027 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)17028 static int __Pyx_check_binary_version(void) {
17029     char ctversion[4], rtversion[4];
17030     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
17031     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
17032     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
17033         char message[200];
17034         PyOS_snprintf(message, sizeof(message),
17035                       "compiletime version %s of module '%.100s' "
17036                       "does not match runtime version %s",
17037                       ctversion, __Pyx_MODULE_NAME, rtversion);
17038         return PyErr_WarnEx(NULL, message, 1);
17039     }
17040     return 0;
17041 }
17042 
17043 /* FunctionImport */
17044 #ifndef __PYX_HAVE_RT_ImportFunction
17045 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)17046 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
17047     PyObject *d = 0;
17048     PyObject *cobj = 0;
17049     union {
17050         void (*fp)(void);
17051         void *p;
17052     } tmp;
17053     d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
17054     if (!d)
17055         goto bad;
17056     cobj = PyDict_GetItemString(d, funcname);
17057     if (!cobj) {
17058         PyErr_Format(PyExc_ImportError,
17059             "%.200s does not export expected C function %.200s",
17060                 PyModule_GetName(module), funcname);
17061         goto bad;
17062     }
17063 #if PY_VERSION_HEX >= 0x02070000
17064     if (!PyCapsule_IsValid(cobj, sig)) {
17065         PyErr_Format(PyExc_TypeError,
17066             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
17067              PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
17068         goto bad;
17069     }
17070     tmp.p = PyCapsule_GetPointer(cobj, sig);
17071 #else
17072     {const char *desc, *s1, *s2;
17073     desc = (const char *)PyCObject_GetDesc(cobj);
17074     if (!desc)
17075         goto bad;
17076     s1 = desc; s2 = sig;
17077     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
17078     if (*s1 != *s2) {
17079         PyErr_Format(PyExc_TypeError,
17080             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
17081              PyModule_GetName(module), funcname, sig, desc);
17082         goto bad;
17083     }
17084     tmp.p = PyCObject_AsVoidPtr(cobj);}
17085 #endif
17086     *f = tmp.fp;
17087     if (!(*f))
17088         goto bad;
17089     Py_DECREF(d);
17090     return 0;
17091 bad:
17092     Py_XDECREF(d);
17093     return -1;
17094 }
17095 #endif
17096 
17097 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)17098 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
17099     while (t->p) {
17100         #if PY_MAJOR_VERSION < 3
17101         if (t->is_unicode) {
17102             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
17103         } else if (t->intern) {
17104             *t->p = PyString_InternFromString(t->s);
17105         } else {
17106             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
17107         }
17108         #else
17109         if (t->is_unicode | t->is_str) {
17110             if (t->intern) {
17111                 *t->p = PyUnicode_InternFromString(t->s);
17112             } else if (t->encoding) {
17113                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
17114             } else {
17115                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
17116             }
17117         } else {
17118             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
17119         }
17120         #endif
17121         if (!*t->p)
17122             return -1;
17123         if (PyObject_Hash(*t->p) == -1)
17124             return -1;
17125         ++t;
17126     }
17127     return 0;
17128 }
17129 
__Pyx_PyUnicode_FromString(const char * c_str)17130 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
17131     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
17132 }
__Pyx_PyObject_AsString(PyObject * o)17133 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
17134     Py_ssize_t ignore;
17135     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
17136 }
17137 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
17138 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)17139 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17140     char* defenc_c;
17141     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
17142     if (!defenc) return NULL;
17143     defenc_c = PyBytes_AS_STRING(defenc);
17144 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17145     {
17146         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
17147         char* c;
17148         for (c = defenc_c; c < end; c++) {
17149             if ((unsigned char) (*c) >= 128) {
17150                 PyUnicode_AsASCIIString(o);
17151                 return NULL;
17152             }
17153         }
17154     }
17155 #endif
17156     *length = PyBytes_GET_SIZE(defenc);
17157     return defenc_c;
17158 }
17159 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)17160 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17161     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
17162 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17163     if (likely(PyUnicode_IS_ASCII(o))) {
17164         *length = PyUnicode_GET_LENGTH(o);
17165         return PyUnicode_AsUTF8(o);
17166     } else {
17167         PyUnicode_AsASCIIString(o);
17168         return NULL;
17169     }
17170 #else
17171     return PyUnicode_AsUTF8AndSize(o, length);
17172 #endif
17173 }
17174 #endif
17175 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)17176 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17177 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
17178     if (
17179 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17180             __Pyx_sys_getdefaultencoding_not_ascii &&
17181 #endif
17182             PyUnicode_Check(o)) {
17183         return __Pyx_PyUnicode_AsStringAndSize(o, length);
17184     } else
17185 #endif
17186 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
17187     if (PyByteArray_Check(o)) {
17188         *length = PyByteArray_GET_SIZE(o);
17189         return PyByteArray_AS_STRING(o);
17190     } else
17191 #endif
17192     {
17193         char* result;
17194         int r = PyBytes_AsStringAndSize(o, &result, length);
17195         if (unlikely(r < 0)) {
17196             return NULL;
17197         } else {
17198             return result;
17199         }
17200     }
17201 }
__Pyx_PyObject_IsTrue(PyObject * x)17202 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
17203    int is_true = x == Py_True;
17204    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
17205    else return PyObject_IsTrue(x);
17206 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)17207 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
17208     int retval;
17209     if (unlikely(!x)) return -1;
17210     retval = __Pyx_PyObject_IsTrue(x);
17211     Py_DECREF(x);
17212     return retval;
17213 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)17214 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
17215 #if PY_MAJOR_VERSION >= 3
17216     if (PyLong_Check(result)) {
17217         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
17218                 "__int__ returned non-int (type %.200s).  "
17219                 "The ability to return an instance of a strict subclass of int "
17220                 "is deprecated, and may be removed in a future version of Python.",
17221                 Py_TYPE(result)->tp_name)) {
17222             Py_DECREF(result);
17223             return NULL;
17224         }
17225         return result;
17226     }
17227 #endif
17228     PyErr_Format(PyExc_TypeError,
17229                  "__%.4s__ returned non-%.4s (type %.200s)",
17230                  type_name, type_name, Py_TYPE(result)->tp_name);
17231     Py_DECREF(result);
17232     return NULL;
17233 }
__Pyx_PyNumber_IntOrLong(PyObject * x)17234 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
17235 #if CYTHON_USE_TYPE_SLOTS
17236   PyNumberMethods *m;
17237 #endif
17238   const char *name = NULL;
17239   PyObject *res = NULL;
17240 #if PY_MAJOR_VERSION < 3
17241   if (likely(PyInt_Check(x) || PyLong_Check(x)))
17242 #else
17243   if (likely(PyLong_Check(x)))
17244 #endif
17245     return __Pyx_NewRef(x);
17246 #if CYTHON_USE_TYPE_SLOTS
17247   m = Py_TYPE(x)->tp_as_number;
17248   #if PY_MAJOR_VERSION < 3
17249   if (m && m->nb_int) {
17250     name = "int";
17251     res = m->nb_int(x);
17252   }
17253   else if (m && m->nb_long) {
17254     name = "long";
17255     res = m->nb_long(x);
17256   }
17257   #else
17258   if (likely(m && m->nb_int)) {
17259     name = "int";
17260     res = m->nb_int(x);
17261   }
17262   #endif
17263 #else
17264   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
17265     res = PyNumber_Int(x);
17266   }
17267 #endif
17268   if (likely(res)) {
17269 #if PY_MAJOR_VERSION < 3
17270     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
17271 #else
17272     if (unlikely(!PyLong_CheckExact(res))) {
17273 #endif
17274         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
17275     }
17276   }
17277   else if (!PyErr_Occurred()) {
17278     PyErr_SetString(PyExc_TypeError,
17279                     "an integer is required");
17280   }
17281   return res;
17282 }
17283 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
17284   Py_ssize_t ival;
17285   PyObject *x;
17286 #if PY_MAJOR_VERSION < 3
17287   if (likely(PyInt_CheckExact(b))) {
17288     if (sizeof(Py_ssize_t) >= sizeof(long))
17289         return PyInt_AS_LONG(b);
17290     else
17291         return PyInt_AsSsize_t(b);
17292   }
17293 #endif
17294   if (likely(PyLong_CheckExact(b))) {
17295     #if CYTHON_USE_PYLONG_INTERNALS
17296     const digit* digits = ((PyLongObject*)b)->ob_digit;
17297     const Py_ssize_t size = Py_SIZE(b);
17298     if (likely(__Pyx_sst_abs(size) <= 1)) {
17299         ival = likely(size) ? digits[0] : 0;
17300         if (size == -1) ival = -ival;
17301         return ival;
17302     } else {
17303       switch (size) {
17304          case 2:
17305            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17306              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17307            }
17308            break;
17309          case -2:
17310            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17311              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17312            }
17313            break;
17314          case 3:
17315            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17316              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17317            }
17318            break;
17319          case -3:
17320            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17321              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17322            }
17323            break;
17324          case 4:
17325            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17326              return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17327            }
17328            break;
17329          case -4:
17330            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17331              return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17332            }
17333            break;
17334       }
17335     }
17336     #endif
17337     return PyLong_AsSsize_t(b);
17338   }
17339   x = PyNumber_Index(b);
17340   if (!x) return -1;
17341   ival = PyInt_AsSsize_t(x);
17342   Py_DECREF(x);
17343   return ival;
17344 }
17345 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
17346   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
17347 }
17348 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
17349     return PyInt_FromSize_t(ival);
17350 }
17351 
17352 
17353 #endif /* Py_PYTHON_H */
17354