pyogrio 0.9.0__cp312-cp312-win_amd64.whl → 0.10.0__cp312-cp312-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 (102) hide show
  1. pyogrio/__init__.py +26 -18
  2. pyogrio/_compat.py +7 -1
  3. pyogrio/_env.py +4 -6
  4. pyogrio/_err.c +460 -445
  5. pyogrio/_err.cp312-win_amd64.pyd +0 -0
  6. pyogrio/_geometry.c +645 -612
  7. pyogrio/_geometry.cp312-win_amd64.pyd +0 -0
  8. pyogrio/_io.c +7749 -7596
  9. pyogrio/_io.cp312-win_amd64.pyd +0 -0
  10. pyogrio/_ogr.c +601 -609
  11. pyogrio/_ogr.cp312-win_amd64.pyd +0 -0
  12. pyogrio/_version.py +3 -3
  13. pyogrio/_vsi.c +7570 -2514
  14. pyogrio/_vsi.cp312-win_amd64.pyd +0 -0
  15. pyogrio/core.py +86 -20
  16. pyogrio/errors.py +9 -16
  17. pyogrio/gdal_data/GDAL-targets.cmake +1 -1
  18. pyogrio/gdal_data/GDALConfig.cmake +0 -1
  19. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  20. pyogrio/gdal_data/MM_m_idofic.csv +321 -0
  21. pyogrio/gdal_data/gdaltileindex.xsd +269 -0
  22. pyogrio/gdal_data/gdalvrt.xsd +130 -22
  23. pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
  24. pyogrio/gdal_data/ogrvrt.xsd +3 -0
  25. pyogrio/gdal_data/pci_datum.txt +222 -155
  26. pyogrio/gdal_data/pci_ellips.txt +90 -38
  27. pyogrio/gdal_data/vcpkg.spdx.json +21 -21
  28. pyogrio/gdal_data/vcpkg_abi_info.txt +27 -27
  29. pyogrio/geopandas.py +32 -24
  30. pyogrio/proj_data/proj-config-version.cmake +2 -2
  31. pyogrio/proj_data/proj-targets.cmake +1 -1
  32. pyogrio/proj_data/proj.db +0 -0
  33. pyogrio/proj_data/proj4-targets.cmake +1 -1
  34. pyogrio/proj_data/projjson.schema.json +1 -1
  35. pyogrio/proj_data/vcpkg.spdx.json +17 -17
  36. pyogrio/proj_data/vcpkg_abi_info.txt +15 -15
  37. pyogrio/raw.py +46 -30
  38. pyogrio/tests/conftest.py +206 -12
  39. pyogrio/tests/fixtures/README.md +32 -13
  40. pyogrio/tests/fixtures/curve.gpkg +0 -0
  41. pyogrio/tests/fixtures/{test_multisurface.gpkg → curvepolygon.gpkg} +0 -0
  42. pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  43. pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  44. pyogrio/tests/test_arrow.py +178 -24
  45. pyogrio/tests/test_core.py +162 -72
  46. pyogrio/tests/test_geopandas_io.py +239 -99
  47. pyogrio/tests/test_path.py +29 -17
  48. pyogrio/tests/test_raw_io.py +165 -54
  49. pyogrio/tests/test_util.py +56 -0
  50. pyogrio/util.py +54 -30
  51. pyogrio-0.10.0.dist-info/DELVEWHEEL +2 -0
  52. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/LICENSE +1 -1
  53. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/METADATA +37 -8
  54. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/RECORD +74 -90
  55. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/WHEEL +1 -1
  56. pyogrio.libs/{Lerc-5e4d8cbeeabca06f95e2270792304dc3.dll → Lerc-089e3fef3df84b17326dcddbf1dedaa4.dll} +0 -0
  57. pyogrio.libs/{gdal-b434963605a006e01c486c0df6dea4e0.dll → gdal-debee5933f0da7bb90b4bcd009023377.dll} +0 -0
  58. pyogrio.libs/{geos-f0622d0794b81c937a851b2e6fa9b712.dll → geos-ace4c5b5c1f569bb4213e7bbd0b0322e.dll} +0 -0
  59. pyogrio.libs/{geos_c-0e16bf70612fc3301d077b9d863a3fdb.dll → geos_c-7478ca0a86136b280d9b2d245c6f6627.dll} +0 -0
  60. pyogrio.libs/geotiff-c8fe8a095520a4ea4e465d27e06add3a.dll +0 -0
  61. pyogrio.libs/{iconv-2-8fcc23ddc6f096c45871011b6e008b44.dll → iconv-2-27352d156a5467ca5383d3951093ea5a.dll} +0 -0
  62. pyogrio.libs/{jpeg62-2f9b7af22d78338e8f0be0058503dc35.dll → jpeg62-e56b6f95a95af498f4623b8da4cebd46.dll} +0 -0
  63. pyogrio.libs/{json-c-e52a077545e4057de42beb4948289b41.dll → json-c-c84940e2654a4f8468bfcf2ce992aa93.dll} +0 -0
  64. pyogrio.libs/libcurl-d69cfd4ad487d53d58743b6778ec85e7.dll +0 -0
  65. pyogrio.libs/{libexpat-fbe03ca8917dfda776562d4338b289b8.dll → libexpat-6576a8d02641b6a3dbad35901ec200a7.dll} +0 -0
  66. pyogrio.libs/liblzma-9ee4accb476ec1ae24e924953140273d.dll +0 -0
  67. pyogrio.libs/{libpng16-13928571ad910705eae8d7dd8eef8b11.dll → libpng16-7c36142dda59f186f6bb683e8dae2bfe.dll} +0 -0
  68. pyogrio.libs/{msvcp140-46db46e967c8db2cb7a20fc75872a57e.dll → msvcp140-98b3e5b80de1e5e9d1703b786d795623.dll} +0 -0
  69. pyogrio.libs/proj-a408c5327f3fd2f5fabe8c56815beed7.dll +0 -0
  70. pyogrio.libs/{qhull_r-c45abde5d0c92faf723cc2942138af77.dll → qhull_r-516897f855568caab1ab1fe37912766c.dll} +0 -0
  71. pyogrio.libs/sqlite3-9bc109d8536d5ed9666332fec94485fc.dll +0 -0
  72. pyogrio.libs/{tiff-43630f30487a9015213475ae86ed3fa3.dll → tiff-9b3f605fffe0bccc0a964c374ee4f820.dll} +0 -0
  73. pyogrio.libs/{zlib1-e1272810861a13dd8d6cff3beac47f17.dll → zlib1-e5af16a15c63f05bd82d90396807ae5b.dll} +0 -0
  74. pyogrio/_err.pxd +0 -4
  75. pyogrio/_err.pyx +0 -250
  76. pyogrio/_geometry.pxd +0 -4
  77. pyogrio/_geometry.pyx +0 -129
  78. pyogrio/_io.pxd +0 -0
  79. pyogrio/_io.pyx +0 -2742
  80. pyogrio/_ogr.pxd +0 -444
  81. pyogrio/_ogr.pyx +0 -346
  82. pyogrio/_vsi.pxd +0 -4
  83. pyogrio/_vsi.pyx +0 -140
  84. pyogrio/arrow_bridge.h +0 -115
  85. pyogrio/gdal_data/bag_template.xml +0 -201
  86. pyogrio/gdal_data/gmlasconf.xml +0 -169
  87. pyogrio/gdal_data/gmlasconf.xsd +0 -1066
  88. pyogrio/gdal_data/netcdf_config.xsd +0 -143
  89. pyogrio/gdal_data/template_tiles.mapml +0 -28
  90. pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
  91. pyogrio/tests/fixtures/test_datetime.geojson +0 -7
  92. pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
  93. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  94. pyogrio/tests/fixtures/test_nested.geojson +0 -18
  95. pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
  96. pyogrio-0.9.0.dist-info/DELVEWHEEL +0 -2
  97. pyogrio.libs/geotiff-772e7c705fb15ddf91b432adb4eb1f6c.dll +0 -0
  98. pyogrio.libs/libcurl-bc81cd8afe15b10c0821b181b6af8bd0.dll +0 -0
  99. pyogrio.libs/liblzma-6b36f24d54d3dd45f274a2aebef81085.dll +0 -0
  100. pyogrio.libs/proj-8a30239ef2dfc3b9dd2bb48e8abb330f.dll +0 -0
  101. pyogrio.libs/sqlite3-df30c3cf230727e23c43c40126a530f7.dll +0 -0
  102. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/top_level.txt +0 -0
pyogrio/_ogr.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.0.10 */
1
+ /* Generated by Cython 3.0.11 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -6,6 +6,7 @@
6
6
  "depends": [
7
7
  "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\cpl_conv.h",
8
8
  "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\cpl_error.h",
9
+ "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\cpl_port.h",
9
10
  "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\cpl_string.h",
10
11
  "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\cpl_vsi.h",
11
12
  "C:\\vcpkg\\installed\\x64-windows-dynamic-release\\include\\gdal.h",
@@ -57,10 +58,10 @@ END: Cython Metadata */
57
58
  #else
58
59
  #define __PYX_EXTRA_ABI_MODULE_NAME ""
59
60
  #endif
60
- #define CYTHON_ABI "3_0_10" __PYX_EXTRA_ABI_MODULE_NAME
61
+ #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
61
62
  #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
62
63
  #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
63
- #define CYTHON_HEX_VERSION 0x03000AF0
64
+ #define CYTHON_HEX_VERSION 0x03000BF0
64
65
  #define CYTHON_FUTURE_DIVISION 1
65
66
  #include <stddef.h>
66
67
  #ifndef offsetof
@@ -1257,6 +1258,7 @@ static CYTHON_INLINE float __PYX_NAN() {
1257
1258
  #include <stdio.h>
1258
1259
  #include "cpl_conv.h"
1259
1260
  #include "cpl_error.h"
1261
+ #include "cpl_port.h"
1260
1262
  #include "cpl_string.h"
1261
1263
  #include "cpl_vsi.h"
1262
1264
  #include "ogr_core.h"
@@ -1527,7 +1529,7 @@ static const char *__pyx_f[] = {
1527
1529
  /*--- Type declarations ---*/
1528
1530
  struct __pyx_opt_args_7pyogrio_4_ogr_get_string;
1529
1531
 
1530
- /* "pyogrio/_ogr.pxd":444
1532
+ /* "pyogrio/_ogr.pxd":452
1531
1533
  *
1532
1534
  *
1533
1535
  * cdef get_string(const char *c_str, str encoding=*) # <<<<<<<<<<<<<<
@@ -1880,9 +1882,14 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict,
1880
1882
  static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1881
1883
  PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1882
1884
 
1883
- /* PyObject_Str.proto */
1884
- #define __Pyx_PyObject_Str(obj)\
1885
- (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
1885
+ /* PyObject_Unicode.proto */
1886
+ #if PY_MAJOR_VERSION >= 3
1887
+ #define __Pyx_PyObject_Unicode(obj)\
1888
+ (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
1889
+ #else
1890
+ #define __Pyx_PyObject_Unicode(obj)\
1891
+ (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
1892
+ #endif
1886
1893
 
1887
1894
  /* PyDictVersioning.proto */
1888
1895
  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
@@ -2293,7 +2300,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt
2293
2300
  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2294
2301
 
2295
2302
  /* FunctionImport.proto */
2296
- static int __Pyx_ImportFunction_3_0_10(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2303
+ static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2297
2304
 
2298
2305
  /* InitStrings.proto */
2299
2306
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
@@ -3256,7 +3263,7 @@ static PyObject *__pyx_f_7pyogrio_4_ogr_get_string(char const *__pyx_v_c_str, st
3256
3263
  PyObject *__pyx_t_1 = NULL;
3257
3264
  PyObject *__pyx_t_2 = NULL;
3258
3265
  PyObject *__pyx_t_3 = NULL;
3259
- int __pyx_t_4;
3266
+ unsigned int __pyx_t_4;
3260
3267
  int __pyx_lineno = 0;
3261
3268
  const char *__pyx_filename = NULL;
3262
3269
  int __pyx_clineno = 0;
@@ -3817,10 +3824,11 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3817
3824
  PyObject *__pyx_t_6 = NULL;
3818
3825
  int __pyx_t_7;
3819
3826
  PyObject *__pyx_t_8 = NULL;
3820
- int __pyx_t_9;
3821
- char const *__pyx_t_10;
3827
+ unsigned int __pyx_t_9;
3828
+ int __pyx_t_10;
3822
3829
  char const *__pyx_t_11;
3823
3830
  char const *__pyx_t_12;
3831
+ char const *__pyx_t_13;
3824
3832
  int __pyx_lineno = 0;
3825
3833
  const char *__pyx_filename = NULL;
3826
3834
  int __pyx_clineno = 0;
@@ -3864,7 +3872,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3864
3872
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
3865
3873
  __Pyx_GOTREF(__pyx_t_5);
3866
3874
  __pyx_t_8 = NULL;
3867
- __pyx_t_7 = 0;
3875
+ __pyx_t_9 = 0;
3868
3876
  #if CYTHON_UNPACK_METHODS
3869
3877
  if (likely(PyMethod_Check(__pyx_t_5))) {
3870
3878
  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
@@ -3873,13 +3881,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3873
3881
  __Pyx_INCREF(__pyx_t_8);
3874
3882
  __Pyx_INCREF(function);
3875
3883
  __Pyx_DECREF_SET(__pyx_t_5, function);
3876
- __pyx_t_7 = 1;
3884
+ __pyx_t_9 = 1;
3877
3885
  }
3878
3886
  }
3879
3887
  #endif
3880
3888
  {
3881
3889
  PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u_utf_8};
3882
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
3890
+ __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
3883
3891
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3884
3892
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
3885
3893
  __Pyx_GOTREF(__pyx_t_6);
@@ -3905,8 +3913,8 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3905
3913
  * CPLSetConfigOption(<const char*>name_c, NULL)
3906
3914
  * continue
3907
3915
  */
3908
- __pyx_t_9 = (__pyx_v_value == Py_None);
3909
- if (__pyx_t_9) {
3916
+ __pyx_t_10 = (__pyx_v_value == Py_None);
3917
+ if (__pyx_t_10) {
3910
3918
 
3911
3919
  /* "pyogrio/_ogr.pyx":69
3912
3920
  * # None is a special case; this is used to clear the previous value
@@ -3915,8 +3923,8 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3915
3923
  * continue
3916
3924
  *
3917
3925
  */
3918
- __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_name_c); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
3919
- CPLSetConfigOption(((char const *)__pyx_t_10), NULL);
3926
+ __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_name_c); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
3927
+ CPLSetConfigOption(((char const *)__pyx_t_11), NULL);
3920
3928
 
3921
3929
  /* "pyogrio/_ogr.pyx":70
3922
3930
  * if value is None:
@@ -3945,9 +3953,9 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3945
3953
  */
3946
3954
  __pyx_t_6 = ((PyObject*)&PyBool_Type);
3947
3955
  __Pyx_INCREF(__pyx_t_6);
3948
- __pyx_t_9 = PyObject_IsInstance(__pyx_v_value, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error)
3956
+ __pyx_t_10 = PyObject_IsInstance(__pyx_v_value, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error)
3949
3957
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3950
- if (__pyx_t_9) {
3958
+ if (__pyx_t_10) {
3951
3959
 
3952
3960
  /* "pyogrio/_ogr.pyx":74
3953
3961
  * # normalize bool to ON/OFF
@@ -3956,8 +3964,8 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3956
3964
  * else:
3957
3965
  * value_b = str(value).encode('utf-8')
3958
3966
  */
3959
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 74, __pyx_L1_error)
3960
- if (__pyx_t_9) {
3967
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 74, __pyx_L1_error)
3968
+ if (__pyx_t_10) {
3961
3969
  __Pyx_INCREF(__pyx_n_b_ON);
3962
3970
  __pyx_t_6 = __pyx_n_b_ON;
3963
3971
  } else {
@@ -3985,35 +3993,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
3985
3993
  * value_c = value_b
3986
3994
  */
3987
3995
  /*else*/ {
3988
- __pyx_t_5 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
3996
+ __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
3997
+ __Pyx_GOTREF(__pyx_t_6);
3998
+ __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
3989
3999
  __Pyx_GOTREF(__pyx_t_5);
3990
- __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 76, __pyx_L1_error)
3991
- __Pyx_GOTREF(__pyx_t_8);
3992
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3993
- __pyx_t_5 = NULL;
3994
- __pyx_t_7 = 0;
3995
- #if CYTHON_UNPACK_METHODS
3996
- if (likely(PyMethod_Check(__pyx_t_8))) {
3997
- __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
3998
- if (likely(__pyx_t_5)) {
3999
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
4000
- __Pyx_INCREF(__pyx_t_5);
4001
- __Pyx_INCREF(function);
4002
- __Pyx_DECREF_SET(__pyx_t_8, function);
4003
- __pyx_t_7 = 1;
4004
- }
4005
- }
4006
- #endif
4007
- {
4008
- PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_u_utf_8};
4009
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
4010
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4011
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
4012
- __Pyx_GOTREF(__pyx_t_6);
4013
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4014
- }
4015
- __Pyx_XDECREF_SET(__pyx_v_value_b, __pyx_t_6);
4016
- __pyx_t_6 = 0;
4000
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4001
+ __Pyx_XDECREF_SET(__pyx_v_value_b, __pyx_t_5);
4002
+ __pyx_t_5 = 0;
4017
4003
  }
4018
4004
  __pyx_L6:;
4019
4005
 
@@ -4034,9 +4020,9 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_6set_gdal_config_options(CYTHON_UNUSED
4034
4020
  *
4035
4021
  *
4036
4022
  */
4037
- __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_name_c); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
4038
- __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_value_c); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
4039
- CPLSetConfigOption(((char const *)__pyx_t_11), ((char const *)__pyx_t_12));
4023
+ __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_name_c); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
4024
+ __pyx_t_13 = __Pyx_PyObject_AsString(__pyx_v_value_c); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
4025
+ CPLSetConfigOption(((char const *)__pyx_t_12), ((char const *)__pyx_t_13));
4040
4026
  __pyx_L3_continue:;
4041
4027
  }
4042
4028
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -4192,7 +4178,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_8get_gdal_config_option(CYTHON_UNUSED P
4192
4178
  int __pyx_t_3;
4193
4179
  PyObject *__pyx_t_4 = NULL;
4194
4180
  PyObject *__pyx_t_5 = NULL;
4195
- int __pyx_t_6;
4181
+ unsigned int __pyx_t_6;
4196
4182
  int __pyx_lineno = 0;
4197
4183
  const char *__pyx_filename = NULL;
4198
4184
  int __pyx_clineno = 0;
@@ -4554,7 +4540,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_10ogr_driver_supports_write(CYTHON_UNUS
4554
4540
  PyObject *__pyx_t_1 = NULL;
4555
4541
  PyObject *__pyx_t_2 = NULL;
4556
4542
  PyObject *__pyx_t_3 = NULL;
4557
- int __pyx_t_4;
4543
+ unsigned int __pyx_t_4;
4558
4544
  int __pyx_t_5;
4559
4545
  int __pyx_lineno = 0;
4560
4546
  const char *__pyx_filename = NULL;
@@ -4760,7 +4746,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_12ogr_driver_supports_vsi(CYTHON_UNUSED
4760
4746
  PyObject *__pyx_t_1 = NULL;
4761
4747
  PyObject *__pyx_t_2 = NULL;
4762
4748
  PyObject *__pyx_t_3 = NULL;
4763
- int __pyx_t_4;
4749
+ unsigned int __pyx_t_4;
4764
4750
  int __pyx_t_5;
4765
4751
  int __pyx_lineno = 0;
4766
4752
  const char *__pyx_filename = NULL;
@@ -4894,7 +4880,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_14ogr_list_drivers(CYTHON_UNUSED PyObje
4894
4880
  int __pyx_t_4;
4895
4881
  PyObject *__pyx_t_5 = NULL;
4896
4882
  PyObject *__pyx_t_6 = NULL;
4897
- int __pyx_t_7;
4883
+ unsigned int __pyx_t_7;
4898
4884
  int __pyx_t_8;
4899
4885
  int __pyx_lineno = 0;
4900
4886
  const char *__pyx_filename = NULL;
@@ -5288,7 +5274,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_18get_gdal_data_path(CYTHON_UNUSED PyOb
5288
5274
  PyObject *__pyx_t_2 = NULL;
5289
5275
  PyObject *__pyx_t_3 = NULL;
5290
5276
  PyObject *__pyx_t_4 = NULL;
5291
- int __pyx_t_5;
5277
+ unsigned int __pyx_t_5;
5292
5278
  int __pyx_lineno = 0;
5293
5279
  const char *__pyx_filename = NULL;
5294
5280
  int __pyx_clineno = 0;
@@ -5712,7 +5698,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_22init_gdal_data(CYTHON_UNUSED PyObject
5712
5698
  PyObject *__pyx_t_6 = NULL;
5713
5699
  PyObject *__pyx_t_7 = NULL;
5714
5700
  PyObject *__pyx_t_8 = NULL;
5715
- int __pyx_t_9;
5701
+ unsigned int __pyx_t_9;
5716
5702
  int __pyx_t_10;
5717
5703
  int __pyx_t_11;
5718
5704
  Py_ssize_t __pyx_t_12;
@@ -6348,7 +6334,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_24init_proj_data(CYTHON_UNUSED PyObject
6348
6334
  PyObject *__pyx_t_6 = NULL;
6349
6335
  PyObject *__pyx_t_7 = NULL;
6350
6336
  PyObject *__pyx_t_8 = NULL;
6351
- int __pyx_t_9;
6337
+ unsigned int __pyx_t_9;
6352
6338
  int __pyx_t_10;
6353
6339
  int __pyx_t_11;
6354
6340
  Py_ssize_t __pyx_t_12;
@@ -7078,25 +7064,26 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7078
7064
  PyObject *__pyx_t_4 = NULL;
7079
7065
  PyObject *__pyx_t_5 = NULL;
7080
7066
  PyObject *__pyx_t_6 = NULL;
7081
- int __pyx_t_7;
7067
+ unsigned int __pyx_t_7;
7082
7068
  char const *__pyx_t_8;
7083
7069
  void *__pyx_t_9;
7084
7070
  PyObject *__pyx_t_10 = NULL;
7085
- PyObject *__pyx_t_11 = NULL;
7071
+ int __pyx_t_11;
7086
7072
  PyObject *__pyx_t_12 = NULL;
7087
- Py_ssize_t __pyx_t_13;
7088
- Py_UCS4 __pyx_t_14;
7089
- PyObject *__pyx_t_15 = NULL;
7090
- int __pyx_t_16;
7091
- char const *__pyx_t_17;
7092
- PyObject *__pyx_t_18 = NULL;
7073
+ PyObject *__pyx_t_13 = NULL;
7074
+ Py_ssize_t __pyx_t_14;
7075
+ Py_UCS4 __pyx_t_15;
7076
+ PyObject *__pyx_t_16 = NULL;
7077
+ int __pyx_t_17;
7078
+ char const *__pyx_t_18;
7093
7079
  PyObject *__pyx_t_19 = NULL;
7094
7080
  PyObject *__pyx_t_20 = NULL;
7095
7081
  PyObject *__pyx_t_21 = NULL;
7096
7082
  PyObject *__pyx_t_22 = NULL;
7097
7083
  PyObject *__pyx_t_23 = NULL;
7098
- char const *__pyx_t_24;
7099
- int __pyx_t_25;
7084
+ PyObject *__pyx_t_24 = NULL;
7085
+ char const *__pyx_t_25;
7086
+ int __pyx_t_26;
7100
7087
  int __pyx_lineno = 0;
7101
7088
  const char *__pyx_filename = NULL;
7102
7089
  int __pyx_clineno = 0;
@@ -7199,11 +7186,11 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7199
7186
  __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
7200
7187
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_NullPointerError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 286, __pyx_L5_except_error)
7201
7188
  __Pyx_GOTREF(__pyx_t_10);
7202
- __pyx_t_7 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_10);
7189
+ __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_10);
7203
7190
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7204
7191
  __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
7205
7192
  __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
7206
- if (__pyx_t_7) {
7193
+ if (__pyx_t_11) {
7207
7194
  __Pyx_AddTraceback("pyogrio._ogr._get_driver_metadata_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
7208
7195
  if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 286, __pyx_L5_except_error)
7209
7196
  __Pyx_XGOTREF(__pyx_t_6);
@@ -7217,8 +7204,8 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7217
7204
  * f"Could not obtain driver: {driver} (check that it was installed "
7218
7205
  * "correctly into GDAL)"
7219
7206
  */
7220
- __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_DataSourceError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 287, __pyx_L5_except_error)
7221
- __Pyx_GOTREF(__pyx_t_11);
7207
+ __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_DataSourceError); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 287, __pyx_L5_except_error)
7208
+ __Pyx_GOTREF(__pyx_t_12);
7222
7209
 
7223
7210
  /* "pyogrio/_ogr.pyx":288
7224
7211
  * except NullPointerError:
@@ -7227,50 +7214,50 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7227
7214
  * "correctly into GDAL)"
7228
7215
  * )
7229
7216
  */
7230
- __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7231
- __Pyx_GOTREF(__pyx_t_12);
7232
- __pyx_t_13 = 0;
7233
- __pyx_t_14 = 127;
7217
+ __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7218
+ __Pyx_GOTREF(__pyx_t_13);
7219
+ __pyx_t_14 = 0;
7220
+ __pyx_t_15 = 127;
7234
7221
  __Pyx_INCREF(__pyx_kp_u_Could_not_obtain_driver);
7235
- __pyx_t_13 += 25;
7222
+ __pyx_t_14 += 25;
7236
7223
  __Pyx_GIVEREF(__pyx_kp_u_Could_not_obtain_driver);
7237
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u_Could_not_obtain_driver);
7238
- __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_driver, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7239
- __Pyx_GOTREF(__pyx_t_15);
7240
- __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_14;
7241
- __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
7242
- __Pyx_GIVEREF(__pyx_t_15);
7243
- PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_15);
7244
- __pyx_t_15 = 0;
7224
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Could_not_obtain_driver);
7225
+ __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_v_driver, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7226
+ __Pyx_GOTREF(__pyx_t_16);
7227
+ __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_15;
7228
+ __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16);
7229
+ __Pyx_GIVEREF(__pyx_t_16);
7230
+ PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_16);
7231
+ __pyx_t_16 = 0;
7245
7232
  __Pyx_INCREF(__pyx_kp_u_check_that_it_was_installed_cor);
7246
- __pyx_t_13 += 50;
7233
+ __pyx_t_14 += 50;
7247
7234
  __Pyx_GIVEREF(__pyx_kp_u_check_that_it_was_installed_cor);
7248
- PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u_check_that_it_was_installed_cor);
7249
- __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7250
- __Pyx_GOTREF(__pyx_t_15);
7251
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7252
- __pyx_t_12 = NULL;
7235
+ PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_kp_u_check_that_it_was_installed_cor);
7236
+ __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 288, __pyx_L5_except_error)
7237
+ __Pyx_GOTREF(__pyx_t_16);
7238
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7239
+ __pyx_t_13 = NULL;
7253
7240
  __pyx_t_7 = 0;
7254
7241
  #if CYTHON_UNPACK_METHODS
7255
- if (unlikely(PyMethod_Check(__pyx_t_11))) {
7256
- __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
7257
- if (likely(__pyx_t_12)) {
7258
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
7259
- __Pyx_INCREF(__pyx_t_12);
7242
+ if (unlikely(PyMethod_Check(__pyx_t_12))) {
7243
+ __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
7244
+ if (likely(__pyx_t_13)) {
7245
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7246
+ __Pyx_INCREF(__pyx_t_13);
7260
7247
  __Pyx_INCREF(function);
7261
- __Pyx_DECREF_SET(__pyx_t_11, function);
7248
+ __Pyx_DECREF_SET(__pyx_t_12, function);
7262
7249
  __pyx_t_7 = 1;
7263
7250
  }
7264
7251
  }
7265
7252
  #endif
7266
7253
  {
7267
- PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_15};
7268
- __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7269
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
7270
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7254
+ PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_16};
7255
+ __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7256
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7257
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7271
7258
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L5_except_error)
7272
7259
  __Pyx_GOTREF(__pyx_t_10);
7273
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7260
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7274
7261
  }
7275
7262
  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7276
7263
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -7287,11 +7274,11 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7287
7274
  __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
7288
7275
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 291, __pyx_L5_except_error)
7289
7276
  __Pyx_GOTREF(__pyx_t_10);
7290
- __pyx_t_7 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_10);
7277
+ __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_10);
7291
7278
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7292
7279
  __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
7293
7280
  __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
7294
- if (__pyx_t_7) {
7281
+ if (__pyx_t_11) {
7295
7282
  __Pyx_AddTraceback("pyogrio._ogr._get_driver_metadata_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
7296
7283
  if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L5_except_error)
7297
7284
  __Pyx_XGOTREF(__pyx_t_6);
@@ -7308,32 +7295,32 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7308
7295
  *
7309
7296
  * metadata_c = GDALGetMetadataItem(cogr_driver, metadata_item.encode('UTF-8'), NULL)
7310
7297
  */
7311
- __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_DataSourceError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 292, __pyx_L16_error)
7312
- __Pyx_GOTREF(__pyx_t_11);
7313
- __pyx_t_15 = __Pyx_PyObject_Str(__pyx_v_exc); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 292, __pyx_L16_error)
7314
- __Pyx_GOTREF(__pyx_t_15);
7315
- __pyx_t_12 = NULL;
7298
+ __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_DataSourceError); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 292, __pyx_L16_error)
7299
+ __Pyx_GOTREF(__pyx_t_12);
7300
+ __pyx_t_16 = __Pyx_PyObject_Unicode(__pyx_v_exc); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 292, __pyx_L16_error)
7301
+ __Pyx_GOTREF(__pyx_t_16);
7302
+ __pyx_t_13 = NULL;
7316
7303
  __pyx_t_7 = 0;
7317
7304
  #if CYTHON_UNPACK_METHODS
7318
- if (unlikely(PyMethod_Check(__pyx_t_11))) {
7319
- __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
7320
- if (likely(__pyx_t_12)) {
7321
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
7322
- __Pyx_INCREF(__pyx_t_12);
7305
+ if (unlikely(PyMethod_Check(__pyx_t_12))) {
7306
+ __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
7307
+ if (likely(__pyx_t_13)) {
7308
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7309
+ __Pyx_INCREF(__pyx_t_13);
7323
7310
  __Pyx_INCREF(function);
7324
- __Pyx_DECREF_SET(__pyx_t_11, function);
7311
+ __Pyx_DECREF_SET(__pyx_t_12, function);
7325
7312
  __pyx_t_7 = 1;
7326
7313
  }
7327
7314
  }
7328
7315
  #endif
7329
7316
  {
7330
- PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_15};
7331
- __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7332
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
7333
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7317
+ PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_16};
7318
+ __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7319
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7320
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7334
7321
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L16_error)
7335
7322
  __Pyx_GOTREF(__pyx_t_10);
7336
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7323
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7337
7324
  }
7338
7325
  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7339
7326
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -7352,35 +7339,35 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7352
7339
  /*exception exit:*/{
7353
7340
  __Pyx_PyThreadState_declare
7354
7341
  __Pyx_PyThreadState_assign
7355
- __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
7342
+ __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
7356
7343
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7357
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7358
7344
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
7359
- __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7360
- if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
7361
- if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
7362
- __Pyx_XGOTREF(__pyx_t_18);
7345
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7346
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
7347
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
7348
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
7363
7349
  __Pyx_XGOTREF(__pyx_t_19);
7364
7350
  __Pyx_XGOTREF(__pyx_t_20);
7365
7351
  __Pyx_XGOTREF(__pyx_t_21);
7366
7352
  __Pyx_XGOTREF(__pyx_t_22);
7367
7353
  __Pyx_XGOTREF(__pyx_t_23);
7368
- __pyx_t_7 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
7354
+ __Pyx_XGOTREF(__pyx_t_24);
7355
+ __pyx_t_11 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
7369
7356
  {
7370
7357
  __Pyx_DECREF(__pyx_v_exc); __pyx_v_exc = 0;
7371
7358
  }
7372
7359
  if (PY_MAJOR_VERSION >= 3) {
7373
- __Pyx_XGIVEREF(__pyx_t_21);
7374
7360
  __Pyx_XGIVEREF(__pyx_t_22);
7375
7361
  __Pyx_XGIVEREF(__pyx_t_23);
7376
- __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
7362
+ __Pyx_XGIVEREF(__pyx_t_24);
7363
+ __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
7377
7364
  }
7378
- __Pyx_XGIVEREF(__pyx_t_18);
7379
7365
  __Pyx_XGIVEREF(__pyx_t_19);
7380
7366
  __Pyx_XGIVEREF(__pyx_t_20);
7381
- __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
7382
- __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
7383
- __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
7367
+ __Pyx_XGIVEREF(__pyx_t_21);
7368
+ __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
7369
+ __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
7370
+ __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
7384
7371
  goto __pyx_L5_except_error;
7385
7372
  }
7386
7373
  }
@@ -7413,7 +7400,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7413
7400
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata_item, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 294, __pyx_L1_error)
7414
7401
  __Pyx_GOTREF(__pyx_t_5);
7415
7402
  __pyx_t_6 = NULL;
7416
- __pyx_t_16 = 0;
7403
+ __pyx_t_7 = 0;
7417
7404
  #if CYTHON_UNPACK_METHODS
7418
7405
  if (likely(PyMethod_Check(__pyx_t_5))) {
7419
7406
  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
@@ -7422,20 +7409,20 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7422
7409
  __Pyx_INCREF(__pyx_t_6);
7423
7410
  __Pyx_INCREF(function);
7424
7411
  __Pyx_DECREF_SET(__pyx_t_5, function);
7425
- __pyx_t_16 = 1;
7412
+ __pyx_t_7 = 1;
7426
7413
  }
7427
7414
  }
7428
7415
  #endif
7429
7416
  {
7430
7417
  PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_kp_u_UTF_8};
7431
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16);
7418
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7432
7419
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7433
7420
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
7434
7421
  __Pyx_GOTREF(__pyx_t_4);
7435
7422
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7436
7423
  }
7437
- __pyx_t_24 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_24) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
7438
- __pyx_v_metadata_c = GDALGetMetadataItem(__pyx_v_cogr_driver, __pyx_t_24, NULL);
7424
+ __pyx_t_25 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_25) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
7425
+ __pyx_v_metadata_c = GDALGetMetadataItem(__pyx_v_cogr_driver, __pyx_t_25, NULL);
7439
7426
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7440
7427
 
7441
7428
  /* "pyogrio/_ogr.pyx":296
@@ -7455,8 +7442,8 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7455
7442
  * metadata = metadata_c
7456
7443
  * metadata = metadata.decode('UTF-8')
7457
7444
  */
7458
- __pyx_t_25 = (__pyx_v_metadata_c != NULL);
7459
- if (__pyx_t_25) {
7445
+ __pyx_t_26 = (__pyx_v_metadata_c != NULL);
7446
+ if (__pyx_t_26) {
7460
7447
 
7461
7448
  /* "pyogrio/_ogr.pyx":298
7462
7449
  * metadata = None
@@ -7480,7 +7467,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7480
7467
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
7481
7468
  __Pyx_GOTREF(__pyx_t_5);
7482
7469
  __pyx_t_6 = NULL;
7483
- __pyx_t_16 = 0;
7470
+ __pyx_t_7 = 0;
7484
7471
  #if CYTHON_UNPACK_METHODS
7485
7472
  if (likely(PyMethod_Check(__pyx_t_5))) {
7486
7473
  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
@@ -7489,13 +7476,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7489
7476
  __Pyx_INCREF(__pyx_t_6);
7490
7477
  __Pyx_INCREF(function);
7491
7478
  __Pyx_DECREF_SET(__pyx_t_5, function);
7492
- __pyx_t_16 = 1;
7479
+ __pyx_t_7 = 1;
7493
7480
  }
7494
7481
  }
7495
7482
  #endif
7496
7483
  {
7497
7484
  PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_kp_u_UTF_8};
7498
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16);
7485
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
7499
7486
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7500
7487
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
7501
7488
  __Pyx_GOTREF(__pyx_t_4);
@@ -7511,9 +7498,9 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7511
7498
  * metadata = None
7512
7499
  *
7513
7500
  */
7514
- __pyx_t_13 = PyObject_Length(__pyx_v_metadata); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 300, __pyx_L1_error)
7515
- __pyx_t_25 = (__pyx_t_13 == 0);
7516
- if (__pyx_t_25) {
7501
+ __pyx_t_14 = PyObject_Length(__pyx_v_metadata); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 300, __pyx_L1_error)
7502
+ __pyx_t_26 = (__pyx_t_14 == 0);
7503
+ if (__pyx_t_26) {
7517
7504
 
7518
7505
  /* "pyogrio/_ogr.pyx":301
7519
7506
  * metadata = metadata.decode('UTF-8')
@@ -7569,9 +7556,9 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_28_get_driver_metadata_item(CYTHON_UNUS
7569
7556
  __Pyx_XDECREF(__pyx_t_5);
7570
7557
  __Pyx_XDECREF(__pyx_t_6);
7571
7558
  __Pyx_XDECREF(__pyx_t_10);
7572
- __Pyx_XDECREF(__pyx_t_11);
7573
7559
  __Pyx_XDECREF(__pyx_t_12);
7574
- __Pyx_XDECREF(__pyx_t_15);
7560
+ __Pyx_XDECREF(__pyx_t_13);
7561
+ __Pyx_XDECREF(__pyx_t_16);
7575
7562
  __Pyx_AddTraceback("pyogrio._ogr._get_driver_metadata_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
7576
7563
  __pyx_r = NULL;
7577
7564
  __pyx_L0:;
@@ -7701,7 +7688,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
7701
7688
  PyObject *__pyx_t_1 = NULL;
7702
7689
  PyObject *__pyx_t_2 = NULL;
7703
7690
  PyObject *__pyx_t_3 = NULL;
7704
- int __pyx_t_4;
7691
+ unsigned int __pyx_t_4;
7705
7692
  int __pyx_t_5;
7706
7693
  Py_ssize_t __pyx_t_6;
7707
7694
  int __pyx_t_7;
@@ -7733,7 +7720,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
7733
7720
  *
7734
7721
  * parts = os.path.splitext(path)
7735
7722
  */
7736
- __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
7723
+ __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
7737
7724
  __Pyx_GOTREF(__pyx_t_2);
7738
7725
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
7739
7726
  __Pyx_GOTREF(__pyx_t_3);
@@ -8012,10 +7999,10 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8012
7999
  * driver = OGRGetDriver(i)
8013
8000
  * name_c = <char *>OGR_Dr_GetName(driver)
8014
8001
  */
8015
- __pyx_t_4 = OGRGetDriverCount();
8016
- __pyx_t_8 = __pyx_t_4;
8017
- for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
8018
- __pyx_v_i = __pyx_t_9;
8002
+ __pyx_t_8 = OGRGetDriverCount();
8003
+ __pyx_t_9 = __pyx_t_8;
8004
+ for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
8005
+ __pyx_v_i = __pyx_t_10;
8019
8006
 
8020
8007
  /* "pyogrio/_ogr.pyx":329
8021
8008
  * drivers = []
@@ -8057,7 +8044,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8057
8044
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ogr_driver_supports_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
8058
8045
  __Pyx_GOTREF(__pyx_t_1);
8059
8046
  __pyx_t_2 = NULL;
8060
- __pyx_t_10 = 0;
8047
+ __pyx_t_4 = 0;
8061
8048
  #if CYTHON_UNPACK_METHODS
8062
8049
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
8063
8050
  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
@@ -8066,13 +8053,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8066
8053
  __Pyx_INCREF(__pyx_t_2);
8067
8054
  __Pyx_INCREF(function);
8068
8055
  __Pyx_DECREF_SET(__pyx_t_1, function);
8069
- __pyx_t_10 = 1;
8056
+ __pyx_t_4 = 1;
8070
8057
  }
8071
8058
  }
8072
8059
  #endif
8073
8060
  {
8074
8061
  PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
8075
- __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
8062
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
8076
8063
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8077
8064
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
8078
8065
  __Pyx_GOTREF(__pyx_t_3);
@@ -8111,7 +8098,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8111
8098
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
8112
8099
  __Pyx_GOTREF(__pyx_t_1);
8113
8100
  __pyx_t_2 = NULL;
8114
- __pyx_t_10 = 0;
8101
+ __pyx_t_4 = 0;
8115
8102
  #if CYTHON_UNPACK_METHODS
8116
8103
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
8117
8104
  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
@@ -8120,13 +8107,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8120
8107
  __Pyx_INCREF(__pyx_t_2);
8121
8108
  __Pyx_INCREF(function);
8122
8109
  __Pyx_DECREF_SET(__pyx_t_1, function);
8123
- __pyx_t_10 = 1;
8110
+ __pyx_t_4 = 1;
8124
8111
  }
8125
8112
  }
8126
8113
  #endif
8127
8114
  {
8128
8115
  PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_name, __pyx_n_u_DMD_EXTENSIONS};
8129
- __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10);
8116
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
8130
8117
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8131
8118
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
8132
8119
  __Pyx_GOTREF(__pyx_t_3);
@@ -8157,7 +8144,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8157
8144
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error)
8158
8145
  __Pyx_GOTREF(__pyx_t_2);
8159
8146
  __pyx_t_11 = NULL;
8160
- __pyx_t_10 = 0;
8147
+ __pyx_t_4 = 0;
8161
8148
  #if CYTHON_UNPACK_METHODS
8162
8149
  if (likely(PyMethod_Check(__pyx_t_2))) {
8163
8150
  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
@@ -8166,13 +8153,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8166
8153
  __Pyx_INCREF(__pyx_t_11);
8167
8154
  __Pyx_INCREF(function);
8168
8155
  __Pyx_DECREF_SET(__pyx_t_2, function);
8169
- __pyx_t_10 = 1;
8156
+ __pyx_t_4 = 1;
8170
8157
  }
8171
8158
  }
8172
8159
  #endif
8173
8160
  {
8174
8161
  PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
8175
- __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
8162
+ __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
8176
8163
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
8177
8164
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
8178
8165
  __Pyx_GOTREF(__pyx_t_1);
@@ -8182,7 +8169,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8182
8169
  __Pyx_GOTREF(__pyx_t_2);
8183
8170
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8184
8171
  __pyx_t_1 = NULL;
8185
- __pyx_t_10 = 0;
8172
+ __pyx_t_4 = 0;
8186
8173
  #if CYTHON_UNPACK_METHODS
8187
8174
  if (likely(PyMethod_Check(__pyx_t_2))) {
8188
8175
  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
@@ -8191,13 +8178,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8191
8178
  __Pyx_INCREF(__pyx_t_1);
8192
8179
  __Pyx_INCREF(function);
8193
8180
  __Pyx_DECREF_SET(__pyx_t_2, function);
8194
- __pyx_t_10 = 1;
8181
+ __pyx_t_4 = 1;
8195
8182
  }
8196
8183
  }
8197
8184
  #endif
8198
8185
  {
8199
8186
  PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__6};
8200
- __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
8187
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
8201
8188
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8202
8189
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
8203
8190
  __Pyx_GOTREF(__pyx_t_3);
@@ -8239,7 +8226,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8239
8226
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_driver_metadata_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
8240
8227
  __Pyx_GOTREF(__pyx_t_2);
8241
8228
  __pyx_t_1 = NULL;
8242
- __pyx_t_10 = 0;
8229
+ __pyx_t_4 = 0;
8243
8230
  #if CYTHON_UNPACK_METHODS
8244
8231
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
8245
8232
  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
@@ -8248,13 +8235,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8248
8235
  __Pyx_INCREF(__pyx_t_1);
8249
8236
  __Pyx_INCREF(function);
8250
8237
  __Pyx_DECREF_SET(__pyx_t_2, function);
8251
- __pyx_t_10 = 1;
8238
+ __pyx_t_4 = 1;
8252
8239
  }
8253
8240
  }
8254
8241
  #endif
8255
8242
  {
8256
8243
  PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_name, __pyx_n_u_DMD_CONNECTION_PREFIX};
8257
- __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10);
8244
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
8258
8245
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8259
8246
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
8260
8247
  __Pyx_GOTREF(__pyx_t_3);
@@ -8281,7 +8268,7 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8281
8268
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix, __pyx_n_s_lower); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 343, __pyx_L1_error)
8282
8269
  __Pyx_GOTREF(__pyx_t_11);
8283
8270
  __pyx_t_13 = NULL;
8284
- __pyx_t_10 = 0;
8271
+ __pyx_t_4 = 0;
8285
8272
  #if CYTHON_UNPACK_METHODS
8286
8273
  if (likely(PyMethod_Check(__pyx_t_11))) {
8287
8274
  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
@@ -8290,20 +8277,20 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8290
8277
  __Pyx_INCREF(__pyx_t_13);
8291
8278
  __Pyx_INCREF(function);
8292
8279
  __Pyx_DECREF_SET(__pyx_t_11, function);
8293
- __pyx_t_10 = 1;
8280
+ __pyx_t_4 = 1;
8294
8281
  }
8295
8282
  }
8296
8283
  #endif
8297
8284
  {
8298
8285
  PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
8299
- __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
8286
+ __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
8300
8287
  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
8301
8288
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
8302
8289
  __Pyx_GOTREF(__pyx_t_1);
8303
8290
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8304
8291
  }
8305
8292
  __pyx_t_11 = NULL;
8306
- __pyx_t_10 = 0;
8293
+ __pyx_t_4 = 0;
8307
8294
  #if CYTHON_UNPACK_METHODS
8308
8295
  if (likely(PyMethod_Check(__pyx_t_2))) {
8309
8296
  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
@@ -8312,13 +8299,13 @@ static PyObject *__pyx_pf_7pyogrio_4_ogr_30_get_drivers_for_path(CYTHON_UNUSED P
8312
8299
  __Pyx_INCREF(__pyx_t_11);
8313
8300
  __Pyx_INCREF(function);
8314
8301
  __Pyx_DECREF_SET(__pyx_t_2, function);
8315
- __pyx_t_10 = 1;
8302
+ __pyx_t_4 = 1;
8316
8303
  }
8317
8304
  }
8318
8305
  #endif
8319
8306
  {
8320
8307
  PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_1};
8321
- __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
8308
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
8322
8309
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
8323
8310
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8324
8311
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
@@ -8882,9 +8869,9 @@ static int __Pyx_modinit_function_import_code(void) {
8882
8869
  /*--- Function import code ---*/
8883
8870
  __pyx_t_1 = PyImport_ImportModule("pyogrio._err"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
8884
8871
  __Pyx_GOTREF(__pyx_t_1);
8885
- if (__Pyx_ImportFunction_3_0_10(__pyx_t_1, "exc_wrap_int", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_int, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8886
- if (__Pyx_ImportFunction_3_0_10(__pyx_t_1, "exc_wrap_ogrerr", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_ogrerr, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8887
- if (__Pyx_ImportFunction_3_0_10(__pyx_t_1, "exc_wrap_pointer", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_pointer, "void *(void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8872
+ if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "exc_wrap_int", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_int, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8873
+ if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "exc_wrap_ogrerr", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_ogrerr, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8874
+ if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "exc_wrap_pointer", (void (**)(void))&__pyx_f_7pyogrio_4_err_exc_wrap_pointer, "void *(void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8888
8875
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8889
8876
  __Pyx_RefNannyFinishContext();
8890
8877
  return 0;
@@ -13319,6 +13306,9 @@ static PyTypeObject __pyx_CyFunctionType_type = {
13319
13306
  #if PY_VERSION_HEX >= 0x030C0000
13320
13307
  0,
13321
13308
  #endif
13309
+ #if PY_VERSION_HEX >= 0x030d00A4
13310
+ 0,
13311
+ #endif
13322
13312
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
13323
13313
  0,
13324
13314
  #endif
@@ -13745,12 +13735,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
13745
13735
  }
13746
13736
  }
13747
13737
  {
13748
- int one = 1; int little = (int)*(unsigned char *)&one;
13749
13738
  unsigned char *bytes = (unsigned char *)&value;
13750
- #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
13739
+ #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
13740
+ if (is_unsigned) {
13741
+ return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
13742
+ } else {
13743
+ return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
13744
+ }
13745
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
13746
+ int one = 1; int little = (int)*(unsigned char *)&one;
13751
13747
  return _PyLong_FromByteArray(bytes, sizeof(int),
13752
13748
  little, !is_unsigned);
13753
13749
  #else
13750
+ int one = 1; int little = (int)*(unsigned char *)&one;
13754
13751
  PyObject *from_bytes, *result = NULL;
13755
13752
  PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
13756
13753
  from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
@@ -13800,245 +13797,239 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13800
13797
  }
13801
13798
  return (int) val;
13802
13799
  }
13803
- } else
13800
+ }
13804
13801
  #endif
13805
- if (likely(PyLong_Check(x))) {
13806
- if (is_unsigned) {
13802
+ if (unlikely(!PyLong_Check(x))) {
13803
+ int val;
13804
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13805
+ if (!tmp) return (int) -1;
13806
+ val = __Pyx_PyInt_As_int(tmp);
13807
+ Py_DECREF(tmp);
13808
+ return val;
13809
+ }
13810
+ if (is_unsigned) {
13807
13811
  #if CYTHON_USE_PYLONG_INTERNALS
13808
- if (unlikely(__Pyx_PyLong_IsNeg(x))) {
13809
- goto raise_neg_overflow;
13810
- } else if (__Pyx_PyLong_IsCompact(x)) {
13811
- __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
13812
- } else {
13813
- const digit* digits = __Pyx_PyLong_Digits(x);
13814
- assert(__Pyx_PyLong_DigitCount(x) > 1);
13815
- switch (__Pyx_PyLong_DigitCount(x)) {
13816
- case 2:
13817
- if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
13818
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13819
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13820
- } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
13821
- return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13822
- }
13812
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
13813
+ goto raise_neg_overflow;
13814
+ } else if (__Pyx_PyLong_IsCompact(x)) {
13815
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
13816
+ } else {
13817
+ const digit* digits = __Pyx_PyLong_Digits(x);
13818
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
13819
+ switch (__Pyx_PyLong_DigitCount(x)) {
13820
+ case 2:
13821
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
13822
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13823
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13824
+ } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
13825
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13823
13826
  }
13824
- break;
13825
- case 3:
13826
- if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
13827
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13828
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13829
- } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
13830
- return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13831
- }
13827
+ }
13828
+ break;
13829
+ case 3:
13830
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
13831
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13832
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13833
+ } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
13834
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13832
13835
  }
13833
- break;
13834
- case 4:
13835
- if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
13836
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13837
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13838
- } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
13839
- return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13840
- }
13836
+ }
13837
+ break;
13838
+ case 4:
13839
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
13840
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13841
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13842
+ } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
13843
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13841
13844
  }
13842
- break;
13843
- }
13845
+ }
13846
+ break;
13844
13847
  }
13848
+ }
13845
13849
  #endif
13846
13850
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
13847
- if (unlikely(Py_SIZE(x) < 0)) {
13848
- goto raise_neg_overflow;
13849
- }
13851
+ if (unlikely(Py_SIZE(x) < 0)) {
13852
+ goto raise_neg_overflow;
13853
+ }
13850
13854
  #else
13851
- {
13852
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13853
- if (unlikely(result < 0))
13854
- return (int) -1;
13855
- if (unlikely(result == 1))
13856
- goto raise_neg_overflow;
13857
- }
13855
+ {
13856
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13857
+ if (unlikely(result < 0))
13858
+ return (int) -1;
13859
+ if (unlikely(result == 1))
13860
+ goto raise_neg_overflow;
13861
+ }
13858
13862
  #endif
13859
- if ((sizeof(int) <= sizeof(unsigned long))) {
13860
- __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13863
+ if ((sizeof(int) <= sizeof(unsigned long))) {
13864
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13861
13865
  #ifdef HAVE_LONG_LONG
13862
- } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
13863
- __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13866
+ } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
13867
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13864
13868
  #endif
13865
- }
13866
- } else {
13869
+ }
13870
+ } else {
13867
13871
  #if CYTHON_USE_PYLONG_INTERNALS
13868
- if (__Pyx_PyLong_IsCompact(x)) {
13869
- __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
13870
- } else {
13871
- const digit* digits = __Pyx_PyLong_Digits(x);
13872
- assert(__Pyx_PyLong_DigitCount(x) > 1);
13873
- switch (__Pyx_PyLong_SignedDigitCount(x)) {
13874
- case -2:
13875
- if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
13876
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13877
- __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13878
- } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13879
- return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13880
- }
13872
+ if (__Pyx_PyLong_IsCompact(x)) {
13873
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
13874
+ } else {
13875
+ const digit* digits = __Pyx_PyLong_Digits(x);
13876
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
13877
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
13878
+ case -2:
13879
+ if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
13880
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13881
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13882
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13883
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13881
13884
  }
13882
- break;
13883
- case 2:
13884
- if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
13885
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13886
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13887
- } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13888
- return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13889
- }
13885
+ }
13886
+ break;
13887
+ case 2:
13888
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
13889
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
13890
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13891
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13892
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13890
13893
  }
13891
- break;
13892
- case -3:
13893
- if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13894
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13895
- __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13896
- } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13897
- return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13898
- }
13894
+ }
13895
+ break;
13896
+ case -3:
13897
+ if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
13898
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13899
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13900
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13901
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13899
13902
  }
13900
- break;
13901
- case 3:
13902
- if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
13903
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13904
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13905
- } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13906
- return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13907
- }
13903
+ }
13904
+ break;
13905
+ case 3:
13906
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
13907
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
13908
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13909
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13910
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13908
13911
  }
13909
- break;
13910
- case -4:
13911
- if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13912
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13913
- __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13914
- } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
13915
- return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13916
- }
13912
+ }
13913
+ break;
13914
+ case -4:
13915
+ if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
13916
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13917
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13918
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
13919
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13917
13920
  }
13918
- break;
13919
- case 4:
13920
- if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
13921
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13922
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13923
- } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
13924
- return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13925
- }
13921
+ }
13922
+ break;
13923
+ case 4:
13924
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
13925
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
13926
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13927
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
13928
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13926
13929
  }
13927
- break;
13928
- }
13930
+ }
13931
+ break;
13929
13932
  }
13933
+ }
13930
13934
  #endif
13931
- if ((sizeof(int) <= sizeof(long))) {
13932
- __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13935
+ if ((sizeof(int) <= sizeof(long))) {
13936
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13933
13937
  #ifdef HAVE_LONG_LONG
13934
- } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
13935
- __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13938
+ } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
13939
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13936
13940
  #endif
13937
- }
13941
+ }
13942
+ }
13943
+ {
13944
+ int val;
13945
+ int ret = -1;
13946
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
13947
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
13948
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
13949
+ if (unlikely(bytes_copied == -1)) {
13950
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
13951
+ goto raise_overflow;
13952
+ } else {
13953
+ ret = 0;
13954
+ }
13955
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
13956
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
13957
+ unsigned char *bytes = (unsigned char *)&val;
13958
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
13959
+ bytes, sizeof(val),
13960
+ is_little, !is_unsigned);
13961
+ #else
13962
+ PyObject *v;
13963
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
13964
+ int bits, remaining_bits, is_negative = 0;
13965
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
13966
+ if (likely(PyLong_CheckExact(x))) {
13967
+ v = __Pyx_NewRef(x);
13968
+ } else {
13969
+ v = PyNumber_Long(x);
13970
+ if (unlikely(!v)) return (int) -1;
13971
+ assert(PyLong_CheckExact(v));
13938
13972
  }
13939
13973
  {
13940
- int val;
13941
- PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13942
- #if PY_MAJOR_VERSION < 3
13943
- if (likely(v) && !PyLong_Check(v)) {
13944
- PyObject *tmp = v;
13945
- v = PyNumber_Long(tmp);
13946
- Py_DECREF(tmp);
13947
- }
13948
- #endif
13949
- if (likely(v)) {
13950
- int ret = -1;
13951
- #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
13952
- int one = 1; int is_little = (int)*(unsigned char *)&one;
13953
- unsigned char *bytes = (unsigned char *)&val;
13954
- ret = _PyLong_AsByteArray((PyLongObject *)v,
13955
- bytes, sizeof(val),
13956
- is_little, !is_unsigned);
13957
- #else
13958
- PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
13959
- int bits, remaining_bits, is_negative = 0;
13960
- long idigit;
13961
- int chunk_size = (sizeof(long) < 8) ? 30 : 62;
13962
- if (unlikely(!PyLong_CheckExact(v))) {
13963
- PyObject *tmp = v;
13964
- v = PyNumber_Long(v);
13965
- assert(PyLong_CheckExact(v));
13966
- Py_DECREF(tmp);
13967
- if (unlikely(!v)) return (int) -1;
13968
- }
13969
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
13970
- if (Py_SIZE(x) == 0)
13971
- return (int) 0;
13972
- is_negative = Py_SIZE(x) < 0;
13973
- #else
13974
- {
13975
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13976
- if (unlikely(result < 0))
13977
- return (int) -1;
13978
- is_negative = result == 1;
13979
- }
13980
- #endif
13981
- if (is_unsigned && unlikely(is_negative)) {
13982
- goto raise_neg_overflow;
13983
- } else if (is_negative) {
13984
- stepval = PyNumber_Invert(v);
13985
- if (unlikely(!stepval))
13986
- return (int) -1;
13987
- } else {
13988
- stepval = __Pyx_NewRef(v);
13989
- }
13990
- val = (int) 0;
13991
- mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
13992
- shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
13993
- for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
13994
- PyObject *tmp, *digit;
13995
- digit = PyNumber_And(stepval, mask);
13996
- if (unlikely(!digit)) goto done;
13997
- idigit = PyLong_AsLong(digit);
13998
- Py_DECREF(digit);
13999
- if (unlikely(idigit < 0)) goto done;
14000
- tmp = PyNumber_Rshift(stepval, shift);
14001
- if (unlikely(!tmp)) goto done;
14002
- Py_DECREF(stepval); stepval = tmp;
14003
- val |= ((int) idigit) << bits;
14004
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
14005
- if (Py_SIZE(stepval) == 0)
14006
- goto unpacking_done;
14007
- #endif
14008
- }
14009
- idigit = PyLong_AsLong(stepval);
14010
- if (unlikely(idigit < 0)) goto done;
14011
- remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
14012
- if (unlikely(idigit >= (1L << remaining_bits)))
14013
- goto raise_overflow;
14014
- val |= ((int) idigit) << bits;
14015
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
14016
- unpacking_done:
14017
- #endif
14018
- if (!is_unsigned) {
14019
- if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
14020
- goto raise_overflow;
14021
- if (is_negative)
14022
- val = ~val;
14023
- }
14024
- ret = 0;
14025
- done:
14026
- Py_XDECREF(shift);
14027
- Py_XDECREF(mask);
14028
- Py_XDECREF(stepval);
14029
- #endif
13974
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
13975
+ if (unlikely(result < 0)) {
14030
13976
  Py_DECREF(v);
14031
- if (likely(!ret))
14032
- return val;
13977
+ return (int) -1;
14033
13978
  }
14034
- return (int) -1;
13979
+ is_negative = result == 1;
14035
13980
  }
14036
- } else {
14037
- int val;
14038
- PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14039
- if (!tmp) return (int) -1;
14040
- val = __Pyx_PyInt_As_int(tmp);
14041
- Py_DECREF(tmp);
13981
+ if (is_unsigned && unlikely(is_negative)) {
13982
+ Py_DECREF(v);
13983
+ goto raise_neg_overflow;
13984
+ } else if (is_negative) {
13985
+ stepval = PyNumber_Invert(v);
13986
+ Py_DECREF(v);
13987
+ if (unlikely(!stepval))
13988
+ return (int) -1;
13989
+ } else {
13990
+ stepval = v;
13991
+ }
13992
+ v = NULL;
13993
+ val = (int) 0;
13994
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
13995
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
13996
+ for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
13997
+ PyObject *tmp, *digit;
13998
+ long idigit;
13999
+ digit = PyNumber_And(stepval, mask);
14000
+ if (unlikely(!digit)) goto done;
14001
+ idigit = PyLong_AsLong(digit);
14002
+ Py_DECREF(digit);
14003
+ if (unlikely(idigit < 0)) goto done;
14004
+ val |= ((int) idigit) << bits;
14005
+ tmp = PyNumber_Rshift(stepval, shift);
14006
+ if (unlikely(!tmp)) goto done;
14007
+ Py_DECREF(stepval); stepval = tmp;
14008
+ }
14009
+ Py_DECREF(shift); shift = NULL;
14010
+ Py_DECREF(mask); mask = NULL;
14011
+ {
14012
+ long idigit = PyLong_AsLong(stepval);
14013
+ if (unlikely(idigit < 0)) goto done;
14014
+ remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
14015
+ if (unlikely(idigit >= (1L << remaining_bits)))
14016
+ goto raise_overflow;
14017
+ val |= ((int) idigit) << bits;
14018
+ }
14019
+ if (!is_unsigned) {
14020
+ if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
14021
+ goto raise_overflow;
14022
+ if (is_negative)
14023
+ val = ~val;
14024
+ }
14025
+ ret = 0;
14026
+ done:
14027
+ Py_XDECREF(shift);
14028
+ Py_XDECREF(mask);
14029
+ Py_XDECREF(stepval);
14030
+ #endif
14031
+ if (unlikely(ret))
14032
+ return (int) -1;
14042
14033
  return val;
14043
14034
  }
14044
14035
  raise_overflow:
@@ -14082,12 +14073,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
14082
14073
  }
14083
14074
  }
14084
14075
  {
14085
- int one = 1; int little = (int)*(unsigned char *)&one;
14086
14076
  unsigned char *bytes = (unsigned char *)&value;
14087
- #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
14077
+ #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
14078
+ if (is_unsigned) {
14079
+ return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
14080
+ } else {
14081
+ return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
14082
+ }
14083
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
14084
+ int one = 1; int little = (int)*(unsigned char *)&one;
14088
14085
  return _PyLong_FromByteArray(bytes, sizeof(long),
14089
14086
  little, !is_unsigned);
14090
14087
  #else
14088
+ int one = 1; int little = (int)*(unsigned char *)&one;
14091
14089
  PyObject *from_bytes, *result = NULL;
14092
14090
  PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
14093
14091
  from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
@@ -14153,245 +14151,239 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
14153
14151
  }
14154
14152
  return (long) val;
14155
14153
  }
14156
- } else
14154
+ }
14157
14155
  #endif
14158
- if (likely(PyLong_Check(x))) {
14159
- if (is_unsigned) {
14156
+ if (unlikely(!PyLong_Check(x))) {
14157
+ long val;
14158
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14159
+ if (!tmp) return (long) -1;
14160
+ val = __Pyx_PyInt_As_long(tmp);
14161
+ Py_DECREF(tmp);
14162
+ return val;
14163
+ }
14164
+ if (is_unsigned) {
14160
14165
  #if CYTHON_USE_PYLONG_INTERNALS
14161
- if (unlikely(__Pyx_PyLong_IsNeg(x))) {
14162
- goto raise_neg_overflow;
14163
- } else if (__Pyx_PyLong_IsCompact(x)) {
14164
- __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
14165
- } else {
14166
- const digit* digits = __Pyx_PyLong_Digits(x);
14167
- assert(__Pyx_PyLong_DigitCount(x) > 1);
14168
- switch (__Pyx_PyLong_DigitCount(x)) {
14169
- case 2:
14170
- if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
14171
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14172
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14173
- } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
14174
- return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14175
- }
14166
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
14167
+ goto raise_neg_overflow;
14168
+ } else if (__Pyx_PyLong_IsCompact(x)) {
14169
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
14170
+ } else {
14171
+ const digit* digits = __Pyx_PyLong_Digits(x);
14172
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
14173
+ switch (__Pyx_PyLong_DigitCount(x)) {
14174
+ case 2:
14175
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
14176
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14177
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14178
+ } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
14179
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14176
14180
  }
14177
- break;
14178
- case 3:
14179
- if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
14180
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14181
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14182
- } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
14183
- return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14184
- }
14181
+ }
14182
+ break;
14183
+ case 3:
14184
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
14185
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14186
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14187
+ } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
14188
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14185
14189
  }
14186
- break;
14187
- case 4:
14188
- if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
14189
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14190
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14191
- } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
14192
- return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14193
- }
14190
+ }
14191
+ break;
14192
+ case 4:
14193
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
14194
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14195
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14196
+ } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
14197
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14194
14198
  }
14195
- break;
14196
- }
14199
+ }
14200
+ break;
14197
14201
  }
14202
+ }
14198
14203
  #endif
14199
14204
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
14200
- if (unlikely(Py_SIZE(x) < 0)) {
14201
- goto raise_neg_overflow;
14202
- }
14205
+ if (unlikely(Py_SIZE(x) < 0)) {
14206
+ goto raise_neg_overflow;
14207
+ }
14203
14208
  #else
14204
- {
14205
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14206
- if (unlikely(result < 0))
14207
- return (long) -1;
14208
- if (unlikely(result == 1))
14209
- goto raise_neg_overflow;
14210
- }
14209
+ {
14210
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14211
+ if (unlikely(result < 0))
14212
+ return (long) -1;
14213
+ if (unlikely(result == 1))
14214
+ goto raise_neg_overflow;
14215
+ }
14211
14216
  #endif
14212
- if ((sizeof(long) <= sizeof(unsigned long))) {
14213
- __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
14217
+ if ((sizeof(long) <= sizeof(unsigned long))) {
14218
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
14214
14219
  #ifdef HAVE_LONG_LONG
14215
- } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
14216
- __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14220
+ } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
14221
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14217
14222
  #endif
14218
- }
14219
- } else {
14223
+ }
14224
+ } else {
14220
14225
  #if CYTHON_USE_PYLONG_INTERNALS
14221
- if (__Pyx_PyLong_IsCompact(x)) {
14222
- __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
14223
- } else {
14224
- const digit* digits = __Pyx_PyLong_Digits(x);
14225
- assert(__Pyx_PyLong_DigitCount(x) > 1);
14226
- switch (__Pyx_PyLong_SignedDigitCount(x)) {
14227
- case -2:
14228
- if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
14229
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14230
- __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14231
- } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14232
- return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14233
- }
14226
+ if (__Pyx_PyLong_IsCompact(x)) {
14227
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
14228
+ } else {
14229
+ const digit* digits = __Pyx_PyLong_Digits(x);
14230
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
14231
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
14232
+ case -2:
14233
+ if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
14234
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14235
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14236
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14237
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14234
14238
  }
14235
- break;
14236
- case 2:
14237
- if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
14238
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14239
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14240
- } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14241
- return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14242
- }
14239
+ }
14240
+ break;
14241
+ case 2:
14242
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
14243
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14244
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14245
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14246
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14243
14247
  }
14244
- break;
14245
- case -3:
14246
- if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14247
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14248
- __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14249
- } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14250
- return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14251
- }
14248
+ }
14249
+ break;
14250
+ case -3:
14251
+ if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
14252
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14253
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14254
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14255
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14252
14256
  }
14253
- break;
14254
- case 3:
14255
- if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
14256
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14257
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14258
- } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14259
- return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14260
- }
14257
+ }
14258
+ break;
14259
+ case 3:
14260
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
14261
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14262
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14263
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14264
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14261
14265
  }
14262
- break;
14263
- case -4:
14264
- if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14265
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14266
- __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14267
- } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
14268
- return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14269
- }
14266
+ }
14267
+ break;
14268
+ case -4:
14269
+ if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
14270
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14271
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14272
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
14273
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14270
14274
  }
14271
- break;
14272
- case 4:
14273
- if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
14274
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14275
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14276
- } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
14277
- return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14278
- }
14275
+ }
14276
+ break;
14277
+ case 4:
14278
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
14279
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14280
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14281
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
14282
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14279
14283
  }
14280
- break;
14281
- }
14284
+ }
14285
+ break;
14282
14286
  }
14287
+ }
14283
14288
  #endif
14284
- if ((sizeof(long) <= sizeof(long))) {
14285
- __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
14289
+ if ((sizeof(long) <= sizeof(long))) {
14290
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
14286
14291
  #ifdef HAVE_LONG_LONG
14287
- } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
14288
- __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
14292
+ } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
14293
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
14289
14294
  #endif
14290
- }
14295
+ }
14296
+ }
14297
+ {
14298
+ long val;
14299
+ int ret = -1;
14300
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
14301
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
14302
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
14303
+ if (unlikely(bytes_copied == -1)) {
14304
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
14305
+ goto raise_overflow;
14306
+ } else {
14307
+ ret = 0;
14308
+ }
14309
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
14310
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
14311
+ unsigned char *bytes = (unsigned char *)&val;
14312
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
14313
+ bytes, sizeof(val),
14314
+ is_little, !is_unsigned);
14315
+ #else
14316
+ PyObject *v;
14317
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
14318
+ int bits, remaining_bits, is_negative = 0;
14319
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
14320
+ if (likely(PyLong_CheckExact(x))) {
14321
+ v = __Pyx_NewRef(x);
14322
+ } else {
14323
+ v = PyNumber_Long(x);
14324
+ if (unlikely(!v)) return (long) -1;
14325
+ assert(PyLong_CheckExact(v));
14291
14326
  }
14292
14327
  {
14293
- long val;
14294
- PyObject *v = __Pyx_PyNumber_IntOrLong(x);
14295
- #if PY_MAJOR_VERSION < 3
14296
- if (likely(v) && !PyLong_Check(v)) {
14297
- PyObject *tmp = v;
14298
- v = PyNumber_Long(tmp);
14299
- Py_DECREF(tmp);
14300
- }
14301
- #endif
14302
- if (likely(v)) {
14303
- int ret = -1;
14304
- #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
14305
- int one = 1; int is_little = (int)*(unsigned char *)&one;
14306
- unsigned char *bytes = (unsigned char *)&val;
14307
- ret = _PyLong_AsByteArray((PyLongObject *)v,
14308
- bytes, sizeof(val),
14309
- is_little, !is_unsigned);
14310
- #else
14311
- PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
14312
- int bits, remaining_bits, is_negative = 0;
14313
- long idigit;
14314
- int chunk_size = (sizeof(long) < 8) ? 30 : 62;
14315
- if (unlikely(!PyLong_CheckExact(v))) {
14316
- PyObject *tmp = v;
14317
- v = PyNumber_Long(v);
14318
- assert(PyLong_CheckExact(v));
14319
- Py_DECREF(tmp);
14320
- if (unlikely(!v)) return (long) -1;
14321
- }
14322
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
14323
- if (Py_SIZE(x) == 0)
14324
- return (long) 0;
14325
- is_negative = Py_SIZE(x) < 0;
14326
- #else
14327
- {
14328
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14329
- if (unlikely(result < 0))
14330
- return (long) -1;
14331
- is_negative = result == 1;
14332
- }
14333
- #endif
14334
- if (is_unsigned && unlikely(is_negative)) {
14335
- goto raise_neg_overflow;
14336
- } else if (is_negative) {
14337
- stepval = PyNumber_Invert(v);
14338
- if (unlikely(!stepval))
14339
- return (long) -1;
14340
- } else {
14341
- stepval = __Pyx_NewRef(v);
14342
- }
14343
- val = (long) 0;
14344
- mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
14345
- shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
14346
- for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
14347
- PyObject *tmp, *digit;
14348
- digit = PyNumber_And(stepval, mask);
14349
- if (unlikely(!digit)) goto done;
14350
- idigit = PyLong_AsLong(digit);
14351
- Py_DECREF(digit);
14352
- if (unlikely(idigit < 0)) goto done;
14353
- tmp = PyNumber_Rshift(stepval, shift);
14354
- if (unlikely(!tmp)) goto done;
14355
- Py_DECREF(stepval); stepval = tmp;
14356
- val |= ((long) idigit) << bits;
14357
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
14358
- if (Py_SIZE(stepval) == 0)
14359
- goto unpacking_done;
14360
- #endif
14361
- }
14362
- idigit = PyLong_AsLong(stepval);
14363
- if (unlikely(idigit < 0)) goto done;
14364
- remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
14365
- if (unlikely(idigit >= (1L << remaining_bits)))
14366
- goto raise_overflow;
14367
- val |= ((long) idigit) << bits;
14368
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
14369
- unpacking_done:
14370
- #endif
14371
- if (!is_unsigned) {
14372
- if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
14373
- goto raise_overflow;
14374
- if (is_negative)
14375
- val = ~val;
14376
- }
14377
- ret = 0;
14378
- done:
14379
- Py_XDECREF(shift);
14380
- Py_XDECREF(mask);
14381
- Py_XDECREF(stepval);
14382
- #endif
14328
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
14329
+ if (unlikely(result < 0)) {
14383
14330
  Py_DECREF(v);
14384
- if (likely(!ret))
14385
- return val;
14331
+ return (long) -1;
14386
14332
  }
14387
- return (long) -1;
14333
+ is_negative = result == 1;
14388
14334
  }
14389
- } else {
14390
- long val;
14391
- PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14392
- if (!tmp) return (long) -1;
14393
- val = __Pyx_PyInt_As_long(tmp);
14394
- Py_DECREF(tmp);
14335
+ if (is_unsigned && unlikely(is_negative)) {
14336
+ Py_DECREF(v);
14337
+ goto raise_neg_overflow;
14338
+ } else if (is_negative) {
14339
+ stepval = PyNumber_Invert(v);
14340
+ Py_DECREF(v);
14341
+ if (unlikely(!stepval))
14342
+ return (long) -1;
14343
+ } else {
14344
+ stepval = v;
14345
+ }
14346
+ v = NULL;
14347
+ val = (long) 0;
14348
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
14349
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
14350
+ for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
14351
+ PyObject *tmp, *digit;
14352
+ long idigit;
14353
+ digit = PyNumber_And(stepval, mask);
14354
+ if (unlikely(!digit)) goto done;
14355
+ idigit = PyLong_AsLong(digit);
14356
+ Py_DECREF(digit);
14357
+ if (unlikely(idigit < 0)) goto done;
14358
+ val |= ((long) idigit) << bits;
14359
+ tmp = PyNumber_Rshift(stepval, shift);
14360
+ if (unlikely(!tmp)) goto done;
14361
+ Py_DECREF(stepval); stepval = tmp;
14362
+ }
14363
+ Py_DECREF(shift); shift = NULL;
14364
+ Py_DECREF(mask); mask = NULL;
14365
+ {
14366
+ long idigit = PyLong_AsLong(stepval);
14367
+ if (unlikely(idigit < 0)) goto done;
14368
+ remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
14369
+ if (unlikely(idigit >= (1L << remaining_bits)))
14370
+ goto raise_overflow;
14371
+ val |= ((long) idigit) << bits;
14372
+ }
14373
+ if (!is_unsigned) {
14374
+ if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
14375
+ goto raise_overflow;
14376
+ if (is_negative)
14377
+ val = ~val;
14378
+ }
14379
+ ret = 0;
14380
+ done:
14381
+ Py_XDECREF(shift);
14382
+ Py_XDECREF(mask);
14383
+ Py_XDECREF(stepval);
14384
+ #endif
14385
+ if (unlikely(ret))
14386
+ return (long) -1;
14395
14387
  return val;
14396
14388
  }
14397
14389
  raise_overflow:
@@ -14485,9 +14477,9 @@ bad:
14485
14477
  }
14486
14478
 
14487
14479
  /* FunctionImport */
14488
- #ifndef __PYX_HAVE_RT_ImportFunction_3_0_10
14489
- #define __PYX_HAVE_RT_ImportFunction_3_0_10
14490
- static int __Pyx_ImportFunction_3_0_10(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
14480
+ #ifndef __PYX_HAVE_RT_ImportFunction_3_0_11
14481
+ #define __PYX_HAVE_RT_ImportFunction_3_0_11
14482
+ static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
14491
14483
  PyObject *d = 0;
14492
14484
  PyObject *cobj = 0;
14493
14485
  union {