pyogrio 0.10.0__cp313-cp313-win_amd64.whl → 0.11.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyogrio might be problematic. Click here for more details.

Files changed (87) hide show
  1. pyogrio/__init__.py +13 -14
  2. pyogrio/_compat.py +8 -0
  3. pyogrio/_err.c +9881 -4061
  4. pyogrio/_err.cp313-win_amd64.pyd +0 -0
  5. pyogrio/_geometry.c +372 -204
  6. pyogrio/_geometry.cp313-win_amd64.pyd +0 -0
  7. pyogrio/_io.c +7119 -6034
  8. pyogrio/_io.cp313-win_amd64.pyd +0 -0
  9. pyogrio/_ogr.c +1317 -1232
  10. pyogrio/_ogr.cp313-win_amd64.pyd +0 -0
  11. pyogrio/_version.py +3 -3
  12. pyogrio/_vsi.c +417 -424
  13. pyogrio/_vsi.cp313-win_amd64.pyd +0 -0
  14. pyogrio/gdal_data/GDAL-targets.cmake +2 -2
  15. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  16. pyogrio/gdal_data/gdalinfo_output.schema.json +3 -3
  17. pyogrio/gdal_data/gdaltileindex.xsd +1 -17
  18. pyogrio/gdal_data/gdalvrt.xsd +48 -41
  19. pyogrio/gdal_data/nitf_spec.xml +1 -17
  20. pyogrio/gdal_data/nitf_spec.xsd +1 -17
  21. pyogrio/gdal_data/ogrvrt.xsd +1 -17
  22. pyogrio/gdal_data/osmconf.ini +3 -1
  23. pyogrio/gdal_data/pdfcomposition.xsd +1 -17
  24. pyogrio/gdal_data/template_tiles.mapml +28 -0
  25. pyogrio/gdal_data/vcpkg.spdx.json +28 -23
  26. pyogrio/gdal_data/vcpkg_abi_info.txt +29 -28
  27. pyogrio/gdal_data/vdv452.xml +1 -17
  28. pyogrio/gdal_data/vdv452.xsd +1 -17
  29. pyogrio/geopandas.py +91 -43
  30. pyogrio/proj_data/ITRF2014 +1 -1
  31. pyogrio/proj_data/ITRF2020 +91 -0
  32. pyogrio/proj_data/proj-config-version.cmake +3 -3
  33. pyogrio/proj_data/proj-config.cmake +1 -1
  34. pyogrio/proj_data/proj-targets-release.cmake +3 -2
  35. pyogrio/proj_data/proj-targets.cmake +2 -2
  36. pyogrio/proj_data/proj.db +0 -0
  37. pyogrio/proj_data/proj.ini +11 -3
  38. pyogrio/proj_data/proj4-targets-release.cmake +3 -2
  39. pyogrio/proj_data/proj4-targets.cmake +2 -2
  40. pyogrio/proj_data/usage +7 -2
  41. pyogrio/proj_data/vcpkg.spdx.json +26 -21
  42. pyogrio/proj_data/vcpkg_abi_info.txt +17 -16
  43. pyogrio/tests/conftest.py +8 -0
  44. pyogrio/tests/test_arrow.py +3 -0
  45. pyogrio/tests/test_core.py +8 -4
  46. pyogrio/tests/test_geopandas_io.py +250 -42
  47. pyogrio/tests/test_path.py +10 -0
  48. pyogrio/tests/test_raw_io.py +6 -2
  49. pyogrio/util.py +15 -2
  50. pyogrio-0.11.0.dist-info/DELVEWHEEL +2 -0
  51. {pyogrio-0.10.0.dist-info → pyogrio-0.11.0.dist-info}/METADATA +32 -37
  52. {pyogrio-0.10.0.dist-info → pyogrio-0.11.0.dist-info}/RECORD +75 -71
  53. {pyogrio-0.10.0.dist-info → pyogrio-0.11.0.dist-info}/WHEEL +1 -1
  54. pyogrio.libs/{Lerc-089e3fef3df84b17326dcddbf1dedaa4.dll → Lerc-0a4c85fb364eca6153da109568898e6c.dll} +0 -0
  55. pyogrio.libs/{gdal-debee5933f0da7bb90b4bcd009023377.dll → gdal-34e3e080255b205ef706390e097fa4dc.dll} +0 -0
  56. pyogrio.libs/geos-d8f20037634583c2efcd6ea1f4153169.dll +0 -0
  57. pyogrio.libs/geos_c-046e8885887192fced9516bda554471d.dll +0 -0
  58. pyogrio.libs/{geotiff-c8fe8a095520a4ea4e465d27e06add3a.dll → geotiff-1f2f76a5d30685a8e0497d9dbf8a79cf.dll} +0 -0
  59. pyogrio.libs/{iconv-2-27352d156a5467ca5383d3951093ea5a.dll → iconv-2-4b71ebbdf6834234e0c64cb2439b77cf.dll} +0 -0
  60. pyogrio.libs/{jpeg62-e56b6f95a95af498f4623b8da4cebd46.dll → jpeg62-bf2a75b1f2695748cd86238ddb19c65b.dll} +0 -0
  61. pyogrio.libs/json-c-4bc6781090e73c9b22d8dc057618a277.dll +0 -0
  62. pyogrio.libs/libcrypto-3-x64-c8f1692ed45cf55faecce2c448056b2e.dll +0 -0
  63. pyogrio.libs/libcurl-f3604410cd467a44d927794ebdce81b8.dll +0 -0
  64. pyogrio.libs/libexpat-385074fd54deb4b640baafa42cbb3146.dll +0 -0
  65. pyogrio.libs/liblzma-8968f0bfd463b7fe612b20d07adc3c1e.dll +0 -0
  66. pyogrio.libs/libpng16-44105208fe941d03e9f0c17bdbb952f7.dll +0 -0
  67. pyogrio.libs/libssl-3-x64-58c364315f431ab1f0e48b311b8cf105.dll +0 -0
  68. pyogrio.libs/msvcp140-99aa35e2033bb8d388bc35c8a68b77e3.dll +0 -0
  69. pyogrio.libs/proj_9-ee59474f99643c112eb02aa34a910237.dll +0 -0
  70. pyogrio.libs/{qhull_r-516897f855568caab1ab1fe37912766c.dll → qhull_r-eaac2f11a3d8241f082e54447c7504d7.dll} +0 -0
  71. pyogrio.libs/sqlite3-dc748e3452944fd41001abacdd783569.dll +0 -0
  72. pyogrio.libs/tiff-c409ddbe87b39639b83fee50d4aea318.dll +0 -0
  73. pyogrio.libs/{zlib1-e5af16a15c63f05bd82d90396807ae5b.dll → zlib1-094085b7b78666197dcc8e1fce2d835d.dll} +0 -0
  74. pyogrio-0.10.0.dist-info/DELVEWHEEL +0 -2
  75. pyogrio.libs/geos-ace4c5b5c1f569bb4213e7bbd0b0322e.dll +0 -0
  76. pyogrio.libs/geos_c-7478ca0a86136b280d9b2d245c6f6627.dll +0 -0
  77. pyogrio.libs/json-c-c84940e2654a4f8468bfcf2ce992aa93.dll +0 -0
  78. pyogrio.libs/libcurl-d69cfd4ad487d53d58743b6778ec85e7.dll +0 -0
  79. pyogrio.libs/libexpat-6576a8d02641b6a3dbad35901ec200a7.dll +0 -0
  80. pyogrio.libs/liblzma-9ee4accb476ec1ae24e924953140273d.dll +0 -0
  81. pyogrio.libs/libpng16-7c36142dda59f186f6bb683e8dae2bfe.dll +0 -0
  82. pyogrio.libs/msvcp140-98b3e5b80de1e5e9d1703b786d795623.dll +0 -0
  83. pyogrio.libs/proj-a408c5327f3fd2f5fabe8c56815beed7.dll +0 -0
  84. pyogrio.libs/sqlite3-9bc109d8536d5ed9666332fec94485fc.dll +0 -0
  85. pyogrio.libs/tiff-9b3f605fffe0bccc0a964c374ee4f820.dll +0 -0
  86. {pyogrio-0.10.0.dist-info → pyogrio-0.11.0.dist-info/licenses}/LICENSE +0 -0
  87. {pyogrio-0.10.0.dist-info → pyogrio-0.11.0.dist-info}/top_level.txt +0 -0
pyogrio/_vsi.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.0.11 */
1
+ /* Generated by Cython 3.0.12 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -58,10 +58,10 @@ END: Cython Metadata */
58
58
  #else
59
59
  #define __PYX_EXTRA_ABI_MODULE_NAME ""
60
60
  #endif
61
- #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
61
+ #define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME
62
62
  #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
63
63
  #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
64
- #define CYTHON_HEX_VERSION 0x03000BF0
64
+ #define CYTHON_HEX_VERSION 0x03000CF0
65
65
  #define CYTHON_FUTURE_DIVISION 1
66
66
  #include <stddef.h>
67
67
  #ifndef offsetof
@@ -1253,9 +1253,8 @@ static CYTHON_INLINE float __PYX_NAN() {
1253
1253
  #define __PYX_HAVE__pyogrio___vsi
1254
1254
  #define __PYX_HAVE_API__pyogrio___vsi
1255
1255
  /* Early includes */
1256
- #include <string.h>
1257
- #include <stdlib.h>
1258
1256
  #include <stdint.h>
1257
+ #include <string.h>
1259
1258
  #include <stdio.h>
1260
1259
  #include "cpl_conv.h"
1261
1260
  #include "cpl_error.h"
@@ -1530,7 +1529,7 @@ static const char *__pyx_f[] = {
1530
1529
  /*--- Type declarations ---*/
1531
1530
  struct __pyx_opt_args_7pyogrio_4_ogr_get_string;
1532
1531
 
1533
- /* "pyogrio/_ogr.pxd":452
1532
+ /* "pyogrio/_ogr.pxd":514
1534
1533
  *
1535
1534
  *
1536
1535
  * cdef get_string(const char *c_str, str encoding=*) # <<<<<<<<<<<<<<
@@ -1747,7 +1746,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
1747
1746
  #if !CYTHON_VECTORCALL
1748
1747
  #if PY_VERSION_HEX >= 0x03080000
1749
1748
  #include "frameobject.h"
1750
- #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
1749
+ #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
1751
1750
  #ifndef Py_BUILD_CORE
1752
1751
  #define Py_BUILD_CORE 1
1753
1752
  #endif
@@ -2317,12 +2316,10 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2317
2316
 
2318
2317
  /* #### Code section: module_declarations ### */
2319
2318
 
2320
- /* Module declarations from "libc.string" */
2321
-
2322
- /* Module declarations from "libc.stdlib" */
2323
-
2324
2319
  /* Module declarations from "libc.stdint" */
2325
2320
 
2321
+ /* Module declarations from "libc.string" */
2322
+
2326
2323
  /* Module declarations from "libc.stdio" */
2327
2324
 
2328
2325
  /* Module declarations from "pyogrio._ogr" */
@@ -2464,8 +2461,6 @@ typedef struct {
2464
2461
  #endif
2465
2462
  #if CYTHON_USE_MODULE_STATE
2466
2463
  #endif
2467
- #if CYTHON_USE_MODULE_STATE
2468
- #endif
2469
2464
  PyObject *__pyx_n_s_BytesIO;
2470
2465
  PyObject *__pyx_n_u_DMD_EXTENSIONS;
2471
2466
  PyObject *__pyx_kp_u_Error_in_rmtree_of;
@@ -2839,8 +2834,6 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2839
2834
  #endif
2840
2835
  #if CYTHON_USE_MODULE_STATE
2841
2836
  #endif
2842
- #if CYTHON_USE_MODULE_STATE
2843
- #endif
2844
2837
  #define __pyx_n_s_BytesIO __pyx_mstate_global->__pyx_n_s_BytesIO
2845
2838
  #define __pyx_n_u_DMD_EXTENSIONS __pyx_mstate_global->__pyx_n_u_DMD_EXTENSIONS
2846
2839
  #define __pyx_kp_u_Error_in_rmtree_of __pyx_mstate_global->__pyx_kp_u_Error_in_rmtree_of
@@ -2934,7 +2927,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2934
2927
  #define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18
2935
2928
  /* #### Code section: module_code ### */
2936
2929
 
2937
- /* "pyogrio/_vsi.pyx":12
2930
+ /* "pyogrio/_vsi.pyx":9
2938
2931
  *
2939
2932
  *
2940
2933
  * cdef tuple get_ogr_vsimem_write_path(object path_or_fp, str driver): # <<<<<<<<<<<<<<
@@ -2963,21 +2956,21 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
2963
2956
  int __pyx_clineno = 0;
2964
2957
  __Pyx_RefNannySetupContext("get_ogr_vsimem_write_path", 1);
2965
2958
 
2966
- /* "pyogrio/_vsi.pyx":40
2959
+ /* "pyogrio/_vsi.pyx":37
2967
2960
  * """
2968
2961
  * # The write path is not a BytesIO object, so return path as-is
2969
2962
  * if not isinstance(path_or_fp, BytesIO): # <<<<<<<<<<<<<<
2970
2963
  * return (path_or_fp, False)
2971
2964
  *
2972
2965
  */
2973
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
2966
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
2974
2967
  __Pyx_GOTREF(__pyx_t_1);
2975
- __pyx_t_2 = PyObject_IsInstance(__pyx_v_path_or_fp, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 40, __pyx_L1_error)
2968
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_path_or_fp, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 37, __pyx_L1_error)
2976
2969
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2977
2970
  __pyx_t_3 = (!__pyx_t_2);
2978
2971
  if (__pyx_t_3) {
2979
2972
 
2980
- /* "pyogrio/_vsi.pyx":41
2973
+ /* "pyogrio/_vsi.pyx":38
2981
2974
  * # The write path is not a BytesIO object, so return path as-is
2982
2975
  * if not isinstance(path_or_fp, BytesIO):
2983
2976
  * return (path_or_fp, False) # <<<<<<<<<<<<<<
@@ -2985,19 +2978,19 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
2985
2978
  * # Check for existing bytes
2986
2979
  */
2987
2980
  __Pyx_XDECREF(__pyx_r);
2988
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
2981
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
2989
2982
  __Pyx_GOTREF(__pyx_t_1);
2990
2983
  __Pyx_INCREF(__pyx_v_path_or_fp);
2991
2984
  __Pyx_GIVEREF(__pyx_v_path_or_fp);
2992
- if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path_or_fp)) __PYX_ERR(0, 41, __pyx_L1_error);
2985
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path_or_fp)) __PYX_ERR(0, 38, __pyx_L1_error);
2993
2986
  __Pyx_INCREF(Py_False);
2994
2987
  __Pyx_GIVEREF(Py_False);
2995
- if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_False)) __PYX_ERR(0, 41, __pyx_L1_error);
2988
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_False)) __PYX_ERR(0, 38, __pyx_L1_error);
2996
2989
  __pyx_r = ((PyObject*)__pyx_t_1);
2997
2990
  __pyx_t_1 = 0;
2998
2991
  goto __pyx_L0;
2999
2992
 
3000
- /* "pyogrio/_vsi.pyx":40
2993
+ /* "pyogrio/_vsi.pyx":37
3001
2994
  * """
3002
2995
  * # The write path is not a BytesIO object, so return path as-is
3003
2996
  * if not isinstance(path_or_fp, BytesIO): # <<<<<<<<<<<<<<
@@ -3006,14 +2999,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3006
2999
  */
3007
3000
  }
3008
3001
 
3009
- /* "pyogrio/_vsi.pyx":44
3002
+ /* "pyogrio/_vsi.pyx":41
3010
3003
  *
3011
3004
  * # Check for existing bytes
3012
3005
  * if path_or_fp.getbuffer().nbytes > 0: # <<<<<<<<<<<<<<
3013
- * raise NotImplementedError("writing to existing in-memory object is not supported")
3014
- *
3006
+ * raise NotImplementedError(
3007
+ * "writing to existing in-memory object is not supported"
3015
3008
  */
3016
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path_or_fp, __pyx_n_s_getbuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
3009
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path_or_fp, __pyx_n_s_getbuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error)
3017
3010
  __Pyx_GOTREF(__pyx_t_4);
3018
3011
  __pyx_t_5 = NULL;
3019
3012
  __pyx_t_6 = 0;
@@ -3033,49 +3026,49 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3033
3026
  PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
3034
3027
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
3035
3028
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3036
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3029
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
3037
3030
  __Pyx_GOTREF(__pyx_t_1);
3038
3031
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3039
3032
  }
3040
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
3033
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error)
3041
3034
  __Pyx_GOTREF(__pyx_t_4);
3042
3035
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3043
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3036
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
3044
3037
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3045
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 44, __pyx_L1_error)
3038
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 41, __pyx_L1_error)
3046
3039
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3047
3040
  if (unlikely(__pyx_t_3)) {
3048
3041
 
3049
- /* "pyogrio/_vsi.pyx":45
3042
+ /* "pyogrio/_vsi.pyx":42
3050
3043
  * # Check for existing bytes
3051
3044
  * if path_or_fp.getbuffer().nbytes > 0:
3052
- * raise NotImplementedError("writing to existing in-memory object is not supported") # <<<<<<<<<<<<<<
3053
- *
3054
- * # Create in-memory directory to contain auxiliary files.
3045
+ * raise NotImplementedError( # <<<<<<<<<<<<<<
3046
+ * "writing to existing in-memory object is not supported"
3047
+ * )
3055
3048
  */
3056
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3049
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3057
3050
  __Pyx_GOTREF(__pyx_t_1);
3058
3051
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3059
3052
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3060
- __PYX_ERR(0, 45, __pyx_L1_error)
3053
+ __PYX_ERR(0, 42, __pyx_L1_error)
3061
3054
 
3062
- /* "pyogrio/_vsi.pyx":44
3055
+ /* "pyogrio/_vsi.pyx":41
3063
3056
  *
3064
3057
  * # Check for existing bytes
3065
3058
  * if path_or_fp.getbuffer().nbytes > 0: # <<<<<<<<<<<<<<
3066
- * raise NotImplementedError("writing to existing in-memory object is not supported")
3067
- *
3059
+ * raise NotImplementedError(
3060
+ * "writing to existing in-memory object is not supported"
3068
3061
  */
3069
3062
  }
3070
3063
 
3071
- /* "pyogrio/_vsi.pyx":49
3064
+ /* "pyogrio/_vsi.pyx":48
3072
3065
  * # Create in-memory directory to contain auxiliary files.
3073
3066
  * # Prefix with "pyogrio_" so it is clear the directory was created by pyogrio.
3074
3067
  * memfilename = f"pyogrio_{uuid4().hex}" # <<<<<<<<<<<<<<
3075
3068
  * VSIMkdir(f"/vsimem/{memfilename}".encode("UTF-8"), 0666)
3076
3069
  *
3077
3070
  */
3078
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
3071
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
3079
3072
  __Pyx_GOTREF(__pyx_t_4);
3080
3073
  __pyx_t_5 = NULL;
3081
3074
  __pyx_t_6 = 0;
@@ -3095,39 +3088,39 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3095
3088
  PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
3096
3089
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
3097
3090
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3098
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3091
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
3099
3092
  __Pyx_GOTREF(__pyx_t_1);
3100
3093
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3101
3094
  }
3102
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_hex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
3095
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_hex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
3103
3096
  __Pyx_GOTREF(__pyx_t_4);
3104
3097
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3105
- __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3098
+ __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
3106
3099
  __Pyx_GOTREF(__pyx_t_1);
3107
3100
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3108
- __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_n_u_pyogrio, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
3101
+ __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_n_u_pyogrio, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
3109
3102
  __Pyx_GOTREF(__pyx_t_4);
3110
3103
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3111
3104
  __pyx_v_memfilename = ((PyObject*)__pyx_t_4);
3112
3105
  __pyx_t_4 = 0;
3113
3106
 
3114
- /* "pyogrio/_vsi.pyx":50
3107
+ /* "pyogrio/_vsi.pyx":49
3115
3108
  * # Prefix with "pyogrio_" so it is clear the directory was created by pyogrio.
3116
3109
  * memfilename = f"pyogrio_{uuid4().hex}"
3117
3110
  * VSIMkdir(f"/vsimem/{memfilename}".encode("UTF-8"), 0666) # <<<<<<<<<<<<<<
3118
3111
  *
3119
3112
  * # file extension is required for some drivers, set it based on driver metadata
3120
3113
  */
3121
- __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsimem, __pyx_v_memfilename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
3114
+ __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsimem, __pyx_v_memfilename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
3122
3115
  __Pyx_GOTREF(__pyx_t_4);
3123
- __pyx_t_1 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
3116
+ __pyx_t_1 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3124
3117
  __Pyx_GOTREF(__pyx_t_1);
3125
3118
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3126
- __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error)
3119
+ __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error)
3127
3120
  (void)(VSIMkdir(__pyx_t_7, 0666));
3128
3121
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3129
3122
 
3130
- /* "pyogrio/_vsi.pyx":53
3123
+ /* "pyogrio/_vsi.pyx":52
3131
3124
  *
3132
3125
  * # file extension is required for some drivers, set it based on driver metadata
3133
3126
  * ext = "" # <<<<<<<<<<<<<<
@@ -3137,14 +3130,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3137
3130
  __Pyx_INCREF(__pyx_kp_u__2);
3138
3131
  __pyx_v_ext = __pyx_kp_u__2;
3139
3132
 
3140
- /* "pyogrio/_vsi.pyx":54
3133
+ /* "pyogrio/_vsi.pyx":53
3141
3134
  * # file extension is required for some drivers, set it based on driver metadata
3142
3135
  * ext = ""
3143
3136
  * recommended_ext = _get_driver_metadata_item(driver, "DMD_EXTENSIONS") # <<<<<<<<<<<<<<
3144
3137
  * if recommended_ext is not None:
3145
3138
  * ext = "." + recommended_ext.split(" ")[0]
3146
3139
  */
3147
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
3140
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
3148
3141
  __Pyx_GOTREF(__pyx_t_4);
3149
3142
  __pyx_t_5 = NULL;
3150
3143
  __pyx_t_6 = 0;
@@ -3164,14 +3157,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3164
3157
  PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_driver, __pyx_n_u_DMD_EXTENSIONS};
3165
3158
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
3166
3159
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3167
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
3160
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
3168
3161
  __Pyx_GOTREF(__pyx_t_1);
3169
3162
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3170
3163
  }
3171
3164
  __pyx_v_recommended_ext = __pyx_t_1;
3172
3165
  __pyx_t_1 = 0;
3173
3166
 
3174
- /* "pyogrio/_vsi.pyx":55
3167
+ /* "pyogrio/_vsi.pyx":54
3175
3168
  * ext = ""
3176
3169
  * recommended_ext = _get_driver_metadata_item(driver, "DMD_EXTENSIONS")
3177
3170
  * if recommended_ext is not None: # <<<<<<<<<<<<<<
@@ -3181,14 +3174,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3181
3174
  __pyx_t_3 = (__pyx_v_recommended_ext != Py_None);
3182
3175
  if (__pyx_t_3) {
3183
3176
 
3184
- /* "pyogrio/_vsi.pyx":56
3177
+ /* "pyogrio/_vsi.pyx":55
3185
3178
  * recommended_ext = _get_driver_metadata_item(driver, "DMD_EXTENSIONS")
3186
3179
  * if recommended_ext is not None:
3187
3180
  * ext = "." + recommended_ext.split(" ")[0] # <<<<<<<<<<<<<<
3188
3181
  *
3189
3182
  * path = f"/vsimem/{memfilename}/{memfilename}{ext}"
3190
3183
  */
3191
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_recommended_ext, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
3184
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_recommended_ext, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
3192
3185
  __Pyx_GOTREF(__pyx_t_4);
3193
3186
  __pyx_t_5 = NULL;
3194
3187
  __pyx_t_6 = 0;
@@ -3208,20 +3201,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3208
3201
  PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_u__4};
3209
3202
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
3210
3203
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3211
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
3204
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
3212
3205
  __Pyx_GOTREF(__pyx_t_1);
3213
3206
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3214
3207
  }
3215
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
3208
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
3216
3209
  __Pyx_GOTREF(__pyx_t_4);
3217
3210
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3218
- __pyx_t_1 = PyNumber_Add(__pyx_kp_u__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
3211
+ __pyx_t_1 = PyNumber_Add(__pyx_kp_u__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
3219
3212
  __Pyx_GOTREF(__pyx_t_1);
3220
3213
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3221
3214
  __Pyx_DECREF_SET(__pyx_v_ext, __pyx_t_1);
3222
3215
  __pyx_t_1 = 0;
3223
3216
 
3224
- /* "pyogrio/_vsi.pyx":55
3217
+ /* "pyogrio/_vsi.pyx":54
3225
3218
  * ext = ""
3226
3219
  * recommended_ext = _get_driver_metadata_item(driver, "DMD_EXTENSIONS")
3227
3220
  * if recommended_ext is not None: # <<<<<<<<<<<<<<
@@ -3230,14 +3223,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3230
3223
  */
3231
3224
  }
3232
3225
 
3233
- /* "pyogrio/_vsi.pyx":58
3226
+ /* "pyogrio/_vsi.pyx":57
3234
3227
  * ext = "." + recommended_ext.split(" ")[0]
3235
3228
  *
3236
3229
  * path = f"/vsimem/{memfilename}/{memfilename}{ext}" # <<<<<<<<<<<<<<
3237
3230
  *
3238
3231
  * return (path, True)
3239
3232
  */
3240
- __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
3233
+ __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
3241
3234
  __Pyx_GOTREF(__pyx_t_1);
3242
3235
  __pyx_t_8 = 0;
3243
3236
  __pyx_t_9 = 127;
@@ -3259,20 +3252,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3259
3252
  __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_memfilename);
3260
3253
  __Pyx_GIVEREF(__pyx_v_memfilename);
3261
3254
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_memfilename);
3262
- __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_ext, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error)
3255
+ __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_ext, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
3263
3256
  __Pyx_GOTREF(__pyx_t_4);
3264
3257
  __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
3265
3258
  __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
3266
3259
  __Pyx_GIVEREF(__pyx_t_4);
3267
3260
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_4);
3268
3261
  __pyx_t_4 = 0;
3269
- __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error)
3262
+ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
3270
3263
  __Pyx_GOTREF(__pyx_t_4);
3271
3264
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3272
3265
  __pyx_v_path = ((PyObject*)__pyx_t_4);
3273
3266
  __pyx_t_4 = 0;
3274
3267
 
3275
- /* "pyogrio/_vsi.pyx":60
3268
+ /* "pyogrio/_vsi.pyx":59
3276
3269
  * path = f"/vsimem/{memfilename}/{memfilename}{ext}"
3277
3270
  *
3278
3271
  * return (path, True) # <<<<<<<<<<<<<<
@@ -3280,19 +3273,19 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3280
3273
  *
3281
3274
  */
3282
3275
  __Pyx_XDECREF(__pyx_r);
3283
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error)
3276
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
3284
3277
  __Pyx_GOTREF(__pyx_t_4);
3285
3278
  __Pyx_INCREF(__pyx_v_path);
3286
3279
  __Pyx_GIVEREF(__pyx_v_path);
3287
- if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_path)) __PYX_ERR(0, 60, __pyx_L1_error);
3280
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_path)) __PYX_ERR(0, 59, __pyx_L1_error);
3288
3281
  __Pyx_INCREF(Py_True);
3289
3282
  __Pyx_GIVEREF(Py_True);
3290
- if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, Py_True)) __PYX_ERR(0, 60, __pyx_L1_error);
3283
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, Py_True)) __PYX_ERR(0, 59, __pyx_L1_error);
3291
3284
  __pyx_r = ((PyObject*)__pyx_t_4);
3292
3285
  __pyx_t_4 = 0;
3293
3286
  goto __pyx_L0;
3294
3287
 
3295
- /* "pyogrio/_vsi.pyx":12
3288
+ /* "pyogrio/_vsi.pyx":9
3296
3289
  *
3297
3290
  *
3298
3291
  * cdef tuple get_ogr_vsimem_write_path(object path_or_fp, str driver): # <<<<<<<<<<<<<<
@@ -3317,7 +3310,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_get_ogr_vsimem_write_path(PyObject *__py
3317
3310
  return __pyx_r;
3318
3311
  }
3319
3312
 
3320
- /* "pyogrio/_vsi.pyx":63
3313
+ /* "pyogrio/_vsi.pyx":62
3321
3314
  *
3322
3315
  *
3323
3316
  * cdef str read_buffer_to_vsimem(bytes bytes_buffer): # <<<<<<<<<<<<<<
@@ -3348,7 +3341,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3348
3341
  int __pyx_clineno = 0;
3349
3342
  __Pyx_RefNannySetupContext("read_buffer_to_vsimem", 1);
3350
3343
 
3351
- /* "pyogrio/_vsi.pyx":77
3344
+ /* "pyogrio/_vsi.pyx":76
3352
3345
  * bytes_buffer : bytes
3353
3346
  * """
3354
3347
  * cdef int num_bytes = len(bytes_buffer) # <<<<<<<<<<<<<<
@@ -3357,12 +3350,12 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3357
3350
  */
3358
3351
  if (unlikely(__pyx_v_bytes_buffer == Py_None)) {
3359
3352
  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3360
- __PYX_ERR(0, 77, __pyx_L1_error)
3353
+ __PYX_ERR(0, 76, __pyx_L1_error)
3361
3354
  }
3362
- __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bytes_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 77, __pyx_L1_error)
3355
+ __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bytes_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 76, __pyx_L1_error)
3363
3356
  __pyx_v_num_bytes = __pyx_t_1;
3364
3357
 
3365
- /* "pyogrio/_vsi.pyx":79
3358
+ /* "pyogrio/_vsi.pyx":78
3366
3359
  * cdef int num_bytes = len(bytes_buffer)
3367
3360
  *
3368
3361
  * is_zipped = len(bytes_buffer) > 4 and bytes_buffer[:4].startswith(b"PK\x03\x04") # <<<<<<<<<<<<<<
@@ -3371,13 +3364,13 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3371
3364
  */
3372
3365
  if (unlikely(__pyx_v_bytes_buffer == Py_None)) {
3373
3366
  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3374
- __PYX_ERR(0, 79, __pyx_L1_error)
3367
+ __PYX_ERR(0, 78, __pyx_L1_error)
3375
3368
  }
3376
- __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bytes_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 79, __pyx_L1_error)
3369
+ __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bytes_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 78, __pyx_L1_error)
3377
3370
  __pyx_t_3 = (__pyx_t_1 > 4);
3378
3371
  if (__pyx_t_3) {
3379
3372
  } else {
3380
- __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
3373
+ __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
3381
3374
  __Pyx_GOTREF(__pyx_t_4);
3382
3375
  __pyx_t_2 = __pyx_t_4;
3383
3376
  __pyx_t_4 = 0;
@@ -3385,13 +3378,13 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3385
3378
  }
3386
3379
  if (unlikely(__pyx_v_bytes_buffer == Py_None)) {
3387
3380
  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3388
- __PYX_ERR(0, 79, __pyx_L1_error)
3381
+ __PYX_ERR(0, 78, __pyx_L1_error)
3389
3382
  }
3390
- __pyx_t_4 = PySequence_GetSlice(__pyx_v_bytes_buffer, 0, 4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
3383
+ __pyx_t_4 = PySequence_GetSlice(__pyx_v_bytes_buffer, 0, 4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
3391
3384
  __Pyx_GOTREF(__pyx_t_4);
3392
- __pyx_t_3 = __Pyx_PyBytes_Tailmatch(__pyx_t_4, __pyx_kp_b_PK, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 79, __pyx_L1_error)
3385
+ __pyx_t_3 = __Pyx_PyBytes_Tailmatch(__pyx_t_4, __pyx_kp_b_PK, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 78, __pyx_L1_error)
3393
3386
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3394
- __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
3387
+ __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
3395
3388
  __Pyx_GOTREF(__pyx_t_4);
3396
3389
  __Pyx_INCREF(__pyx_t_4);
3397
3390
  __pyx_t_2 = __pyx_t_4;
@@ -3400,14 +3393,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3400
3393
  __pyx_v_is_zipped = __pyx_t_2;
3401
3394
  __pyx_t_2 = 0;
3402
3395
 
3403
- /* "pyogrio/_vsi.pyx":80
3396
+ /* "pyogrio/_vsi.pyx":79
3404
3397
  *
3405
3398
  * is_zipped = len(bytes_buffer) > 4 and bytes_buffer[:4].startswith(b"PK\x03\x04")
3406
3399
  * ext = ".zip" if is_zipped else "" # <<<<<<<<<<<<<<
3407
3400
  *
3408
3401
  * # Prefix with "pyogrio_" so it is clear the file was created by pyogrio.
3409
3402
  */
3410
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_zipped); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 80, __pyx_L1_error)
3403
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_zipped); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 79, __pyx_L1_error)
3411
3404
  if (__pyx_t_3) {
3412
3405
  __Pyx_INCREF(__pyx_kp_u_zip);
3413
3406
  __pyx_t_2 = __pyx_kp_u_zip;
@@ -3418,14 +3411,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3418
3411
  __pyx_v_ext = ((PyObject*)__pyx_t_2);
3419
3412
  __pyx_t_2 = 0;
3420
3413
 
3421
- /* "pyogrio/_vsi.pyx":83
3414
+ /* "pyogrio/_vsi.pyx":82
3422
3415
  *
3423
3416
  * # Prefix with "pyogrio_" so it is clear the file was created by pyogrio.
3424
3417
  * path = f"/vsimem/pyogrio_{uuid4().hex}{ext}" # <<<<<<<<<<<<<<
3425
3418
  *
3426
3419
  * # Create an in-memory object that references bytes_buffer
3427
3420
  */
3428
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
3421
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
3429
3422
  __Pyx_GOTREF(__pyx_t_2);
3430
3423
  __pyx_t_1 = 0;
3431
3424
  __pyx_t_5 = 127;
@@ -3433,7 +3426,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3433
3426
  __pyx_t_1 += 16;
3434
3427
  __Pyx_GIVEREF(__pyx_kp_u_vsimem_pyogrio);
3435
3428
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_vsimem_pyogrio);
3436
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error)
3429
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
3437
3430
  __Pyx_GOTREF(__pyx_t_6);
3438
3431
  __pyx_t_7 = NULL;
3439
3432
  __pyx_t_8 = 0;
@@ -3453,14 +3446,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3453
3446
  PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
3454
3447
  __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);
3455
3448
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3456
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
3449
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
3457
3450
  __Pyx_GOTREF(__pyx_t_4);
3458
3451
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3459
3452
  }
3460
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_hex); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error)
3453
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_hex); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
3461
3454
  __Pyx_GOTREF(__pyx_t_6);
3462
3455
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3463
- __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
3456
+ __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
3464
3457
  __Pyx_GOTREF(__pyx_t_4);
3465
3458
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3466
3459
  __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_5;
@@ -3468,36 +3461,36 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3468
3461
  __Pyx_GIVEREF(__pyx_t_4);
3469
3462
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
3470
3463
  __pyx_t_4 = 0;
3471
- __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_ext); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
3464
+ __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_ext); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
3472
3465
  __Pyx_GOTREF(__pyx_t_4);
3473
3466
  __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_5;
3474
3467
  __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
3475
3468
  __Pyx_GIVEREF(__pyx_t_4);
3476
3469
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
3477
3470
  __pyx_t_4 = 0;
3478
- __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
3471
+ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
3479
3472
  __Pyx_GOTREF(__pyx_t_4);
3480
3473
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3481
3474
  __pyx_v_path = ((PyObject*)__pyx_t_4);
3482
3475
  __pyx_t_4 = 0;
3483
3476
 
3484
- /* "pyogrio/_vsi.pyx":89
3477
+ /* "pyogrio/_vsi.pyx":88
3485
3478
  * # in scope through the duration of using this file
3486
3479
  * vsi_handle = VSIFileFromMemBuffer(
3487
3480
  * path.encode("UTF-8"), <unsigned char *>bytes_buffer, num_bytes, 0 # <<<<<<<<<<<<<<
3488
3481
  * )
3489
3482
  *
3490
3483
  */
3491
- __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
3484
+ __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
3492
3485
  __Pyx_GOTREF(__pyx_t_4);
3493
- __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error)
3486
+ __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3494
3487
  if (unlikely(__pyx_v_bytes_buffer == Py_None)) {
3495
3488
  PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
3496
- __PYX_ERR(0, 89, __pyx_L1_error)
3489
+ __PYX_ERR(0, 88, __pyx_L1_error)
3497
3490
  }
3498
- __pyx_t_10 = __Pyx_PyBytes_AsWritableUString(__pyx_v_bytes_buffer); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error)
3491
+ __pyx_t_10 = __Pyx_PyBytes_AsWritableUString(__pyx_v_bytes_buffer); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3499
3492
 
3500
- /* "pyogrio/_vsi.pyx":88
3493
+ /* "pyogrio/_vsi.pyx":87
3501
3494
  * # NOTE: GDAL does not copy the contents of bytes_buffer; it must remain
3502
3495
  * # in scope through the duration of using this file
3503
3496
  * vsi_handle = VSIFileFromMemBuffer( # <<<<<<<<<<<<<<
@@ -3507,7 +3500,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3507
3500
  __pyx_v_vsi_handle = VSIFileFromMemBuffer(__pyx_t_9, ((unsigned char *)__pyx_t_10), __pyx_v_num_bytes, 0);
3508
3501
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3509
3502
 
3510
- /* "pyogrio/_vsi.pyx":92
3503
+ /* "pyogrio/_vsi.pyx":91
3511
3504
  * )
3512
3505
  *
3513
3506
  * if vsi_handle == NULL: # <<<<<<<<<<<<<<
@@ -3517,20 +3510,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3517
3510
  __pyx_t_3 = (__pyx_v_vsi_handle == NULL);
3518
3511
  if (unlikely(__pyx_t_3)) {
3519
3512
 
3520
- /* "pyogrio/_vsi.pyx":93
3513
+ /* "pyogrio/_vsi.pyx":92
3521
3514
  *
3522
3515
  * if vsi_handle == NULL:
3523
3516
  * raise OSError("failed to read buffer into in-memory file") # <<<<<<<<<<<<<<
3524
3517
  *
3525
3518
  * if VSIFCloseL(vsi_handle) != 0:
3526
3519
  */
3527
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
3520
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
3528
3521
  __Pyx_GOTREF(__pyx_t_4);
3529
3522
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3530
3523
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3531
- __PYX_ERR(0, 93, __pyx_L1_error)
3524
+ __PYX_ERR(0, 92, __pyx_L1_error)
3532
3525
 
3533
- /* "pyogrio/_vsi.pyx":92
3526
+ /* "pyogrio/_vsi.pyx":91
3534
3527
  * )
3535
3528
  *
3536
3529
  * if vsi_handle == NULL: # <<<<<<<<<<<<<<
@@ -3539,7 +3532,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3539
3532
  */
3540
3533
  }
3541
3534
 
3542
- /* "pyogrio/_vsi.pyx":95
3535
+ /* "pyogrio/_vsi.pyx":94
3543
3536
  * raise OSError("failed to read buffer into in-memory file")
3544
3537
  *
3545
3538
  * if VSIFCloseL(vsi_handle) != 0: # <<<<<<<<<<<<<<
@@ -3549,20 +3542,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3549
3542
  __pyx_t_3 = (VSIFCloseL(__pyx_v_vsi_handle) != 0);
3550
3543
  if (unlikely(__pyx_t_3)) {
3551
3544
 
3552
- /* "pyogrio/_vsi.pyx":96
3545
+ /* "pyogrio/_vsi.pyx":95
3553
3546
  *
3554
3547
  * if VSIFCloseL(vsi_handle) != 0:
3555
3548
  * raise OSError("failed to close in-memory file") # <<<<<<<<<<<<<<
3556
3549
  *
3557
3550
  * if is_zipped:
3558
3551
  */
3559
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
3552
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
3560
3553
  __Pyx_GOTREF(__pyx_t_4);
3561
3554
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3562
3555
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3563
- __PYX_ERR(0, 96, __pyx_L1_error)
3556
+ __PYX_ERR(0, 95, __pyx_L1_error)
3564
3557
 
3565
- /* "pyogrio/_vsi.pyx":95
3558
+ /* "pyogrio/_vsi.pyx":94
3566
3559
  * raise OSError("failed to read buffer into in-memory file")
3567
3560
  *
3568
3561
  * if VSIFCloseL(vsi_handle) != 0: # <<<<<<<<<<<<<<
@@ -3571,29 +3564,29 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3571
3564
  */
3572
3565
  }
3573
3566
 
3574
- /* "pyogrio/_vsi.pyx":98
3567
+ /* "pyogrio/_vsi.pyx":97
3575
3568
  * raise OSError("failed to close in-memory file")
3576
3569
  *
3577
3570
  * if is_zipped: # <<<<<<<<<<<<<<
3578
3571
  * path = f"/vsizip/{path}"
3579
3572
  *
3580
3573
  */
3581
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_zipped); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 98, __pyx_L1_error)
3574
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_zipped); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 97, __pyx_L1_error)
3582
3575
  if (__pyx_t_3) {
3583
3576
 
3584
- /* "pyogrio/_vsi.pyx":99
3577
+ /* "pyogrio/_vsi.pyx":98
3585
3578
  *
3586
3579
  * if is_zipped:
3587
3580
  * path = f"/vsizip/{path}" # <<<<<<<<<<<<<<
3588
3581
  *
3589
3582
  * return path
3590
3583
  */
3591
- __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsizip, __pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
3584
+ __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsizip, __pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
3592
3585
  __Pyx_GOTREF(__pyx_t_4);
3593
3586
  __Pyx_DECREF_SET(__pyx_v_path, ((PyObject*)__pyx_t_4));
3594
3587
  __pyx_t_4 = 0;
3595
3588
 
3596
- /* "pyogrio/_vsi.pyx":98
3589
+ /* "pyogrio/_vsi.pyx":97
3597
3590
  * raise OSError("failed to close in-memory file")
3598
3591
  *
3599
3592
  * if is_zipped: # <<<<<<<<<<<<<<
@@ -3602,7 +3595,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3602
3595
  */
3603
3596
  }
3604
3597
 
3605
- /* "pyogrio/_vsi.pyx":101
3598
+ /* "pyogrio/_vsi.pyx":100
3606
3599
  * path = f"/vsizip/{path}"
3607
3600
  *
3608
3601
  * return path # <<<<<<<<<<<<<<
@@ -3614,7 +3607,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3614
3607
  __pyx_r = __pyx_v_path;
3615
3608
  goto __pyx_L0;
3616
3609
 
3617
- /* "pyogrio/_vsi.pyx":63
3610
+ /* "pyogrio/_vsi.pyx":62
3618
3611
  *
3619
3612
  *
3620
3613
  * cdef str read_buffer_to_vsimem(bytes bytes_buffer): # <<<<<<<<<<<<<<
@@ -3639,7 +3632,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_buffer_to_vsimem(PyObject *__pyx_v_
3639
3632
  return __pyx_r;
3640
3633
  }
3641
3634
 
3642
- /* "pyogrio/_vsi.pyx":104
3635
+ /* "pyogrio/_vsi.pyx":103
3643
3636
  *
3644
3637
  *
3645
3638
  * cdef read_vsimem_to_buffer(str path, object out_buffer): # <<<<<<<<<<<<<<
@@ -3673,7 +3666,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3673
3666
  int __pyx_clineno = 0;
3674
3667
  __Pyx_RefNannySetupContext("read_vsimem_to_buffer", 1);
3675
3668
 
3676
- /* "pyogrio/_vsi.pyx":118
3669
+ /* "pyogrio/_vsi.pyx":117
3677
3670
  * """
3678
3671
  *
3679
3672
  * cdef unsigned char *vsi_buffer = NULL # <<<<<<<<<<<<<<
@@ -3682,7 +3675,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3682
3675
  */
3683
3676
  __pyx_v_vsi_buffer = NULL;
3684
3677
 
3685
- /* "pyogrio/_vsi.pyx":119
3678
+ /* "pyogrio/_vsi.pyx":118
3686
3679
  *
3687
3680
  * cdef unsigned char *vsi_buffer = NULL
3688
3681
  * cdef vsi_l_offset vsi_buffer_size = 0 # <<<<<<<<<<<<<<
@@ -3691,7 +3684,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3691
3684
  */
3692
3685
  __pyx_v_vsi_buffer_size = 0;
3693
3686
 
3694
- /* "pyogrio/_vsi.pyx":121
3687
+ /* "pyogrio/_vsi.pyx":120
3695
3688
  * cdef vsi_l_offset vsi_buffer_size = 0
3696
3689
  *
3697
3690
  * try: # <<<<<<<<<<<<<<
@@ -3700,7 +3693,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3700
3693
  */
3701
3694
  /*try:*/ {
3702
3695
 
3703
- /* "pyogrio/_vsi.pyx":124
3696
+ /* "pyogrio/_vsi.pyx":123
3704
3697
  * # Take ownership of the buffer to avoid a copy; GDAL will automatically
3705
3698
  * # unlink the memory file
3706
3699
  * vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1) # <<<<<<<<<<<<<<
@@ -3709,15 +3702,15 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3709
3702
  */
3710
3703
  if (unlikely(__pyx_v_path == Py_None)) {
3711
3704
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
3712
- __PYX_ERR(0, 124, __pyx_L4_error)
3705
+ __PYX_ERR(0, 123, __pyx_L4_error)
3713
3706
  }
3714
- __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L4_error)
3707
+ __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L4_error)
3715
3708
  __Pyx_GOTREF(__pyx_t_1);
3716
- __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L4_error)
3709
+ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L4_error)
3717
3710
  __pyx_v_vsi_buffer = VSIGetMemFileBuffer(__pyx_t_2, (&__pyx_v_vsi_buffer_size), 1);
3718
3711
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3719
3712
 
3720
- /* "pyogrio/_vsi.pyx":125
3713
+ /* "pyogrio/_vsi.pyx":124
3721
3714
  * # unlink the memory file
3722
3715
  * vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1)
3723
3716
  * if vsi_buffer == NULL: # <<<<<<<<<<<<<<
@@ -3727,20 +3720,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3727
3720
  __pyx_t_3 = (__pyx_v_vsi_buffer == NULL);
3728
3721
  if (unlikely(__pyx_t_3)) {
3729
3722
 
3730
- /* "pyogrio/_vsi.pyx":126
3723
+ /* "pyogrio/_vsi.pyx":125
3731
3724
  * vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1)
3732
3725
  * if vsi_buffer == NULL:
3733
3726
  * raise RuntimeError("could not read bytes from in-memory file") # <<<<<<<<<<<<<<
3734
3727
  *
3735
3728
  * # write bytes to buffer
3736
3729
  */
3737
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L4_error)
3730
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L4_error)
3738
3731
  __Pyx_GOTREF(__pyx_t_1);
3739
3732
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3740
3733
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3741
- __PYX_ERR(0, 126, __pyx_L4_error)
3734
+ __PYX_ERR(0, 125, __pyx_L4_error)
3742
3735
 
3743
- /* "pyogrio/_vsi.pyx":125
3736
+ /* "pyogrio/_vsi.pyx":124
3744
3737
  * # unlink the memory file
3745
3738
  * vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1)
3746
3739
  * if vsi_buffer == NULL: # <<<<<<<<<<<<<<
@@ -3749,16 +3742,16 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3749
3742
  */
3750
3743
  }
3751
3744
 
3752
- /* "pyogrio/_vsi.pyx":129
3745
+ /* "pyogrio/_vsi.pyx":128
3753
3746
  *
3754
3747
  * # write bytes to buffer
3755
3748
  * out_buffer.write(<bytes>vsi_buffer[:vsi_buffer_size]) # <<<<<<<<<<<<<<
3756
3749
  * # rewind to beginning to allow caller to read
3757
3750
  * out_buffer.seek(0)
3758
3751
  */
3759
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_buffer, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L4_error)
3752
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_buffer, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L4_error)
3760
3753
  __Pyx_GOTREF(__pyx_t_4);
3761
- __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_vsi_buffer) + 0, __pyx_v_vsi_buffer_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L4_error)
3754
+ __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_vsi_buffer) + 0, __pyx_v_vsi_buffer_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L4_error)
3762
3755
  __Pyx_GOTREF(__pyx_t_5);
3763
3756
  __pyx_t_6 = NULL;
3764
3757
  __pyx_t_7 = 0;
@@ -3779,20 +3772,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3779
3772
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
3780
3773
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3781
3774
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3782
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L4_error)
3775
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L4_error)
3783
3776
  __Pyx_GOTREF(__pyx_t_1);
3784
3777
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3785
3778
  }
3786
3779
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3787
3780
 
3788
- /* "pyogrio/_vsi.pyx":131
3781
+ /* "pyogrio/_vsi.pyx":130
3789
3782
  * out_buffer.write(<bytes>vsi_buffer[:vsi_buffer_size])
3790
3783
  * # rewind to beginning to allow caller to read
3791
3784
  * out_buffer.seek(0) # <<<<<<<<<<<<<<
3792
3785
  *
3793
3786
  * finally:
3794
3787
  */
3795
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_buffer, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L4_error)
3788
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_buffer, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L4_error)
3796
3789
  __Pyx_GOTREF(__pyx_t_4);
3797
3790
  __pyx_t_5 = NULL;
3798
3791
  __pyx_t_7 = 0;
@@ -3812,14 +3805,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3812
3805
  PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_int_0};
3813
3806
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
3814
3807
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3815
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L4_error)
3808
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L4_error)
3816
3809
  __Pyx_GOTREF(__pyx_t_1);
3817
3810
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3818
3811
  }
3819
3812
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3820
3813
  }
3821
3814
 
3822
- /* "pyogrio/_vsi.pyx":134
3815
+ /* "pyogrio/_vsi.pyx":133
3823
3816
  *
3824
3817
  * finally:
3825
3818
  * if vsi_buffer != NULL: # <<<<<<<<<<<<<<
@@ -3831,7 +3824,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3831
3824
  __pyx_t_3 = (__pyx_v_vsi_buffer != NULL);
3832
3825
  if (__pyx_t_3) {
3833
3826
 
3834
- /* "pyogrio/_vsi.pyx":135
3827
+ /* "pyogrio/_vsi.pyx":134
3835
3828
  * finally:
3836
3829
  * if vsi_buffer != NULL:
3837
3830
  * CPLFree(vsi_buffer) # <<<<<<<<<<<<<<
@@ -3840,7 +3833,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3840
3833
  */
3841
3834
  CPLFree(__pyx_v_vsi_buffer);
3842
3835
 
3843
- /* "pyogrio/_vsi.pyx":134
3836
+ /* "pyogrio/_vsi.pyx":133
3844
3837
  *
3845
3838
  * finally:
3846
3839
  * if vsi_buffer != NULL: # <<<<<<<<<<<<<<
@@ -3872,7 +3865,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3872
3865
  __pyx_t_3 = (__pyx_v_vsi_buffer != NULL);
3873
3866
  if (__pyx_t_3) {
3874
3867
 
3875
- /* "pyogrio/_vsi.pyx":135
3868
+ /* "pyogrio/_vsi.pyx":134
3876
3869
  * finally:
3877
3870
  * if vsi_buffer != NULL:
3878
3871
  * CPLFree(vsi_buffer) # <<<<<<<<<<<<<<
@@ -3881,7 +3874,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3881
3874
  */
3882
3875
  CPLFree(__pyx_v_vsi_buffer);
3883
3876
 
3884
- /* "pyogrio/_vsi.pyx":134
3877
+ /* "pyogrio/_vsi.pyx":133
3885
3878
  *
3886
3879
  * finally:
3887
3880
  * if vsi_buffer != NULL: # <<<<<<<<<<<<<<
@@ -3907,7 +3900,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3907
3900
  __pyx_L5:;
3908
3901
  }
3909
3902
 
3910
- /* "pyogrio/_vsi.pyx":104
3903
+ /* "pyogrio/_vsi.pyx":103
3911
3904
  *
3912
3905
  *
3913
3906
  * cdef read_vsimem_to_buffer(str path, object out_buffer): # <<<<<<<<<<<<<<
@@ -3931,7 +3924,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_read_vsimem_to_buffer(PyObject *__pyx_v_
3931
3924
  return __pyx_r;
3932
3925
  }
3933
3926
 
3934
- /* "pyogrio/_vsi.pyx":138
3927
+ /* "pyogrio/_vsi.pyx":137
3935
3928
  *
3936
3929
  *
3937
3930
  * cpdef vsimem_rmtree_toplevel(str path): # <<<<<<<<<<<<<<
@@ -3968,7 +3961,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
3968
3961
  int __pyx_clineno = 0;
3969
3962
  __Pyx_RefNannySetupContext("vsimem_rmtree_toplevel", 1);
3970
3963
 
3971
- /* "pyogrio/_vsi.pyx":164
3964
+ /* "pyogrio/_vsi.pyx":163
3972
3965
  * cdef VSIStatBufL st_buf
3973
3966
  *
3974
3967
  * if "/vsimem/" not in path: # <<<<<<<<<<<<<<
@@ -3977,19 +3970,19 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
3977
3970
  */
3978
3971
  if (unlikely(__pyx_v_path == Py_None)) {
3979
3972
  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
3980
- __PYX_ERR(0, 164, __pyx_L1_error)
3973
+ __PYX_ERR(0, 163, __pyx_L1_error)
3981
3974
  }
3982
- __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_kp_u_vsimem, __pyx_v_path, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error)
3975
+ __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_kp_u_vsimem, __pyx_v_path, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 163, __pyx_L1_error)
3983
3976
  if (unlikely(__pyx_t_1)) {
3984
3977
 
3985
- /* "pyogrio/_vsi.pyx":165
3978
+ /* "pyogrio/_vsi.pyx":164
3986
3979
  *
3987
3980
  * if "/vsimem/" not in path:
3988
3981
  * raise ValueError(f"Path is not a /vsimem/ path: '{path}'") # <<<<<<<<<<<<<<
3989
3982
  *
3990
3983
  * # Determine the top-level directory of the file
3991
3984
  */
3992
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
3985
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
3993
3986
  __Pyx_GOTREF(__pyx_t_2);
3994
3987
  __pyx_t_3 = 0;
3995
3988
  __pyx_t_4 = 127;
@@ -3997,7 +3990,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
3997
3990
  __pyx_t_3 += 30;
3998
3991
  __Pyx_GIVEREF(__pyx_kp_u_Path_is_not_a_vsimem_path);
3999
3992
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Path_is_not_a_vsimem_path);
4000
- __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
3993
+ __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error)
4001
3994
  __Pyx_GOTREF(__pyx_t_5);
4002
3995
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
4003
3996
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
@@ -4008,17 +4001,17 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4008
4001
  __pyx_t_3 += 1;
4009
4002
  __Pyx_GIVEREF(__pyx_kp_u__9);
4010
4003
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__9);
4011
- __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
4004
+ __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error)
4012
4005
  __Pyx_GOTREF(__pyx_t_5);
4013
4006
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4014
- __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
4007
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
4015
4008
  __Pyx_GOTREF(__pyx_t_2);
4016
4009
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4017
4010
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4018
4011
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4019
- __PYX_ERR(0, 165, __pyx_L1_error)
4012
+ __PYX_ERR(0, 164, __pyx_L1_error)
4020
4013
 
4021
- /* "pyogrio/_vsi.pyx":164
4014
+ /* "pyogrio/_vsi.pyx":163
4022
4015
  * cdef VSIStatBufL st_buf
4023
4016
  *
4024
4017
  * if "/vsimem/" not in path: # <<<<<<<<<<<<<<
@@ -4027,7 +4020,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4027
4020
  */
4028
4021
  }
4029
4022
 
4030
- /* "pyogrio/_vsi.pyx":168
4023
+ /* "pyogrio/_vsi.pyx":167
4031
4024
  *
4032
4025
  * # Determine the top-level directory of the file
4033
4026
  * mempath_parts = path.split("/vsimem/")[1].split("/") # <<<<<<<<<<<<<<
@@ -4036,14 +4029,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4036
4029
  */
4037
4030
  if (unlikely(__pyx_v_path == Py_None)) {
4038
4031
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "split");
4039
- __PYX_ERR(0, 168, __pyx_L1_error)
4032
+ __PYX_ERR(0, 167, __pyx_L1_error)
4040
4033
  }
4041
- __pyx_t_5 = PyUnicode_Split(__pyx_v_path, __Pyx_NoneAsNull(__pyx_kp_u_vsimem), -1L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error)
4034
+ __pyx_t_5 = PyUnicode_Split(__pyx_v_path, __Pyx_NoneAsNull(__pyx_kp_u_vsimem), -1L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L1_error)
4042
4035
  __Pyx_GOTREF(__pyx_t_5);
4043
- __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error)
4036
+ __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 167, __pyx_L1_error)
4044
4037
  __Pyx_GOTREF(__pyx_t_6);
4045
4038
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4046
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error)
4039
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L1_error)
4047
4040
  __Pyx_GOTREF(__pyx_t_5);
4048
4041
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4049
4042
  __pyx_t_6 = NULL;
@@ -4064,38 +4057,38 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4064
4057
  PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_kp_u__5};
4065
4058
  __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
4066
4059
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4067
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
4060
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
4068
4061
  __Pyx_GOTREF(__pyx_t_2);
4069
4062
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4070
4063
  }
4071
4064
  __pyx_v_mempath_parts = __pyx_t_2;
4072
4065
  __pyx_t_2 = 0;
4073
4066
 
4074
- /* "pyogrio/_vsi.pyx":169
4067
+ /* "pyogrio/_vsi.pyx":168
4075
4068
  * # Determine the top-level directory of the file
4076
4069
  * mempath_parts = path.split("/vsimem/")[1].split("/")
4077
4070
  * if len(mempath_parts) == 0: # <<<<<<<<<<<<<<
4078
4071
  * raise OSError("path to in-memory file or directory is required")
4079
4072
  *
4080
4073
  */
4081
- __pyx_t_3 = PyObject_Length(__pyx_v_mempath_parts); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 169, __pyx_L1_error)
4074
+ __pyx_t_3 = PyObject_Length(__pyx_v_mempath_parts); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 168, __pyx_L1_error)
4082
4075
  __pyx_t_1 = (__pyx_t_3 == 0);
4083
4076
  if (unlikely(__pyx_t_1)) {
4084
4077
 
4085
- /* "pyogrio/_vsi.pyx":170
4078
+ /* "pyogrio/_vsi.pyx":169
4086
4079
  * mempath_parts = path.split("/vsimem/")[1].split("/")
4087
4080
  * if len(mempath_parts) == 0:
4088
4081
  * raise OSError("path to in-memory file or directory is required") # <<<<<<<<<<<<<<
4089
4082
  *
4090
4083
  * toplevel_path = f"/vsimem/{mempath_parts[0]}"
4091
4084
  */
4092
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
4085
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
4093
4086
  __Pyx_GOTREF(__pyx_t_2);
4094
4087
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4095
4088
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4096
- __PYX_ERR(0, 170, __pyx_L1_error)
4089
+ __PYX_ERR(0, 169, __pyx_L1_error)
4097
4090
 
4098
- /* "pyogrio/_vsi.pyx":169
4091
+ /* "pyogrio/_vsi.pyx":168
4099
4092
  * # Determine the top-level directory of the file
4100
4093
  * mempath_parts = path.split("/vsimem/")[1].split("/")
4101
4094
  * if len(mempath_parts) == 0: # <<<<<<<<<<<<<<
@@ -4104,48 +4097,48 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4104
4097
  */
4105
4098
  }
4106
4099
 
4107
- /* "pyogrio/_vsi.pyx":172
4100
+ /* "pyogrio/_vsi.pyx":171
4108
4101
  * raise OSError("path to in-memory file or directory is required")
4109
4102
  *
4110
4103
  * toplevel_path = f"/vsimem/{mempath_parts[0]}" # <<<<<<<<<<<<<<
4111
4104
  *
4112
4105
  * if not VSIStatL(toplevel_path.encode("UTF-8"), &st_buf) == 0:
4113
4106
  */
4114
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mempath_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
4107
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mempath_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
4115
4108
  __Pyx_GOTREF(__pyx_t_2);
4116
- __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error)
4109
+ __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
4117
4110
  __Pyx_GOTREF(__pyx_t_5);
4118
4111
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4119
- __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsimem, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
4112
+ __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_vsimem, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
4120
4113
  __Pyx_GOTREF(__pyx_t_2);
4121
4114
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4122
4115
  __pyx_v_toplevel_path = ((PyObject*)__pyx_t_2);
4123
4116
  __pyx_t_2 = 0;
4124
4117
 
4125
- /* "pyogrio/_vsi.pyx":174
4118
+ /* "pyogrio/_vsi.pyx":173
4126
4119
  * toplevel_path = f"/vsimem/{mempath_parts[0]}"
4127
4120
  *
4128
4121
  * if not VSIStatL(toplevel_path.encode("UTF-8"), &st_buf) == 0: # <<<<<<<<<<<<<<
4129
4122
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4130
4123
  *
4131
4124
  */
4132
- __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
4125
+ __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
4133
4126
  __Pyx_GOTREF(__pyx_t_2);
4134
- __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error)
4127
+ __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L1_error)
4135
4128
  __pyx_t_1 = (!(VSIStatL(__pyx_t_8, (&__pyx_v_st_buf)) == 0));
4136
4129
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4137
4130
  if (unlikely(__pyx_t_1)) {
4138
4131
 
4139
- /* "pyogrio/_vsi.pyx":175
4132
+ /* "pyogrio/_vsi.pyx":174
4140
4133
  *
4141
4134
  * if not VSIStatL(toplevel_path.encode("UTF-8"), &st_buf) == 0:
4142
4135
  * raise FileNotFoundError(f"Path does not exist: '{path}'") # <<<<<<<<<<<<<<
4143
4136
  *
4144
4137
  * if VSI_ISDIR(st_buf.st_mode):
4145
4138
  */
4146
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
4139
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
4147
4140
  __Pyx_GOTREF(__pyx_t_2);
4148
- __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error)
4141
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
4149
4142
  __Pyx_GOTREF(__pyx_t_5);
4150
4143
  __pyx_t_3 = 0;
4151
4144
  __pyx_t_4 = 127;
@@ -4153,7 +4146,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4153
4146
  __pyx_t_3 += 22;
4154
4147
  __Pyx_GIVEREF(__pyx_kp_u_Path_does_not_exist);
4155
4148
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Path_does_not_exist);
4156
- __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error)
4149
+ __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error)
4157
4150
  __Pyx_GOTREF(__pyx_t_6);
4158
4151
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
4159
4152
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
@@ -4164,18 +4157,18 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4164
4157
  __pyx_t_3 += 1;
4165
4158
  __Pyx_GIVEREF(__pyx_kp_u__9);
4166
4159
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__9);
4167
- __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error)
4160
+ __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error)
4168
4161
  __Pyx_GOTREF(__pyx_t_6);
4169
4162
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4170
- __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error)
4163
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
4171
4164
  __Pyx_GOTREF(__pyx_t_5);
4172
4165
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4173
4166
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4174
4167
  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
4175
4168
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4176
- __PYX_ERR(0, 175, __pyx_L1_error)
4169
+ __PYX_ERR(0, 174, __pyx_L1_error)
4177
4170
 
4178
- /* "pyogrio/_vsi.pyx":174
4171
+ /* "pyogrio/_vsi.pyx":173
4179
4172
  * toplevel_path = f"/vsimem/{mempath_parts[0]}"
4180
4173
  *
4181
4174
  * if not VSIStatL(toplevel_path.encode("UTF-8"), &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -4184,7 +4177,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4184
4177
  */
4185
4178
  }
4186
4179
 
4187
- /* "pyogrio/_vsi.pyx":177
4180
+ /* "pyogrio/_vsi.pyx":176
4188
4181
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4189
4182
  *
4190
4183
  * if VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -4194,20 +4187,20 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4194
4187
  __pyx_t_1 = (VSI_ISDIR(__pyx_v_st_buf.st_mode) != 0);
4195
4188
  if (__pyx_t_1) {
4196
4189
 
4197
- /* "pyogrio/_vsi.pyx":178
4190
+ /* "pyogrio/_vsi.pyx":177
4198
4191
  *
4199
4192
  * if VSI_ISDIR(st_buf.st_mode):
4200
4193
  * errcode = VSIRmdirRecursive(toplevel_path.encode("UTF-8")) # <<<<<<<<<<<<<<
4201
4194
  * else:
4202
4195
  * errcode = VSIUnlink(toplevel_path.encode("UTF-8"))
4203
4196
  */
4204
- __pyx_t_5 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
4197
+ __pyx_t_5 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
4205
4198
  __Pyx_GOTREF(__pyx_t_5);
4206
- __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_t_5); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
4199
+ __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_t_5); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error)
4207
4200
  __pyx_v_errcode = VSIRmdirRecursive(__pyx_t_9);
4208
4201
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4209
4202
 
4210
- /* "pyogrio/_vsi.pyx":177
4203
+ /* "pyogrio/_vsi.pyx":176
4211
4204
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4212
4205
  *
4213
4206
  * if VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -4217,7 +4210,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4217
4210
  goto __pyx_L6;
4218
4211
  }
4219
4212
 
4220
- /* "pyogrio/_vsi.pyx":180
4213
+ /* "pyogrio/_vsi.pyx":179
4221
4214
  * errcode = VSIRmdirRecursive(toplevel_path.encode("UTF-8"))
4222
4215
  * else:
4223
4216
  * errcode = VSIUnlink(toplevel_path.encode("UTF-8")) # <<<<<<<<<<<<<<
@@ -4225,15 +4218,15 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4225
4218
  * if errcode != 0:
4226
4219
  */
4227
4220
  /*else*/ {
4228
- __pyx_t_5 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error)
4221
+ __pyx_t_5 = PyUnicode_AsUTF8String(__pyx_v_toplevel_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error)
4229
4222
  __Pyx_GOTREF(__pyx_t_5);
4230
- __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_t_5); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
4223
+ __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_t_5); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error)
4231
4224
  __pyx_v_errcode = VSIUnlink(__pyx_t_10);
4232
4225
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4233
4226
  }
4234
4227
  __pyx_L6:;
4235
4228
 
4236
- /* "pyogrio/_vsi.pyx":182
4229
+ /* "pyogrio/_vsi.pyx":181
4237
4230
  * errcode = VSIUnlink(toplevel_path.encode("UTF-8"))
4238
4231
  *
4239
4232
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -4243,14 +4236,14 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4243
4236
  __pyx_t_1 = (__pyx_v_errcode != 0);
4244
4237
  if (unlikely(__pyx_t_1)) {
4245
4238
 
4246
- /* "pyogrio/_vsi.pyx":183
4239
+ /* "pyogrio/_vsi.pyx":182
4247
4240
  *
4248
4241
  * if errcode != 0:
4249
4242
  * raise OSError(f"Error removing '{path}': {errcode=}") # <<<<<<<<<<<<<<
4250
4243
  *
4251
4244
  *
4252
4245
  */
4253
- __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error)
4246
+ __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
4254
4247
  __Pyx_GOTREF(__pyx_t_5);
4255
4248
  __pyx_t_3 = 0;
4256
4249
  __pyx_t_4 = 127;
@@ -4258,7 +4251,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4258
4251
  __pyx_t_3 += 16;
4259
4252
  __Pyx_GIVEREF(__pyx_kp_u_Error_removing);
4260
4253
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Error_removing);
4261
- __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
4254
+ __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error)
4262
4255
  __Pyx_GOTREF(__pyx_t_6);
4263
4256
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
4264
4257
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
@@ -4269,23 +4262,23 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4269
4262
  __pyx_t_3 += 11;
4270
4263
  __Pyx_GIVEREF(__pyx_kp_u_errcode);
4271
4264
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_errcode);
4272
- __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
4265
+ __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error)
4273
4266
  __Pyx_GOTREF(__pyx_t_6);
4274
4267
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
4275
4268
  __Pyx_GIVEREF(__pyx_t_6);
4276
4269
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6);
4277
4270
  __pyx_t_6 = 0;
4278
- __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
4271
+ __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error)
4279
4272
  __Pyx_GOTREF(__pyx_t_6);
4280
4273
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4281
- __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error)
4274
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
4282
4275
  __Pyx_GOTREF(__pyx_t_5);
4283
4276
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4284
4277
  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
4285
4278
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4286
- __PYX_ERR(0, 183, __pyx_L1_error)
4279
+ __PYX_ERR(0, 182, __pyx_L1_error)
4287
4280
 
4288
- /* "pyogrio/_vsi.pyx":182
4281
+ /* "pyogrio/_vsi.pyx":181
4289
4282
  * errcode = VSIUnlink(toplevel_path.encode("UTF-8"))
4290
4283
  *
4291
4284
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -4294,7 +4287,7 @@ static PyObject *__pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(PyObject *__pyx_v
4294
4287
  */
4295
4288
  }
4296
4289
 
4297
- /* "pyogrio/_vsi.pyx":138
4290
+ /* "pyogrio/_vsi.pyx":137
4298
4291
  *
4299
4292
  *
4300
4293
  * cpdef vsimem_rmtree_toplevel(str path): # <<<<<<<<<<<<<<
@@ -4373,12 +4366,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4373
4366
  (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
4374
4367
  kw_args--;
4375
4368
  }
4376
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error)
4369
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error)
4377
4370
  else goto __pyx_L5_argtuple_error;
4378
4371
  }
4379
4372
  if (unlikely(kw_args > 0)) {
4380
4373
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
4381
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vsimem_rmtree_toplevel") < 0)) __PYX_ERR(0, 138, __pyx_L3_error)
4374
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vsimem_rmtree_toplevel") < 0)) __PYX_ERR(0, 137, __pyx_L3_error)
4382
4375
  }
4383
4376
  } else if (unlikely(__pyx_nargs != 1)) {
4384
4377
  goto __pyx_L5_argtuple_error;
@@ -4389,7 +4382,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4389
4382
  }
4390
4383
  goto __pyx_L6_skip;
4391
4384
  __pyx_L5_argtuple_error:;
4392
- __Pyx_RaiseArgtupleInvalid("vsimem_rmtree_toplevel", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 138, __pyx_L3_error)
4385
+ __Pyx_RaiseArgtupleInvalid("vsimem_rmtree_toplevel", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 137, __pyx_L3_error)
4393
4386
  __pyx_L6_skip:;
4394
4387
  goto __pyx_L4_argument_unpacking_done;
4395
4388
  __pyx_L3_error:;
@@ -4403,7 +4396,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4403
4396
  __Pyx_RefNannyFinishContext();
4404
4397
  return NULL;
4405
4398
  __pyx_L4_argument_unpacking_done:;
4406
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 138, __pyx_L1_error)
4399
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 137, __pyx_L1_error)
4407
4400
  __pyx_r = __pyx_pf_7pyogrio_4_vsi_vsimem_rmtree_toplevel(__pyx_self, __pyx_v_path);
4408
4401
 
4409
4402
  /* function exit code */
@@ -4430,7 +4423,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_vsimem_rmtree_toplevel(CYTHON_UNUSED Py
4430
4423
  int __pyx_clineno = 0;
4431
4424
  __Pyx_RefNannySetupContext("vsimem_rmtree_toplevel", 1);
4432
4425
  __Pyx_XDECREF(__pyx_r);
4433
- __pyx_t_1 = __pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(__pyx_v_path, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
4426
+ __pyx_t_1 = __pyx_f_7pyogrio_4_vsi_vsimem_rmtree_toplevel(__pyx_v_path, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
4434
4427
  __Pyx_GOTREF(__pyx_t_1);
4435
4428
  __pyx_r = __pyx_t_1;
4436
4429
  __pyx_t_1 = 0;
@@ -4447,7 +4440,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_vsimem_rmtree_toplevel(CYTHON_UNUSED Py
4447
4440
  return __pyx_r;
4448
4441
  }
4449
4442
 
4450
- /* "pyogrio/_vsi.pyx":186
4443
+ /* "pyogrio/_vsi.pyx":185
4451
4444
  *
4452
4445
  *
4453
4446
  * def ogr_vsi_listtree(str path, str pattern): # <<<<<<<<<<<<<<
@@ -4512,7 +4505,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4512
4505
  (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
4513
4506
  kw_args--;
4514
4507
  }
4515
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L3_error)
4508
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error)
4516
4509
  else goto __pyx_L5_argtuple_error;
4517
4510
  CYTHON_FALLTHROUGH;
4518
4511
  case 1:
@@ -4520,14 +4513,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4520
4513
  (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
4521
4514
  kw_args--;
4522
4515
  }
4523
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L3_error)
4516
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error)
4524
4517
  else {
4525
- __Pyx_RaiseArgtupleInvalid("ogr_vsi_listtree", 1, 2, 2, 1); __PYX_ERR(0, 186, __pyx_L3_error)
4518
+ __Pyx_RaiseArgtupleInvalid("ogr_vsi_listtree", 1, 2, 2, 1); __PYX_ERR(0, 185, __pyx_L3_error)
4526
4519
  }
4527
4520
  }
4528
4521
  if (unlikely(kw_args > 0)) {
4529
4522
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
4530
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_listtree") < 0)) __PYX_ERR(0, 186, __pyx_L3_error)
4523
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_listtree") < 0)) __PYX_ERR(0, 185, __pyx_L3_error)
4531
4524
  }
4532
4525
  } else if (unlikely(__pyx_nargs != 2)) {
4533
4526
  goto __pyx_L5_argtuple_error;
@@ -4540,7 +4533,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4540
4533
  }
4541
4534
  goto __pyx_L6_skip;
4542
4535
  __pyx_L5_argtuple_error:;
4543
- __Pyx_RaiseArgtupleInvalid("ogr_vsi_listtree", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 186, __pyx_L3_error)
4536
+ __Pyx_RaiseArgtupleInvalid("ogr_vsi_listtree", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 185, __pyx_L3_error)
4544
4537
  __pyx_L6_skip:;
4545
4538
  goto __pyx_L4_argument_unpacking_done;
4546
4539
  __pyx_L3_error:;
@@ -4554,8 +4547,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
4554
4547
  __Pyx_RefNannyFinishContext();
4555
4548
  return NULL;
4556
4549
  __pyx_L4_argument_unpacking_done:;
4557
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 186, __pyx_L1_error)
4558
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), (&PyUnicode_Type), 1, "pattern", 1))) __PYX_ERR(0, 186, __pyx_L1_error)
4550
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 185, __pyx_L1_error)
4551
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), (&PyUnicode_Type), 1, "pattern", 1))) __PYX_ERR(0, 185, __pyx_L1_error)
4559
4552
  __pyx_r = __pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(__pyx_self, __pyx_v_path, __pyx_v_pattern);
4560
4553
 
4561
4554
  /* function exit code */
@@ -4614,7 +4607,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4614
4607
  __Pyx_RefNannySetupContext("ogr_vsi_listtree", 0);
4615
4608
  __Pyx_INCREF(__pyx_v_path);
4616
4609
 
4617
- /* "pyogrio/_vsi.pyx":205
4610
+ /* "pyogrio/_vsi.pyx":204
4618
4611
  * cdef VSIStatBufL st_buf
4619
4612
  *
4620
4613
  * path_b = path.encode("UTF-8") # <<<<<<<<<<<<<<
@@ -4623,24 +4616,24 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4623
4616
  */
4624
4617
  if (unlikely(__pyx_v_path == Py_None)) {
4625
4618
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
4626
- __PYX_ERR(0, 205, __pyx_L1_error)
4619
+ __PYX_ERR(0, 204, __pyx_L1_error)
4627
4620
  }
4628
- __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
4621
+ __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
4629
4622
  __Pyx_GOTREF(__pyx_t_1);
4630
4623
  __pyx_v_path_b = __pyx_t_1;
4631
4624
  __pyx_t_1 = 0;
4632
4625
 
4633
- /* "pyogrio/_vsi.pyx":206
4626
+ /* "pyogrio/_vsi.pyx":205
4634
4627
  *
4635
4628
  * path_b = path.encode("UTF-8")
4636
4629
  * path_c = path_b # <<<<<<<<<<<<<<
4637
4630
  *
4638
4631
  * if not VSIStatL(path_c, &st_buf) == 0:
4639
4632
  */
4640
- __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error)
4633
+ __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error)
4641
4634
  __pyx_v_path_c = __pyx_t_2;
4642
4635
 
4643
- /* "pyogrio/_vsi.pyx":208
4636
+ /* "pyogrio/_vsi.pyx":207
4644
4637
  * path_c = path_b
4645
4638
  *
4646
4639
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -4650,16 +4643,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4650
4643
  __pyx_t_3 = (!(VSIStatL(__pyx_v_path_c, (&__pyx_v_st_buf)) == 0));
4651
4644
  if (unlikely(__pyx_t_3)) {
4652
4645
 
4653
- /* "pyogrio/_vsi.pyx":209
4646
+ /* "pyogrio/_vsi.pyx":208
4654
4647
  *
4655
4648
  * if not VSIStatL(path_c, &st_buf) == 0:
4656
4649
  * raise FileNotFoundError(f"Path does not exist: '{path}'") # <<<<<<<<<<<<<<
4657
4650
  * if not VSI_ISDIR(st_buf.st_mode):
4658
4651
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
4659
4652
  */
4660
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
4653
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
4661
4654
  __Pyx_GOTREF(__pyx_t_1);
4662
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
4655
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error)
4663
4656
  __Pyx_GOTREF(__pyx_t_4);
4664
4657
  __pyx_t_5 = 0;
4665
4658
  __pyx_t_6 = 127;
@@ -4667,7 +4660,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4667
4660
  __pyx_t_5 += 22;
4668
4661
  __Pyx_GIVEREF(__pyx_kp_u_Path_does_not_exist);
4669
4662
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Path_does_not_exist);
4670
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error)
4663
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error)
4671
4664
  __Pyx_GOTREF(__pyx_t_7);
4672
4665
  __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
4673
4666
  __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
@@ -4678,18 +4671,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4678
4671
  __pyx_t_5 += 1;
4679
4672
  __Pyx_GIVEREF(__pyx_kp_u__9);
4680
4673
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__9);
4681
- __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error)
4674
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error)
4682
4675
  __Pyx_GOTREF(__pyx_t_7);
4683
4676
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4684
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
4677
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error)
4685
4678
  __Pyx_GOTREF(__pyx_t_4);
4686
4679
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4687
4680
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4688
4681
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4689
4682
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4690
- __PYX_ERR(0, 209, __pyx_L1_error)
4683
+ __PYX_ERR(0, 208, __pyx_L1_error)
4691
4684
 
4692
- /* "pyogrio/_vsi.pyx":208
4685
+ /* "pyogrio/_vsi.pyx":207
4693
4686
  * path_c = path_b
4694
4687
  *
4695
4688
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -4698,7 +4691,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4698
4691
  */
4699
4692
  }
4700
4693
 
4701
- /* "pyogrio/_vsi.pyx":210
4694
+ /* "pyogrio/_vsi.pyx":209
4702
4695
  * if not VSIStatL(path_c, &st_buf) == 0:
4703
4696
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4704
4697
  * if not VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -4708,16 +4701,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4708
4701
  __pyx_t_3 = (!(VSI_ISDIR(__pyx_v_st_buf.st_mode) != 0));
4709
4702
  if (unlikely(__pyx_t_3)) {
4710
4703
 
4711
- /* "pyogrio/_vsi.pyx":211
4704
+ /* "pyogrio/_vsi.pyx":210
4712
4705
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4713
4706
  * if not VSI_ISDIR(st_buf.st_mode):
4714
4707
  * raise NotADirectoryError(f"Path is not a directory: '{path}'") # <<<<<<<<<<<<<<
4715
4708
  *
4716
4709
  * try:
4717
4710
  */
4718
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_NotADirectoryError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error)
4711
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_NotADirectoryError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
4719
4712
  __Pyx_GOTREF(__pyx_t_4);
4720
- __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
4713
+ __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L1_error)
4721
4714
  __Pyx_GOTREF(__pyx_t_7);
4722
4715
  __pyx_t_5 = 0;
4723
4716
  __pyx_t_6 = 127;
@@ -4725,7 +4718,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4725
4718
  __pyx_t_5 += 26;
4726
4719
  __Pyx_GIVEREF(__pyx_kp_u_Path_is_not_a_directory);
4727
4720
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_Path_is_not_a_directory);
4728
- __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
4721
+ __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
4729
4722
  __Pyx_GOTREF(__pyx_t_1);
4730
4723
  __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
4731
4724
  __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
@@ -4736,18 +4729,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4736
4729
  __pyx_t_5 += 1;
4737
4730
  __Pyx_GIVEREF(__pyx_kp_u__9);
4738
4731
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__9);
4739
- __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
4732
+ __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
4740
4733
  __Pyx_GOTREF(__pyx_t_1);
4741
4734
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4742
- __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
4735
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L1_error)
4743
4736
  __Pyx_GOTREF(__pyx_t_7);
4744
4737
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4745
4738
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4746
4739
  __Pyx_Raise(__pyx_t_7, 0, 0, 0);
4747
4740
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4748
- __PYX_ERR(0, 211, __pyx_L1_error)
4741
+ __PYX_ERR(0, 210, __pyx_L1_error)
4749
4742
 
4750
- /* "pyogrio/_vsi.pyx":210
4743
+ /* "pyogrio/_vsi.pyx":209
4751
4744
  * if not VSIStatL(path_c, &st_buf) == 0:
4752
4745
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
4753
4746
  * if not VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -4756,7 +4749,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4756
4749
  */
4757
4750
  }
4758
4751
 
4759
- /* "pyogrio/_vsi.pyx":213
4752
+ /* "pyogrio/_vsi.pyx":212
4760
4753
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
4761
4754
  *
4762
4755
  * try: # <<<<<<<<<<<<<<
@@ -4765,7 +4758,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4765
4758
  */
4766
4759
  /*try:*/ {
4767
4760
 
4768
- /* "pyogrio/_vsi.pyx":214
4761
+ /* "pyogrio/_vsi.pyx":213
4769
4762
  *
4770
4763
  * try:
4771
4764
  * papszFiles = VSIReadDirRecursive(path_c) # <<<<<<<<<<<<<<
@@ -4774,7 +4767,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4774
4767
  */
4775
4768
  __pyx_v_papszFiles = VSIReadDirRecursive(__pyx_v_path_c);
4776
4769
 
4777
- /* "pyogrio/_vsi.pyx":215
4770
+ /* "pyogrio/_vsi.pyx":214
4778
4771
  * try:
4779
4772
  * papszFiles = VSIReadDirRecursive(path_c)
4780
4773
  * n = CSLCount(<CSLConstList>papszFiles) # <<<<<<<<<<<<<<
@@ -4783,19 +4776,19 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4783
4776
  */
4784
4777
  __pyx_v_n = CSLCount(((CSLConstList)__pyx_v_papszFiles));
4785
4778
 
4786
- /* "pyogrio/_vsi.pyx":216
4779
+ /* "pyogrio/_vsi.pyx":215
4787
4780
  * papszFiles = VSIReadDirRecursive(path_c)
4788
4781
  * n = CSLCount(<CSLConstList>papszFiles)
4789
4782
  * files = [] # <<<<<<<<<<<<<<
4790
4783
  * for i in range(n):
4791
4784
  * files.append(papszFiles[i].decode("UTF-8"))
4792
4785
  */
4793
- __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L6_error)
4786
+ __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L6_error)
4794
4787
  __Pyx_GOTREF(__pyx_t_7);
4795
4788
  __pyx_v_files = __pyx_t_7;
4796
4789
  __pyx_t_7 = 0;
4797
4790
 
4798
- /* "pyogrio/_vsi.pyx":217
4791
+ /* "pyogrio/_vsi.pyx":216
4799
4792
  * n = CSLCount(<CSLConstList>papszFiles)
4800
4793
  * files = []
4801
4794
  * for i in range(n): # <<<<<<<<<<<<<<
@@ -4807,7 +4800,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4807
4800
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
4808
4801
  __pyx_v_i = __pyx_t_10;
4809
4802
 
4810
- /* "pyogrio/_vsi.pyx":218
4803
+ /* "pyogrio/_vsi.pyx":217
4811
4804
  * files = []
4812
4805
  * for i in range(n):
4813
4806
  * files.append(papszFiles[i].decode("UTF-8")) # <<<<<<<<<<<<<<
@@ -4815,15 +4808,15 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4815
4808
  * CSLDestroy(papszFiles)
4816
4809
  */
4817
4810
  __pyx_t_11 = (__pyx_v_papszFiles[__pyx_v_i]);
4818
- __pyx_t_5 = __Pyx_ssize_strlen(__pyx_t_11); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 218, __pyx_L6_error)
4819
- __pyx_t_7 = __Pyx_decode_c_string(__pyx_t_11, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L6_error)
4811
+ __pyx_t_5 = __Pyx_ssize_strlen(__pyx_t_11); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 217, __pyx_L6_error)
4812
+ __pyx_t_7 = __Pyx_decode_c_string(__pyx_t_11, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L6_error)
4820
4813
  __Pyx_GOTREF(__pyx_t_7);
4821
- __pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_files, __pyx_t_7); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L6_error)
4814
+ __pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_files, __pyx_t_7); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 217, __pyx_L6_error)
4822
4815
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4823
4816
  }
4824
4817
  }
4825
4818
 
4826
- /* "pyogrio/_vsi.pyx":220
4819
+ /* "pyogrio/_vsi.pyx":219
4827
4820
  * files.append(papszFiles[i].decode("UTF-8"))
4828
4821
  * finally:
4829
4822
  * CSLDestroy(papszFiles) # <<<<<<<<<<<<<<
@@ -4872,7 +4865,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4872
4865
  __pyx_L7:;
4873
4866
  }
4874
4867
 
4875
- /* "pyogrio/_vsi.pyx":223
4868
+ /* "pyogrio/_vsi.pyx":222
4876
4869
  *
4877
4870
  * # Apply filter pattern
4878
4871
  * if pattern is not None: # <<<<<<<<<<<<<<
@@ -4882,16 +4875,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4882
4875
  __pyx_t_3 = (__pyx_v_pattern != ((PyObject*)Py_None));
4883
4876
  if (__pyx_t_3) {
4884
4877
 
4885
- /* "pyogrio/_vsi.pyx":224
4878
+ /* "pyogrio/_vsi.pyx":223
4886
4879
  * # Apply filter pattern
4887
4880
  * if pattern is not None:
4888
4881
  * files = fnmatch.filter(files, pattern) # <<<<<<<<<<<<<<
4889
4882
  *
4890
4883
  * # Prepend files with the base path
4891
4884
  */
4892
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fnmatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
4885
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fnmatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
4893
4886
  __Pyx_GOTREF(__pyx_t_1);
4894
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
4887
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
4895
4888
  __Pyx_GOTREF(__pyx_t_4);
4896
4889
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4897
4890
  __pyx_t_1 = NULL;
@@ -4912,14 +4905,14 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4912
4905
  PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_files, __pyx_v_pattern};
4913
4906
  __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_20, 2+__pyx_t_20);
4914
4907
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4915
- if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
4908
+ if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __pyx_L1_error)
4916
4909
  __Pyx_GOTREF(__pyx_t_7);
4917
4910
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4918
4911
  }
4919
4912
  __Pyx_DECREF_SET(__pyx_v_files, __pyx_t_7);
4920
4913
  __pyx_t_7 = 0;
4921
4914
 
4922
- /* "pyogrio/_vsi.pyx":223
4915
+ /* "pyogrio/_vsi.pyx":222
4923
4916
  *
4924
4917
  * # Apply filter pattern
4925
4918
  * if pattern is not None: # <<<<<<<<<<<<<<
@@ -4928,7 +4921,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4928
4921
  */
4929
4922
  }
4930
4923
 
4931
- /* "pyogrio/_vsi.pyx":227
4924
+ /* "pyogrio/_vsi.pyx":226
4932
4925
  *
4933
4926
  * # Prepend files with the base path
4934
4927
  * if not path.endswith("/"): # <<<<<<<<<<<<<<
@@ -4937,28 +4930,28 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4937
4930
  */
4938
4931
  if (unlikely(__pyx_v_path == Py_None)) {
4939
4932
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
4940
- __PYX_ERR(0, 227, __pyx_L1_error)
4933
+ __PYX_ERR(0, 226, __pyx_L1_error)
4941
4934
  }
4942
- __pyx_t_3 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u__5, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 227, __pyx_L1_error)
4935
+ __pyx_t_3 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u__5, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 226, __pyx_L1_error)
4943
4936
  __pyx_t_21 = (!__pyx_t_3);
4944
4937
  if (__pyx_t_21) {
4945
4938
 
4946
- /* "pyogrio/_vsi.pyx":228
4939
+ /* "pyogrio/_vsi.pyx":227
4947
4940
  * # Prepend files with the base path
4948
4941
  * if not path.endswith("/"):
4949
4942
  * path = f"{path}/" # <<<<<<<<<<<<<<
4950
4943
  * files = [f"{path}{file}" for file in files]
4951
4944
  *
4952
4945
  */
4953
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L1_error)
4946
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error)
4954
4947
  __Pyx_GOTREF(__pyx_t_7);
4955
- __pyx_t_4 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u__5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
4948
+ __pyx_t_4 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u__5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
4956
4949
  __Pyx_GOTREF(__pyx_t_4);
4957
4950
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4958
4951
  __Pyx_DECREF_SET(__pyx_v_path, ((PyObject*)__pyx_t_4));
4959
4952
  __pyx_t_4 = 0;
4960
4953
 
4961
- /* "pyogrio/_vsi.pyx":227
4954
+ /* "pyogrio/_vsi.pyx":226
4962
4955
  *
4963
4956
  * # Prepend files with the base path
4964
4957
  * if not path.endswith("/"): # <<<<<<<<<<<<<<
@@ -4967,7 +4960,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4967
4960
  */
4968
4961
  }
4969
4962
 
4970
- /* "pyogrio/_vsi.pyx":229
4963
+ /* "pyogrio/_vsi.pyx":228
4971
4964
  * if not path.endswith("/"):
4972
4965
  * path = f"{path}/"
4973
4966
  * files = [f"{path}{file}" for file in files] # <<<<<<<<<<<<<<
@@ -4975,16 +4968,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4975
4968
  * return files
4976
4969
  */
4977
4970
  { /* enter inner scope */
4978
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L16_error)
4971
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L16_error)
4979
4972
  __Pyx_GOTREF(__pyx_t_4);
4980
4973
  if (likely(PyList_CheckExact(__pyx_v_files)) || PyTuple_CheckExact(__pyx_v_files)) {
4981
4974
  __pyx_t_7 = __pyx_v_files; __Pyx_INCREF(__pyx_t_7);
4982
4975
  __pyx_t_5 = 0;
4983
4976
  __pyx_t_22 = NULL;
4984
4977
  } else {
4985
- __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_files); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L16_error)
4978
+ __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_files); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L16_error)
4986
4979
  __Pyx_GOTREF(__pyx_t_7);
4987
- __pyx_t_22 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 229, __pyx_L16_error)
4980
+ __pyx_t_22 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 228, __pyx_L16_error)
4988
4981
  }
4989
4982
  for (;;) {
4990
4983
  if (likely(!__pyx_t_22)) {
@@ -4992,28 +4985,28 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
4992
4985
  {
4993
4986
  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
4994
4987
  #if !CYTHON_ASSUME_SAFE_MACROS
4995
- if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 229, __pyx_L16_error)
4988
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 228, __pyx_L16_error)
4996
4989
  #endif
4997
4990
  if (__pyx_t_5 >= __pyx_temp) break;
4998
4991
  }
4999
4992
  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5000
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 229, __pyx_L16_error)
4993
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 228, __pyx_L16_error)
5001
4994
  #else
5002
- __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L16_error)
4995
+ __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L16_error)
5003
4996
  __Pyx_GOTREF(__pyx_t_1);
5004
4997
  #endif
5005
4998
  } else {
5006
4999
  {
5007
5000
  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
5008
5001
  #if !CYTHON_ASSUME_SAFE_MACROS
5009
- if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 229, __pyx_L16_error)
5002
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 228, __pyx_L16_error)
5010
5003
  #endif
5011
5004
  if (__pyx_t_5 >= __pyx_temp) break;
5012
5005
  }
5013
5006
  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5014
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 229, __pyx_L16_error)
5007
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 228, __pyx_L16_error)
5015
5008
  #else
5016
- __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L16_error)
5009
+ __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L16_error)
5017
5010
  __Pyx_GOTREF(__pyx_t_1);
5018
5011
  #endif
5019
5012
  }
@@ -5023,7 +5016,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
5023
5016
  PyObject* exc_type = PyErr_Occurred();
5024
5017
  if (exc_type) {
5025
5018
  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5026
- else __PYX_ERR(0, 229, __pyx_L16_error)
5019
+ else __PYX_ERR(0, 228, __pyx_L16_error)
5027
5020
  }
5028
5021
  break;
5029
5022
  }
@@ -5031,15 +5024,15 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
5031
5024
  }
5032
5025
  __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_file, __pyx_t_1);
5033
5026
  __pyx_t_1 = 0;
5034
- __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L16_error)
5027
+ __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L16_error)
5035
5028
  __Pyx_GOTREF(__pyx_t_1);
5036
- __pyx_t_23 = __Pyx_PyObject_FormatSimple(__pyx_7genexpr__pyx_v_file, __pyx_empty_unicode); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 229, __pyx_L16_error)
5029
+ __pyx_t_23 = __Pyx_PyObject_FormatSimple(__pyx_7genexpr__pyx_v_file, __pyx_empty_unicode); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 228, __pyx_L16_error)
5037
5030
  __Pyx_GOTREF(__pyx_t_23);
5038
- __pyx_t_24 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 229, __pyx_L16_error)
5031
+ __pyx_t_24 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 228, __pyx_L16_error)
5039
5032
  __Pyx_GOTREF(__pyx_t_24);
5040
5033
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5041
5034
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
5042
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_24))) __PYX_ERR(0, 229, __pyx_L16_error)
5035
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_24))) __PYX_ERR(0, 228, __pyx_L16_error)
5043
5036
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
5044
5037
  }
5045
5038
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -5053,7 +5046,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
5053
5046
  __Pyx_DECREF_SET(__pyx_v_files, __pyx_t_4);
5054
5047
  __pyx_t_4 = 0;
5055
5048
 
5056
- /* "pyogrio/_vsi.pyx":231
5049
+ /* "pyogrio/_vsi.pyx":230
5057
5050
  * files = [f"{path}{file}" for file in files]
5058
5051
  *
5059
5052
  * return files # <<<<<<<<<<<<<<
@@ -5065,7 +5058,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
5065
5058
  __pyx_r = __pyx_v_files;
5066
5059
  goto __pyx_L0;
5067
5060
 
5068
- /* "pyogrio/_vsi.pyx":186
5061
+ /* "pyogrio/_vsi.pyx":185
5069
5062
  *
5070
5063
  *
5071
5064
  * def ogr_vsi_listtree(str path, str pattern): # <<<<<<<<<<<<<<
@@ -5092,7 +5085,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_2ogr_vsi_listtree(CYTHON_UNUSED PyObjec
5092
5085
  return __pyx_r;
5093
5086
  }
5094
5087
 
5095
- /* "pyogrio/_vsi.pyx":234
5088
+ /* "pyogrio/_vsi.pyx":233
5096
5089
  *
5097
5090
  *
5098
5091
  * def ogr_vsi_rmtree(str path): # <<<<<<<<<<<<<<
@@ -5154,12 +5147,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5154
5147
  (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
5155
5148
  kw_args--;
5156
5149
  }
5157
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error)
5150
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L3_error)
5158
5151
  else goto __pyx_L5_argtuple_error;
5159
5152
  }
5160
5153
  if (unlikely(kw_args > 0)) {
5161
5154
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
5162
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_rmtree") < 0)) __PYX_ERR(0, 234, __pyx_L3_error)
5155
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_rmtree") < 0)) __PYX_ERR(0, 233, __pyx_L3_error)
5163
5156
  }
5164
5157
  } else if (unlikely(__pyx_nargs != 1)) {
5165
5158
  goto __pyx_L5_argtuple_error;
@@ -5170,7 +5163,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5170
5163
  }
5171
5164
  goto __pyx_L6_skip;
5172
5165
  __pyx_L5_argtuple_error:;
5173
- __Pyx_RaiseArgtupleInvalid("ogr_vsi_rmtree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 234, __pyx_L3_error)
5166
+ __Pyx_RaiseArgtupleInvalid("ogr_vsi_rmtree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 233, __pyx_L3_error)
5174
5167
  __pyx_L6_skip:;
5175
5168
  goto __pyx_L4_argument_unpacking_done;
5176
5169
  __pyx_L3_error:;
@@ -5184,7 +5177,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5184
5177
  __Pyx_RefNannyFinishContext();
5185
5178
  return NULL;
5186
5179
  __pyx_L4_argument_unpacking_done:;
5187
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 234, __pyx_L1_error)
5180
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 233, __pyx_L1_error)
5188
5181
  __pyx_r = __pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(__pyx_self, __pyx_v_path);
5189
5182
 
5190
5183
  /* function exit code */
@@ -5226,7 +5219,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5226
5219
  int __pyx_clineno = 0;
5227
5220
  __Pyx_RefNannySetupContext("ogr_vsi_rmtree", 1);
5228
5221
 
5229
- /* "pyogrio/_vsi.pyx":246
5222
+ /* "pyogrio/_vsi.pyx":245
5230
5223
  * cdef VSIStatBufL st_buf
5231
5224
  *
5232
5225
  * try: # <<<<<<<<<<<<<<
@@ -5242,7 +5235,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5242
5235
  __Pyx_XGOTREF(__pyx_t_3);
5243
5236
  /*try:*/ {
5244
5237
 
5245
- /* "pyogrio/_vsi.pyx":247
5238
+ /* "pyogrio/_vsi.pyx":246
5246
5239
  *
5247
5240
  * try:
5248
5241
  * path_b = path.encode("UTF-8") # <<<<<<<<<<<<<<
@@ -5251,14 +5244,14 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5251
5244
  */
5252
5245
  if (unlikely(__pyx_v_path == Py_None)) {
5253
5246
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
5254
- __PYX_ERR(0, 247, __pyx_L3_error)
5247
+ __PYX_ERR(0, 246, __pyx_L3_error)
5255
5248
  }
5256
- __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L3_error)
5249
+ __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L3_error)
5257
5250
  __Pyx_GOTREF(__pyx_t_4);
5258
5251
  __pyx_v_path_b = __pyx_t_4;
5259
5252
  __pyx_t_4 = 0;
5260
5253
 
5261
- /* "pyogrio/_vsi.pyx":246
5254
+ /* "pyogrio/_vsi.pyx":245
5262
5255
  * cdef VSIStatBufL st_buf
5263
5256
  *
5264
5257
  * try: # <<<<<<<<<<<<<<
@@ -5273,7 +5266,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5273
5266
  __pyx_L3_error:;
5274
5267
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5275
5268
 
5276
- /* "pyogrio/_vsi.pyx":248
5269
+ /* "pyogrio/_vsi.pyx":247
5277
5270
  * try:
5278
5271
  * path_b = path.encode("UTF-8")
5279
5272
  * except UnicodeDecodeError: # <<<<<<<<<<<<<<
@@ -5283,12 +5276,12 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5283
5276
  __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
5284
5277
  if (__pyx_t_5) {
5285
5278
  __Pyx_AddTraceback("pyogrio._vsi.ogr_vsi_rmtree", __pyx_clineno, __pyx_lineno, __pyx_filename);
5286
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 248, __pyx_L5_except_error)
5279
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 247, __pyx_L5_except_error)
5287
5280
  __Pyx_XGOTREF(__pyx_t_4);
5288
5281
  __Pyx_XGOTREF(__pyx_t_6);
5289
5282
  __Pyx_XGOTREF(__pyx_t_7);
5290
5283
 
5291
- /* "pyogrio/_vsi.pyx":249
5284
+ /* "pyogrio/_vsi.pyx":248
5292
5285
  * path_b = path.encode("UTF-8")
5293
5286
  * except UnicodeDecodeError:
5294
5287
  * path_b = path # <<<<<<<<<<<<<<
@@ -5304,7 +5297,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5304
5297
  }
5305
5298
  goto __pyx_L5_except_error;
5306
5299
 
5307
- /* "pyogrio/_vsi.pyx":246
5300
+ /* "pyogrio/_vsi.pyx":245
5308
5301
  * cdef VSIStatBufL st_buf
5309
5302
  *
5310
5303
  * try: # <<<<<<<<<<<<<<
@@ -5325,17 +5318,17 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5325
5318
  __pyx_L8_try_end:;
5326
5319
  }
5327
5320
 
5328
- /* "pyogrio/_vsi.pyx":250
5321
+ /* "pyogrio/_vsi.pyx":249
5329
5322
  * except UnicodeDecodeError:
5330
5323
  * path_b = path
5331
5324
  * path_c = path_b # <<<<<<<<<<<<<<
5332
5325
  * if not VSIStatL(path_c, &st_buf) == 0:
5333
5326
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5334
5327
  */
5335
- __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
5328
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error)
5336
5329
  __pyx_v_path_c = __pyx_t_8;
5337
5330
 
5338
- /* "pyogrio/_vsi.pyx":251
5331
+ /* "pyogrio/_vsi.pyx":250
5339
5332
  * path_b = path
5340
5333
  * path_c = path_b
5341
5334
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -5345,16 +5338,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5345
5338
  __pyx_t_9 = (!(VSIStatL(__pyx_v_path_c, (&__pyx_v_st_buf)) == 0));
5346
5339
  if (unlikely(__pyx_t_9)) {
5347
5340
 
5348
- /* "pyogrio/_vsi.pyx":252
5341
+ /* "pyogrio/_vsi.pyx":251
5349
5342
  * path_c = path_b
5350
5343
  * if not VSIStatL(path_c, &st_buf) == 0:
5351
5344
  * raise FileNotFoundError(f"Path does not exist: '{path}'") # <<<<<<<<<<<<<<
5352
5345
  * if not VSI_ISDIR(st_buf.st_mode):
5353
5346
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
5354
5347
  */
5355
- __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error)
5348
+ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
5356
5349
  __Pyx_GOTREF(__pyx_t_7);
5357
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error)
5350
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error)
5358
5351
  __Pyx_GOTREF(__pyx_t_6);
5359
5352
  __pyx_t_10 = 0;
5360
5353
  __pyx_t_11 = 127;
@@ -5362,7 +5355,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5362
5355
  __pyx_t_10 += 22;
5363
5356
  __Pyx_GIVEREF(__pyx_kp_u_Path_does_not_exist);
5364
5357
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Path_does_not_exist);
5365
- __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __pyx_L1_error)
5358
+ __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
5366
5359
  __Pyx_GOTREF(__pyx_t_4);
5367
5360
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
5368
5361
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
@@ -5373,18 +5366,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5373
5366
  __pyx_t_10 += 1;
5374
5367
  __Pyx_GIVEREF(__pyx_kp_u__9);
5375
5368
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__9);
5376
- __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __pyx_L1_error)
5369
+ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
5377
5370
  __Pyx_GOTREF(__pyx_t_4);
5378
5371
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5379
- __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error)
5372
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error)
5380
5373
  __Pyx_GOTREF(__pyx_t_6);
5381
5374
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5382
5375
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5383
5376
  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
5384
5377
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5385
- __PYX_ERR(0, 252, __pyx_L1_error)
5378
+ __PYX_ERR(0, 251, __pyx_L1_error)
5386
5379
 
5387
- /* "pyogrio/_vsi.pyx":251
5380
+ /* "pyogrio/_vsi.pyx":250
5388
5381
  * path_b = path
5389
5382
  * path_c = path_b
5390
5383
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -5393,7 +5386,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5393
5386
  */
5394
5387
  }
5395
5388
 
5396
- /* "pyogrio/_vsi.pyx":253
5389
+ /* "pyogrio/_vsi.pyx":252
5397
5390
  * if not VSIStatL(path_c, &st_buf) == 0:
5398
5391
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5399
5392
  * if not VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -5403,16 +5396,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5403
5396
  __pyx_t_9 = (!(VSI_ISDIR(__pyx_v_st_buf.st_mode) != 0));
5404
5397
  if (unlikely(__pyx_t_9)) {
5405
5398
 
5406
- /* "pyogrio/_vsi.pyx":254
5399
+ /* "pyogrio/_vsi.pyx":253
5407
5400
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5408
5401
  * if not VSI_ISDIR(st_buf.st_mode):
5409
5402
  * raise NotADirectoryError(f"Path is not a directory: '{path}'") # <<<<<<<<<<<<<<
5410
5403
  * if path.endswith("/vsimem") or path.endswith("/vsimem/"):
5411
5404
  * raise OSError("path to in-memory file or directory is required")
5412
5405
  */
5413
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_NotADirectoryError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error)
5406
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_NotADirectoryError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
5414
5407
  __Pyx_GOTREF(__pyx_t_6);
5415
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
5408
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
5416
5409
  __Pyx_GOTREF(__pyx_t_4);
5417
5410
  __pyx_t_10 = 0;
5418
5411
  __pyx_t_11 = 127;
@@ -5420,7 +5413,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5420
5413
  __pyx_t_10 += 26;
5421
5414
  __Pyx_GIVEREF(__pyx_kp_u_Path_is_not_a_directory);
5422
5415
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Path_is_not_a_directory);
5423
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error)
5416
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error)
5424
5417
  __Pyx_GOTREF(__pyx_t_7);
5425
5418
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_11;
5426
5419
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
@@ -5431,18 +5424,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5431
5424
  __pyx_t_10 += 1;
5432
5425
  __Pyx_GIVEREF(__pyx_kp_u__9);
5433
5426
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__9);
5434
- __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error)
5427
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error)
5435
5428
  __Pyx_GOTREF(__pyx_t_7);
5436
5429
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5437
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
5430
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
5438
5431
  __Pyx_GOTREF(__pyx_t_4);
5439
5432
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5440
5433
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5441
5434
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5442
5435
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5443
- __PYX_ERR(0, 254, __pyx_L1_error)
5436
+ __PYX_ERR(0, 253, __pyx_L1_error)
5444
5437
 
5445
- /* "pyogrio/_vsi.pyx":253
5438
+ /* "pyogrio/_vsi.pyx":252
5446
5439
  * if not VSIStatL(path_c, &st_buf) == 0:
5447
5440
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5448
5441
  * if not VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -5451,7 +5444,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5451
5444
  */
5452
5445
  }
5453
5446
 
5454
- /* "pyogrio/_vsi.pyx":255
5447
+ /* "pyogrio/_vsi.pyx":254
5455
5448
  * if not VSI_ISDIR(st_buf.st_mode):
5456
5449
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
5457
5450
  * if path.endswith("/vsimem") or path.endswith("/vsimem/"): # <<<<<<<<<<<<<<
@@ -5460,9 +5453,9 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5460
5453
  */
5461
5454
  if (unlikely(__pyx_v_path == Py_None)) {
5462
5455
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
5463
- __PYX_ERR(0, 255, __pyx_L1_error)
5456
+ __PYX_ERR(0, 254, __pyx_L1_error)
5464
5457
  }
5465
- __pyx_t_12 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u_vsimem_2, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 255, __pyx_L1_error)
5458
+ __pyx_t_12 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u_vsimem_2, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 254, __pyx_L1_error)
5466
5459
  if (!__pyx_t_12) {
5467
5460
  } else {
5468
5461
  __pyx_t_9 = __pyx_t_12;
@@ -5470,27 +5463,27 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5470
5463
  }
5471
5464
  if (unlikely(__pyx_v_path == Py_None)) {
5472
5465
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
5473
- __PYX_ERR(0, 255, __pyx_L1_error)
5466
+ __PYX_ERR(0, 254, __pyx_L1_error)
5474
5467
  }
5475
- __pyx_t_12 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u_vsimem, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 255, __pyx_L1_error)
5468
+ __pyx_t_12 = __Pyx_PyUnicode_Tailmatch(__pyx_v_path, __pyx_kp_u_vsimem, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 254, __pyx_L1_error)
5476
5469
  __pyx_t_9 = __pyx_t_12;
5477
5470
  __pyx_L14_bool_binop_done:;
5478
5471
  if (unlikely(__pyx_t_9)) {
5479
5472
 
5480
- /* "pyogrio/_vsi.pyx":256
5473
+ /* "pyogrio/_vsi.pyx":255
5481
5474
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
5482
5475
  * if path.endswith("/vsimem") or path.endswith("/vsimem/"):
5483
5476
  * raise OSError("path to in-memory file or directory is required") # <<<<<<<<<<<<<<
5484
5477
  *
5485
5478
  * errcode = VSIRmdirRecursive(path_c)
5486
5479
  */
5487
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error)
5480
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
5488
5481
  __Pyx_GOTREF(__pyx_t_4);
5489
5482
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5490
5483
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5491
- __PYX_ERR(0, 256, __pyx_L1_error)
5484
+ __PYX_ERR(0, 255, __pyx_L1_error)
5492
5485
 
5493
- /* "pyogrio/_vsi.pyx":255
5486
+ /* "pyogrio/_vsi.pyx":254
5494
5487
  * if not VSI_ISDIR(st_buf.st_mode):
5495
5488
  * raise NotADirectoryError(f"Path is not a directory: '{path}'")
5496
5489
  * if path.endswith("/vsimem") or path.endswith("/vsimem/"): # <<<<<<<<<<<<<<
@@ -5499,7 +5492,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5499
5492
  */
5500
5493
  }
5501
5494
 
5502
- /* "pyogrio/_vsi.pyx":258
5495
+ /* "pyogrio/_vsi.pyx":257
5503
5496
  * raise OSError("path to in-memory file or directory is required")
5504
5497
  *
5505
5498
  * errcode = VSIRmdirRecursive(path_c) # <<<<<<<<<<<<<<
@@ -5508,7 +5501,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5508
5501
  */
5509
5502
  __pyx_v_errcode = VSIRmdirRecursive(__pyx_v_path_c);
5510
5503
 
5511
- /* "pyogrio/_vsi.pyx":259
5504
+ /* "pyogrio/_vsi.pyx":258
5512
5505
  *
5513
5506
  * errcode = VSIRmdirRecursive(path_c)
5514
5507
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -5518,14 +5511,14 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5518
5511
  __pyx_t_9 = (__pyx_v_errcode != 0);
5519
5512
  if (unlikely(__pyx_t_9)) {
5520
5513
 
5521
- /* "pyogrio/_vsi.pyx":260
5514
+ /* "pyogrio/_vsi.pyx":259
5522
5515
  * errcode = VSIRmdirRecursive(path_c)
5523
5516
  * if errcode != 0:
5524
5517
  * raise OSError(f"Error in rmtree of '{path}': {errcode=}") # <<<<<<<<<<<<<<
5525
5518
  *
5526
5519
  *
5527
5520
  */
5528
- __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
5521
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
5529
5522
  __Pyx_GOTREF(__pyx_t_4);
5530
5523
  __pyx_t_10 = 0;
5531
5524
  __pyx_t_11 = 127;
@@ -5533,7 +5526,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5533
5526
  __pyx_t_10 += 20;
5534
5527
  __Pyx_GIVEREF(__pyx_kp_u_Error_in_rmtree_of);
5535
5528
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Error_in_rmtree_of);
5536
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
5529
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
5537
5530
  __Pyx_GOTREF(__pyx_t_7);
5538
5531
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_11;
5539
5532
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
@@ -5544,23 +5537,23 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5544
5537
  __pyx_t_10 += 11;
5545
5538
  __Pyx_GIVEREF(__pyx_kp_u_errcode);
5546
5539
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_errcode);
5547
- __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
5540
+ __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
5548
5541
  __Pyx_GOTREF(__pyx_t_7);
5549
5542
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
5550
5543
  __Pyx_GIVEREF(__pyx_t_7);
5551
5544
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
5552
5545
  __pyx_t_7 = 0;
5553
- __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
5546
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
5554
5547
  __Pyx_GOTREF(__pyx_t_7);
5555
5548
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5556
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
5549
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
5557
5550
  __Pyx_GOTREF(__pyx_t_4);
5558
5551
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5559
5552
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5560
5553
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5561
- __PYX_ERR(0, 260, __pyx_L1_error)
5554
+ __PYX_ERR(0, 259, __pyx_L1_error)
5562
5555
 
5563
- /* "pyogrio/_vsi.pyx":259
5556
+ /* "pyogrio/_vsi.pyx":258
5564
5557
  *
5565
5558
  * errcode = VSIRmdirRecursive(path_c)
5566
5559
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -5569,7 +5562,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5569
5562
  */
5570
5563
  }
5571
5564
 
5572
- /* "pyogrio/_vsi.pyx":234
5565
+ /* "pyogrio/_vsi.pyx":233
5573
5566
  *
5574
5567
  *
5575
5568
  * def ogr_vsi_rmtree(str path): # <<<<<<<<<<<<<<
@@ -5593,7 +5586,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_4ogr_vsi_rmtree(CYTHON_UNUSED PyObject
5593
5586
  return __pyx_r;
5594
5587
  }
5595
5588
 
5596
- /* "pyogrio/_vsi.pyx":263
5589
+ /* "pyogrio/_vsi.pyx":262
5597
5590
  *
5598
5591
  *
5599
5592
  * def ogr_vsi_unlink(str path): # <<<<<<<<<<<<<<
@@ -5655,12 +5648,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5655
5648
  (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
5656
5649
  kw_args--;
5657
5650
  }
5658
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L3_error)
5651
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 262, __pyx_L3_error)
5659
5652
  else goto __pyx_L5_argtuple_error;
5660
5653
  }
5661
5654
  if (unlikely(kw_args > 0)) {
5662
5655
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
5663
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_unlink") < 0)) __PYX_ERR(0, 263, __pyx_L3_error)
5656
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ogr_vsi_unlink") < 0)) __PYX_ERR(0, 262, __pyx_L3_error)
5664
5657
  }
5665
5658
  } else if (unlikely(__pyx_nargs != 1)) {
5666
5659
  goto __pyx_L5_argtuple_error;
@@ -5671,7 +5664,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5671
5664
  }
5672
5665
  goto __pyx_L6_skip;
5673
5666
  __pyx_L5_argtuple_error:;
5674
- __Pyx_RaiseArgtupleInvalid("ogr_vsi_unlink", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 263, __pyx_L3_error)
5667
+ __Pyx_RaiseArgtupleInvalid("ogr_vsi_unlink", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 262, __pyx_L3_error)
5675
5668
  __pyx_L6_skip:;
5676
5669
  goto __pyx_L4_argument_unpacking_done;
5677
5670
  __pyx_L3_error:;
@@ -5685,7 +5678,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
5685
5678
  __Pyx_RefNannyFinishContext();
5686
5679
  return NULL;
5687
5680
  __pyx_L4_argument_unpacking_done:;
5688
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 263, __pyx_L1_error)
5681
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 262, __pyx_L1_error)
5689
5682
  __pyx_r = __pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(__pyx_self, __pyx_v_path);
5690
5683
 
5691
5684
  /* function exit code */
@@ -5726,7 +5719,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5726
5719
  int __pyx_clineno = 0;
5727
5720
  __Pyx_RefNannySetupContext("ogr_vsi_unlink", 1);
5728
5721
 
5729
- /* "pyogrio/_vsi.pyx":275
5722
+ /* "pyogrio/_vsi.pyx":274
5730
5723
  * cdef VSIStatBufL st_buf
5731
5724
  *
5732
5725
  * try: # <<<<<<<<<<<<<<
@@ -5742,7 +5735,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5742
5735
  __Pyx_XGOTREF(__pyx_t_3);
5743
5736
  /*try:*/ {
5744
5737
 
5745
- /* "pyogrio/_vsi.pyx":276
5738
+ /* "pyogrio/_vsi.pyx":275
5746
5739
  *
5747
5740
  * try:
5748
5741
  * path_b = path.encode("UTF-8") # <<<<<<<<<<<<<<
@@ -5751,14 +5744,14 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5751
5744
  */
5752
5745
  if (unlikely(__pyx_v_path == Py_None)) {
5753
5746
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
5754
- __PYX_ERR(0, 276, __pyx_L3_error)
5747
+ __PYX_ERR(0, 275, __pyx_L3_error)
5755
5748
  }
5756
- __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L3_error)
5749
+ __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L3_error)
5757
5750
  __Pyx_GOTREF(__pyx_t_4);
5758
5751
  __pyx_v_path_b = __pyx_t_4;
5759
5752
  __pyx_t_4 = 0;
5760
5753
 
5761
- /* "pyogrio/_vsi.pyx":275
5754
+ /* "pyogrio/_vsi.pyx":274
5762
5755
  * cdef VSIStatBufL st_buf
5763
5756
  *
5764
5757
  * try: # <<<<<<<<<<<<<<
@@ -5773,7 +5766,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5773
5766
  __pyx_L3_error:;
5774
5767
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5775
5768
 
5776
- /* "pyogrio/_vsi.pyx":277
5769
+ /* "pyogrio/_vsi.pyx":276
5777
5770
  * try:
5778
5771
  * path_b = path.encode("UTF-8")
5779
5772
  * except UnicodeDecodeError: # <<<<<<<<<<<<<<
@@ -5783,12 +5776,12 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5783
5776
  __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
5784
5777
  if (__pyx_t_5) {
5785
5778
  __Pyx_AddTraceback("pyogrio._vsi.ogr_vsi_unlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
5786
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 277, __pyx_L5_except_error)
5779
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 276, __pyx_L5_except_error)
5787
5780
  __Pyx_XGOTREF(__pyx_t_4);
5788
5781
  __Pyx_XGOTREF(__pyx_t_6);
5789
5782
  __Pyx_XGOTREF(__pyx_t_7);
5790
5783
 
5791
- /* "pyogrio/_vsi.pyx":278
5784
+ /* "pyogrio/_vsi.pyx":277
5792
5785
  * path_b = path.encode("UTF-8")
5793
5786
  * except UnicodeDecodeError:
5794
5787
  * path_b = path # <<<<<<<<<<<<<<
@@ -5804,7 +5797,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5804
5797
  }
5805
5798
  goto __pyx_L5_except_error;
5806
5799
 
5807
- /* "pyogrio/_vsi.pyx":275
5800
+ /* "pyogrio/_vsi.pyx":274
5808
5801
  * cdef VSIStatBufL st_buf
5809
5802
  *
5810
5803
  * try: # <<<<<<<<<<<<<<
@@ -5825,17 +5818,17 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5825
5818
  __pyx_L8_try_end:;
5826
5819
  }
5827
5820
 
5828
- /* "pyogrio/_vsi.pyx":279
5821
+ /* "pyogrio/_vsi.pyx":278
5829
5822
  * except UnicodeDecodeError:
5830
5823
  * path_b = path
5831
5824
  * path_c = path_b # <<<<<<<<<<<<<<
5832
5825
  *
5833
5826
  * if not VSIStatL(path_c, &st_buf) == 0:
5834
5827
  */
5835
- __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error)
5828
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_path_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error)
5836
5829
  __pyx_v_path_c = __pyx_t_8;
5837
5830
 
5838
- /* "pyogrio/_vsi.pyx":281
5831
+ /* "pyogrio/_vsi.pyx":280
5839
5832
  * path_c = path_b
5840
5833
  *
5841
5834
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -5845,16 +5838,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5845
5838
  __pyx_t_9 = (!(VSIStatL(__pyx_v_path_c, (&__pyx_v_st_buf)) == 0));
5846
5839
  if (unlikely(__pyx_t_9)) {
5847
5840
 
5848
- /* "pyogrio/_vsi.pyx":282
5841
+ /* "pyogrio/_vsi.pyx":281
5849
5842
  *
5850
5843
  * if not VSIStatL(path_c, &st_buf) == 0:
5851
5844
  * raise FileNotFoundError(f"Path does not exist: '{path}'") # <<<<<<<<<<<<<<
5852
5845
  *
5853
5846
  * if VSI_ISDIR(st_buf.st_mode):
5854
5847
  */
5855
- __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
5848
+ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error)
5856
5849
  __Pyx_GOTREF(__pyx_t_7);
5857
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
5850
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error)
5858
5851
  __Pyx_GOTREF(__pyx_t_6);
5859
5852
  __pyx_t_10 = 0;
5860
5853
  __pyx_t_11 = 127;
@@ -5862,7 +5855,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5862
5855
  __pyx_t_10 += 22;
5863
5856
  __Pyx_GIVEREF(__pyx_kp_u_Path_does_not_exist);
5864
5857
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Path_does_not_exist);
5865
- __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
5858
+ __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
5866
5859
  __Pyx_GOTREF(__pyx_t_4);
5867
5860
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
5868
5861
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
@@ -5873,18 +5866,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5873
5866
  __pyx_t_10 += 1;
5874
5867
  __Pyx_GIVEREF(__pyx_kp_u__9);
5875
5868
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__9);
5876
- __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
5869
+ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
5877
5870
  __Pyx_GOTREF(__pyx_t_4);
5878
5871
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5879
- __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
5872
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error)
5880
5873
  __Pyx_GOTREF(__pyx_t_6);
5881
5874
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5882
5875
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5883
5876
  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
5884
5877
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5885
- __PYX_ERR(0, 282, __pyx_L1_error)
5878
+ __PYX_ERR(0, 281, __pyx_L1_error)
5886
5879
 
5887
- /* "pyogrio/_vsi.pyx":281
5880
+ /* "pyogrio/_vsi.pyx":280
5888
5881
  * path_c = path_b
5889
5882
  *
5890
5883
  * if not VSIStatL(path_c, &st_buf) == 0: # <<<<<<<<<<<<<<
@@ -5893,7 +5886,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5893
5886
  */
5894
5887
  }
5895
5888
 
5896
- /* "pyogrio/_vsi.pyx":284
5889
+ /* "pyogrio/_vsi.pyx":283
5897
5890
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5898
5891
  *
5899
5892
  * if VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -5903,16 +5896,16 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5903
5896
  __pyx_t_9 = (VSI_ISDIR(__pyx_v_st_buf.st_mode) != 0);
5904
5897
  if (unlikely(__pyx_t_9)) {
5905
5898
 
5906
- /* "pyogrio/_vsi.pyx":285
5899
+ /* "pyogrio/_vsi.pyx":284
5907
5900
  *
5908
5901
  * if VSI_ISDIR(st_buf.st_mode):
5909
5902
  * raise IsADirectoryError(f"Path is a directory: '{path}'") # <<<<<<<<<<<<<<
5910
5903
  *
5911
5904
  * errcode = VSIUnlink(path_c)
5912
5905
  */
5913
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_IsADirectoryError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error)
5906
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_IsADirectoryError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error)
5914
5907
  __Pyx_GOTREF(__pyx_t_6);
5915
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
5908
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
5916
5909
  __Pyx_GOTREF(__pyx_t_4);
5917
5910
  __pyx_t_10 = 0;
5918
5911
  __pyx_t_11 = 127;
@@ -5920,7 +5913,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5920
5913
  __pyx_t_10 += 22;
5921
5914
  __Pyx_GIVEREF(__pyx_kp_u_Path_is_a_directory);
5922
5915
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Path_is_a_directory);
5923
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
5916
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error)
5924
5917
  __Pyx_GOTREF(__pyx_t_7);
5925
5918
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_11;
5926
5919
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
@@ -5931,18 +5924,18 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5931
5924
  __pyx_t_10 += 1;
5932
5925
  __Pyx_GIVEREF(__pyx_kp_u__9);
5933
5926
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__9);
5934
- __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
5927
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error)
5935
5928
  __Pyx_GOTREF(__pyx_t_7);
5936
5929
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5937
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
5930
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
5938
5931
  __Pyx_GOTREF(__pyx_t_4);
5939
5932
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5940
5933
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5941
5934
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5942
5935
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5943
- __PYX_ERR(0, 285, __pyx_L1_error)
5936
+ __PYX_ERR(0, 284, __pyx_L1_error)
5944
5937
 
5945
- /* "pyogrio/_vsi.pyx":284
5938
+ /* "pyogrio/_vsi.pyx":283
5946
5939
  * raise FileNotFoundError(f"Path does not exist: '{path}'")
5947
5940
  *
5948
5941
  * if VSI_ISDIR(st_buf.st_mode): # <<<<<<<<<<<<<<
@@ -5951,7 +5944,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5951
5944
  */
5952
5945
  }
5953
5946
 
5954
- /* "pyogrio/_vsi.pyx":287
5947
+ /* "pyogrio/_vsi.pyx":286
5955
5948
  * raise IsADirectoryError(f"Path is a directory: '{path}'")
5956
5949
  *
5957
5950
  * errcode = VSIUnlink(path_c) # <<<<<<<<<<<<<<
@@ -5960,7 +5953,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5960
5953
  */
5961
5954
  __pyx_v_errcode = VSIUnlink(__pyx_v_path_c);
5962
5955
 
5963
- /* "pyogrio/_vsi.pyx":288
5956
+ /* "pyogrio/_vsi.pyx":287
5964
5957
  *
5965
5958
  * errcode = VSIUnlink(path_c)
5966
5959
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -5969,12 +5962,12 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5969
5962
  __pyx_t_9 = (__pyx_v_errcode != 0);
5970
5963
  if (unlikely(__pyx_t_9)) {
5971
5964
 
5972
- /* "pyogrio/_vsi.pyx":289
5965
+ /* "pyogrio/_vsi.pyx":288
5973
5966
  * errcode = VSIUnlink(path_c)
5974
5967
  * if errcode != 0:
5975
5968
  * raise OSError(f"Error removing '{path}': {errcode=}") # <<<<<<<<<<<<<<
5976
5969
  */
5977
- __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
5970
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
5978
5971
  __Pyx_GOTREF(__pyx_t_4);
5979
5972
  __pyx_t_10 = 0;
5980
5973
  __pyx_t_11 = 127;
@@ -5982,7 +5975,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5982
5975
  __pyx_t_10 += 16;
5983
5976
  __Pyx_GIVEREF(__pyx_kp_u_Error_removing);
5984
5977
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Error_removing);
5985
- __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
5978
+ __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
5986
5979
  __Pyx_GOTREF(__pyx_t_7);
5987
5980
  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_11;
5988
5981
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
@@ -5993,23 +5986,23 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
5993
5986
  __pyx_t_10 += 11;
5994
5987
  __Pyx_GIVEREF(__pyx_kp_u_errcode);
5995
5988
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_errcode);
5996
- __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
5989
+ __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_errcode, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
5997
5990
  __Pyx_GOTREF(__pyx_t_7);
5998
5991
  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
5999
5992
  __Pyx_GIVEREF(__pyx_t_7);
6000
5993
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
6001
5994
  __pyx_t_7 = 0;
6002
- __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
5995
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
6003
5996
  __Pyx_GOTREF(__pyx_t_7);
6004
5997
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6005
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
5998
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OSError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
6006
5999
  __Pyx_GOTREF(__pyx_t_4);
6007
6000
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6008
6001
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6009
6002
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6010
- __PYX_ERR(0, 289, __pyx_L1_error)
6003
+ __PYX_ERR(0, 288, __pyx_L1_error)
6011
6004
 
6012
- /* "pyogrio/_vsi.pyx":288
6005
+ /* "pyogrio/_vsi.pyx":287
6013
6006
  *
6014
6007
  * errcode = VSIUnlink(path_c)
6015
6008
  * if errcode != 0: # <<<<<<<<<<<<<<
@@ -6017,7 +6010,7 @@ static PyObject *__pyx_pf_7pyogrio_4_vsi_6ogr_vsi_unlink(CYTHON_UNUSED PyObject
6017
6010
  */
6018
6011
  }
6019
6012
 
6020
- /* "pyogrio/_vsi.pyx":263
6013
+ /* "pyogrio/_vsi.pyx":262
6021
6014
  *
6022
6015
  *
6023
6016
  * def ogr_vsi_unlink(str path): # <<<<<<<<<<<<<<
@@ -6141,12 +6134,12 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
6141
6134
  }
6142
6135
  /* #### Code section: cached_builtins ### */
6143
6136
  static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
6144
- __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 45, __pyx_L1_error)
6145
- __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 93, __pyx_L1_error)
6146
- __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 126, __pyx_L1_error)
6147
- __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 165, __pyx_L1_error)
6148
- __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 217, __pyx_L1_error)
6149
- __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 248, __pyx_L1_error)
6137
+ __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 42, __pyx_L1_error)
6138
+ __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 92, __pyx_L1_error)
6139
+ __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 125, __pyx_L1_error)
6140
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 164, __pyx_L1_error)
6141
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 216, __pyx_L1_error)
6142
+ __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 247, __pyx_L1_error)
6150
6143
  return 0;
6151
6144
  __pyx_L1_error:;
6152
6145
  return -1;
@@ -6157,105 +6150,105 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
6157
6150
  __Pyx_RefNannyDeclarations
6158
6151
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6159
6152
 
6160
- /* "pyogrio/_vsi.pyx":45
6153
+ /* "pyogrio/_vsi.pyx":42
6161
6154
  * # Check for existing bytes
6162
6155
  * if path_or_fp.getbuffer().nbytes > 0:
6163
- * raise NotImplementedError("writing to existing in-memory object is not supported") # <<<<<<<<<<<<<<
6164
- *
6165
- * # Create in-memory directory to contain auxiliary files.
6156
+ * raise NotImplementedError( # <<<<<<<<<<<<<<
6157
+ * "writing to existing in-memory object is not supported"
6158
+ * )
6166
6159
  */
6167
- __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_writing_to_existing_in_memory_ob); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 45, __pyx_L1_error)
6160
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_writing_to_existing_in_memory_ob); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 42, __pyx_L1_error)
6168
6161
  __Pyx_GOTREF(__pyx_tuple_);
6169
6162
  __Pyx_GIVEREF(__pyx_tuple_);
6170
6163
 
6171
- /* "pyogrio/_vsi.pyx":93
6164
+ /* "pyogrio/_vsi.pyx":92
6172
6165
  *
6173
6166
  * if vsi_handle == NULL:
6174
6167
  * raise OSError("failed to read buffer into in-memory file") # <<<<<<<<<<<<<<
6175
6168
  *
6176
6169
  * if VSIFCloseL(vsi_handle) != 0:
6177
6170
  */
6178
- __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_failed_to_read_buffer_into_in_me); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 93, __pyx_L1_error)
6171
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_failed_to_read_buffer_into_in_me); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 92, __pyx_L1_error)
6179
6172
  __Pyx_GOTREF(__pyx_tuple__6);
6180
6173
  __Pyx_GIVEREF(__pyx_tuple__6);
6181
6174
 
6182
- /* "pyogrio/_vsi.pyx":96
6175
+ /* "pyogrio/_vsi.pyx":95
6183
6176
  *
6184
6177
  * if VSIFCloseL(vsi_handle) != 0:
6185
6178
  * raise OSError("failed to close in-memory file") # <<<<<<<<<<<<<<
6186
6179
  *
6187
6180
  * if is_zipped:
6188
6181
  */
6189
- __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_failed_to_close_in_memory_file); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 96, __pyx_L1_error)
6182
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_failed_to_close_in_memory_file); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 95, __pyx_L1_error)
6190
6183
  __Pyx_GOTREF(__pyx_tuple__7);
6191
6184
  __Pyx_GIVEREF(__pyx_tuple__7);
6192
6185
 
6193
- /* "pyogrio/_vsi.pyx":126
6186
+ /* "pyogrio/_vsi.pyx":125
6194
6187
  * vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1)
6195
6188
  * if vsi_buffer == NULL:
6196
6189
  * raise RuntimeError("could not read bytes from in-memory file") # <<<<<<<<<<<<<<
6197
6190
  *
6198
6191
  * # write bytes to buffer
6199
6192
  */
6200
- __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_could_not_read_bytes_from_in_mem); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 126, __pyx_L1_error)
6193
+ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_could_not_read_bytes_from_in_mem); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 125, __pyx_L1_error)
6201
6194
  __Pyx_GOTREF(__pyx_tuple__8);
6202
6195
  __Pyx_GIVEREF(__pyx_tuple__8);
6203
6196
 
6204
- /* "pyogrio/_vsi.pyx":170
6197
+ /* "pyogrio/_vsi.pyx":169
6205
6198
  * mempath_parts = path.split("/vsimem/")[1].split("/")
6206
6199
  * if len(mempath_parts) == 0:
6207
6200
  * raise OSError("path to in-memory file or directory is required") # <<<<<<<<<<<<<<
6208
6201
  *
6209
6202
  * toplevel_path = f"/vsimem/{mempath_parts[0]}"
6210
6203
  */
6211
- __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_path_to_in_memory_file_or_direct); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 170, __pyx_L1_error)
6204
+ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_path_to_in_memory_file_or_direct); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 169, __pyx_L1_error)
6212
6205
  __Pyx_GOTREF(__pyx_tuple__10);
6213
6206
  __Pyx_GIVEREF(__pyx_tuple__10);
6214
6207
 
6215
- /* "pyogrio/_vsi.pyx":138
6208
+ /* "pyogrio/_vsi.pyx":137
6216
6209
  *
6217
6210
  *
6218
6211
  * cpdef vsimem_rmtree_toplevel(str path): # <<<<<<<<<<<<<<
6219
6212
  * """Remove the top-level file or top-level directory containing the file.
6220
6213
  *
6221
6214
  */
6222
- __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_path); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 138, __pyx_L1_error)
6215
+ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_path); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 137, __pyx_L1_error)
6223
6216
  __Pyx_GOTREF(__pyx_tuple__12);
6224
6217
  __Pyx_GIVEREF(__pyx_tuple__12);
6225
- __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_vsimem_rmtree_toplevel, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 138, __pyx_L1_error)
6218
+ __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_vsimem_rmtree_toplevel, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 137, __pyx_L1_error)
6226
6219
 
6227
- /* "pyogrio/_vsi.pyx":186
6220
+ /* "pyogrio/_vsi.pyx":185
6228
6221
  *
6229
6222
  *
6230
6223
  * def ogr_vsi_listtree(str path, str pattern): # <<<<<<<<<<<<<<
6231
6224
  * """Recursively list the contents in a VSI directory.
6232
6225
  *
6233
6226
  */
6234
- __pyx_tuple__14 = PyTuple_Pack(10, __pyx_n_s_path, __pyx_n_s_pattern, __pyx_n_s_path_c, __pyx_n_s_n, __pyx_n_s_papszFiles, __pyx_n_s_st_buf, __pyx_n_s_path_b, __pyx_n_s_files, __pyx_n_s_i, __pyx_n_s_file); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 186, __pyx_L1_error)
6227
+ __pyx_tuple__14 = PyTuple_Pack(10, __pyx_n_s_path, __pyx_n_s_pattern, __pyx_n_s_path_c, __pyx_n_s_n, __pyx_n_s_papszFiles, __pyx_n_s_st_buf, __pyx_n_s_path_b, __pyx_n_s_files, __pyx_n_s_i, __pyx_n_s_file); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 185, __pyx_L1_error)
6235
6228
  __Pyx_GOTREF(__pyx_tuple__14);
6236
6229
  __Pyx_GIVEREF(__pyx_tuple__14);
6237
- __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_listtree, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 186, __pyx_L1_error)
6230
+ __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_listtree, 185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 185, __pyx_L1_error)
6238
6231
 
6239
- /* "pyogrio/_vsi.pyx":234
6232
+ /* "pyogrio/_vsi.pyx":233
6240
6233
  *
6241
6234
  *
6242
6235
  * def ogr_vsi_rmtree(str path): # <<<<<<<<<<<<<<
6243
6236
  * """Recursively remove VSI directory.
6244
6237
  *
6245
6238
  */
6246
- __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_path, __pyx_n_s_path_c, __pyx_n_s_st_buf, __pyx_n_s_path_b, __pyx_n_s_errcode_2); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 234, __pyx_L1_error)
6239
+ __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_path, __pyx_n_s_path_c, __pyx_n_s_st_buf, __pyx_n_s_path_b, __pyx_n_s_errcode_2); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 233, __pyx_L1_error)
6247
6240
  __Pyx_GOTREF(__pyx_tuple__16);
6248
6241
  __Pyx_GIVEREF(__pyx_tuple__16);
6249
- __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_rmtree, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 234, __pyx_L1_error)
6242
+ __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_rmtree, 233, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 233, __pyx_L1_error)
6250
6243
 
6251
- /* "pyogrio/_vsi.pyx":263
6244
+ /* "pyogrio/_vsi.pyx":262
6252
6245
  *
6253
6246
  *
6254
6247
  * def ogr_vsi_unlink(str path): # <<<<<<<<<<<<<<
6255
6248
  * """Remove VSI file.
6256
6249
  *
6257
6250
  */
6258
- __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_unlink, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 263, __pyx_L1_error)
6251
+ __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyogrio__vsi_pyx, __pyx_n_s_ogr_vsi_unlink, 262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 262, __pyx_L1_error)
6259
6252
  __Pyx_RefNannyFinishContext();
6260
6253
  return 0;
6261
6254
  __pyx_L1_error:;
@@ -6666,7 +6659,7 @@ if (!__Pyx_RefNanny) {
6666
6659
  * from io import BytesIO
6667
6660
  * from uuid import uuid4 # <<<<<<<<<<<<<<
6668
6661
  *
6669
- * from libc.stdlib cimport malloc, free
6662
+ * from pyogrio._ogr cimport *
6670
6663
  */
6671
6664
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error)
6672
6665
  __Pyx_GOTREF(__pyx_t_3);
@@ -6682,73 +6675,73 @@ if (!__Pyx_RefNanny) {
6682
6675
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6683
6676
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6684
6677
 
6685
- /* "pyogrio/_vsi.pyx":9
6678
+ /* "pyogrio/_vsi.pyx":6
6686
6679
  *
6687
6680
  * from pyogrio._ogr cimport *
6688
6681
  * from pyogrio._ogr import _get_driver_metadata_item # <<<<<<<<<<<<<<
6689
6682
  *
6690
6683
  *
6691
6684
  */
6692
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
6685
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
6693
6686
  __Pyx_GOTREF(__pyx_t_2);
6694
6687
  __Pyx_INCREF(__pyx_n_s_get_driver_metadata_item);
6695
6688
  __Pyx_GIVEREF(__pyx_n_s_get_driver_metadata_item);
6696
- if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_driver_metadata_item)) __PYX_ERR(0, 9, __pyx_L1_error);
6697
- __pyx_t_3 = __Pyx_Import(__pyx_n_s_pyogrio__ogr, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error)
6689
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_driver_metadata_item)) __PYX_ERR(0, 6, __pyx_L1_error);
6690
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_pyogrio__ogr, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error)
6698
6691
  __Pyx_GOTREF(__pyx_t_3);
6699
6692
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6700
- __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
6693
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
6701
6694
  __Pyx_GOTREF(__pyx_t_2);
6702
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_driver_metadata_item, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
6695
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_driver_metadata_item, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
6703
6696
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6704
6697
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6705
6698
 
6706
- /* "pyogrio/_vsi.pyx":138
6699
+ /* "pyogrio/_vsi.pyx":137
6707
6700
  *
6708
6701
  *
6709
6702
  * cpdef vsimem_rmtree_toplevel(str path): # <<<<<<<<<<<<<<
6710
6703
  * """Remove the top-level file or top-level directory containing the file.
6711
6704
  *
6712
6705
  */
6713
- __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_1vsimem_rmtree_toplevel, 0, __pyx_n_s_vsimem_rmtree_toplevel, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error)
6706
+ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_1vsimem_rmtree_toplevel, 0, __pyx_n_s_vsimem_rmtree_toplevel, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error)
6714
6707
  __Pyx_GOTREF(__pyx_t_3);
6715
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_vsimem_rmtree_toplevel, __pyx_t_3) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
6708
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_vsimem_rmtree_toplevel, __pyx_t_3) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
6716
6709
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6717
6710
 
6718
- /* "pyogrio/_vsi.pyx":186
6711
+ /* "pyogrio/_vsi.pyx":185
6719
6712
  *
6720
6713
  *
6721
6714
  * def ogr_vsi_listtree(str path, str pattern): # <<<<<<<<<<<<<<
6722
6715
  * """Recursively list the contents in a VSI directory.
6723
6716
  *
6724
6717
  */
6725
- __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_3ogr_vsi_listtree, 0, __pyx_n_s_ogr_vsi_listtree, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
6718
+ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_3ogr_vsi_listtree, 0, __pyx_n_s_ogr_vsi_listtree, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
6726
6719
  __Pyx_GOTREF(__pyx_t_3);
6727
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_listtree, __pyx_t_3) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
6720
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_listtree, __pyx_t_3) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
6728
6721
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6729
6722
 
6730
- /* "pyogrio/_vsi.pyx":234
6723
+ /* "pyogrio/_vsi.pyx":233
6731
6724
  *
6732
6725
  *
6733
6726
  * def ogr_vsi_rmtree(str path): # <<<<<<<<<<<<<<
6734
6727
  * """Recursively remove VSI directory.
6735
6728
  *
6736
6729
  */
6737
- __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_5ogr_vsi_rmtree, 0, __pyx_n_s_ogr_vsi_rmtree, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
6730
+ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_5ogr_vsi_rmtree, 0, __pyx_n_s_ogr_vsi_rmtree, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
6738
6731
  __Pyx_GOTREF(__pyx_t_3);
6739
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_rmtree, __pyx_t_3) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
6732
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_rmtree, __pyx_t_3) < 0) __PYX_ERR(0, 233, __pyx_L1_error)
6740
6733
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6741
6734
 
6742
- /* "pyogrio/_vsi.pyx":263
6735
+ /* "pyogrio/_vsi.pyx":262
6743
6736
  *
6744
6737
  *
6745
6738
  * def ogr_vsi_unlink(str path): # <<<<<<<<<<<<<<
6746
6739
  * """Remove VSI file.
6747
6740
  *
6748
6741
  */
6749
- __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_7ogr_vsi_unlink, 0, __pyx_n_s_ogr_vsi_unlink, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
6742
+ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7pyogrio_4_vsi_7ogr_vsi_unlink, 0, __pyx_n_s_ogr_vsi_unlink, NULL, __pyx_n_s_pyogrio__vsi, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
6750
6743
  __Pyx_GOTREF(__pyx_t_3);
6751
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_unlink, __pyx_t_3) < 0) __PYX_ERR(0, 263, __pyx_L1_error)
6744
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ogr_vsi_unlink, __pyx_t_3) < 0) __PYX_ERR(0, 262, __pyx_L1_error)
6752
6745
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6753
6746
 
6754
6747
  /* "pyogrio/_vsi.pyx":1
@@ -10461,7 +10454,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
10461
10454
  #include "compile.h"
10462
10455
  #include "frameobject.h"
10463
10456
  #include "traceback.h"
10464
- #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
10457
+ #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
10465
10458
  #ifndef Py_BUILD_CORE
10466
10459
  #define Py_BUILD_CORE 1
10467
10460
  #endif