pyogrio 0.9.0__cp312-cp312-win_amd64.whl → 0.11.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 (125) hide show
  1. pyogrio/__init__.py +35 -28
  2. pyogrio/_compat.py +15 -1
  3. pyogrio/_env.py +4 -6
  4. pyogrio/_err.c +8941 -3106
  5. pyogrio/_err.cp312-win_amd64.pyd +0 -0
  6. pyogrio/_geometry.c +1008 -807
  7. pyogrio/_geometry.cp312-win_amd64.pyd +0 -0
  8. pyogrio/_io.c +10678 -9440
  9. pyogrio/_io.cp312-win_amd64.pyd +0 -0
  10. pyogrio/_ogr.c +1950 -1873
  11. pyogrio/_ogr.cp312-win_amd64.pyd +0 -0
  12. pyogrio/_version.py +3 -3
  13. pyogrio/_vsi.c +7558 -2509
  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 +2 -2
  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/gdalinfo_output.schema.json +3 -3
  22. pyogrio/gdal_data/gdaltileindex.xsd +253 -0
  23. pyogrio/gdal_data/gdalvrt.xsd +178 -63
  24. pyogrio/gdal_data/nitf_spec.xml +1 -17
  25. pyogrio/gdal_data/nitf_spec.xsd +1 -17
  26. pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
  27. pyogrio/gdal_data/ogrvrt.xsd +4 -17
  28. pyogrio/gdal_data/osmconf.ini +3 -1
  29. pyogrio/gdal_data/pci_datum.txt +222 -155
  30. pyogrio/gdal_data/pci_ellips.txt +90 -38
  31. pyogrio/gdal_data/pdfcomposition.xsd +1 -17
  32. pyogrio/gdal_data/vcpkg.spdx.json +29 -24
  33. pyogrio/gdal_data/vcpkg_abi_info.txt +32 -31
  34. pyogrio/gdal_data/vdv452.xml +1 -17
  35. pyogrio/gdal_data/vdv452.xsd +1 -17
  36. pyogrio/geopandas.py +122 -66
  37. pyogrio/proj_data/ITRF2014 +1 -1
  38. pyogrio/proj_data/ITRF2020 +91 -0
  39. pyogrio/proj_data/proj-config-version.cmake +2 -2
  40. pyogrio/proj_data/proj-config.cmake +1 -1
  41. pyogrio/proj_data/proj-targets-release.cmake +3 -2
  42. pyogrio/proj_data/proj-targets.cmake +2 -2
  43. pyogrio/proj_data/proj.db +0 -0
  44. pyogrio/proj_data/proj.ini +11 -3
  45. pyogrio/proj_data/proj4-targets-release.cmake +3 -2
  46. pyogrio/proj_data/proj4-targets.cmake +2 -2
  47. pyogrio/proj_data/projjson.schema.json +1 -1
  48. pyogrio/proj_data/usage +7 -2
  49. pyogrio/proj_data/vcpkg.spdx.json +26 -21
  50. pyogrio/proj_data/vcpkg_abi_info.txt +19 -18
  51. pyogrio/raw.py +46 -30
  52. pyogrio/tests/conftest.py +214 -12
  53. pyogrio/tests/fixtures/README.md +32 -13
  54. pyogrio/tests/fixtures/curve.gpkg +0 -0
  55. pyogrio/tests/fixtures/{test_multisurface.gpkg → curvepolygon.gpkg} +0 -0
  56. pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  57. pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  58. pyogrio/tests/test_arrow.py +181 -24
  59. pyogrio/tests/test_core.py +170 -76
  60. pyogrio/tests/test_geopandas_io.py +483 -135
  61. pyogrio/tests/test_path.py +39 -17
  62. pyogrio/tests/test_raw_io.py +170 -55
  63. pyogrio/tests/test_util.py +56 -0
  64. pyogrio/util.py +69 -32
  65. pyogrio-0.11.0.dist-info/DELVEWHEEL +2 -0
  66. pyogrio-0.11.0.dist-info/METADATA +124 -0
  67. {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/RECORD +90 -102
  68. {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/WHEEL +1 -1
  69. {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info/licenses}/LICENSE +1 -1
  70. pyogrio.libs/{Lerc-5e4d8cbeeabca06f95e2270792304dc3.dll → Lerc-0a4c85fb364eca6153da109568898e6c.dll} +0 -0
  71. pyogrio.libs/{gdal-b434963605a006e01c486c0df6dea4e0.dll → gdal-34e3e080255b205ef706390e097fa4dc.dll} +0 -0
  72. pyogrio.libs/geos-d8f20037634583c2efcd6ea1f4153169.dll +0 -0
  73. pyogrio.libs/geos_c-046e8885887192fced9516bda554471d.dll +0 -0
  74. pyogrio.libs/geotiff-1f2f76a5d30685a8e0497d9dbf8a79cf.dll +0 -0
  75. pyogrio.libs/{iconv-2-8fcc23ddc6f096c45871011b6e008b44.dll → iconv-2-4b71ebbdf6834234e0c64cb2439b77cf.dll} +0 -0
  76. pyogrio.libs/{jpeg62-2f9b7af22d78338e8f0be0058503dc35.dll → jpeg62-bf2a75b1f2695748cd86238ddb19c65b.dll} +0 -0
  77. pyogrio.libs/json-c-4bc6781090e73c9b22d8dc057618a277.dll +0 -0
  78. pyogrio.libs/libcrypto-3-x64-c8f1692ed45cf55faecce2c448056b2e.dll +0 -0
  79. pyogrio.libs/libcurl-f3604410cd467a44d927794ebdce81b8.dll +0 -0
  80. pyogrio.libs/libexpat-385074fd54deb4b640baafa42cbb3146.dll +0 -0
  81. pyogrio.libs/liblzma-8968f0bfd463b7fe612b20d07adc3c1e.dll +0 -0
  82. pyogrio.libs/libpng16-44105208fe941d03e9f0c17bdbb952f7.dll +0 -0
  83. pyogrio.libs/libssl-3-x64-58c364315f431ab1f0e48b311b8cf105.dll +0 -0
  84. pyogrio.libs/msvcp140-99aa35e2033bb8d388bc35c8a68b77e3.dll +0 -0
  85. pyogrio.libs/proj_9-ee59474f99643c112eb02aa34a910237.dll +0 -0
  86. pyogrio.libs/{qhull_r-c45abde5d0c92faf723cc2942138af77.dll → qhull_r-eaac2f11a3d8241f082e54447c7504d7.dll} +0 -0
  87. pyogrio.libs/sqlite3-dc748e3452944fd41001abacdd783569.dll +0 -0
  88. pyogrio.libs/tiff-c409ddbe87b39639b83fee50d4aea318.dll +0 -0
  89. pyogrio.libs/{zlib1-e1272810861a13dd8d6cff3beac47f17.dll → zlib1-094085b7b78666197dcc8e1fce2d835d.dll} +0 -0
  90. pyogrio/_err.pxd +0 -4
  91. pyogrio/_err.pyx +0 -250
  92. pyogrio/_geometry.pxd +0 -4
  93. pyogrio/_geometry.pyx +0 -129
  94. pyogrio/_io.pxd +0 -0
  95. pyogrio/_io.pyx +0 -2742
  96. pyogrio/_ogr.pxd +0 -444
  97. pyogrio/_ogr.pyx +0 -346
  98. pyogrio/_vsi.pxd +0 -4
  99. pyogrio/_vsi.pyx +0 -140
  100. pyogrio/arrow_bridge.h +0 -115
  101. pyogrio/gdal_data/bag_template.xml +0 -201
  102. pyogrio/gdal_data/gmlasconf.xml +0 -169
  103. pyogrio/gdal_data/gmlasconf.xsd +0 -1066
  104. pyogrio/gdal_data/netcdf_config.xsd +0 -143
  105. pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
  106. pyogrio/tests/fixtures/test_datetime.geojson +0 -7
  107. pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
  108. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  109. pyogrio/tests/fixtures/test_nested.geojson +0 -18
  110. pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
  111. pyogrio-0.9.0.dist-info/DELVEWHEEL +0 -2
  112. pyogrio-0.9.0.dist-info/METADATA +0 -100
  113. pyogrio.libs/geos-f0622d0794b81c937a851b2e6fa9b712.dll +0 -0
  114. pyogrio.libs/geos_c-0e16bf70612fc3301d077b9d863a3fdb.dll +0 -0
  115. pyogrio.libs/geotiff-772e7c705fb15ddf91b432adb4eb1f6c.dll +0 -0
  116. pyogrio.libs/json-c-e52a077545e4057de42beb4948289b41.dll +0 -0
  117. pyogrio.libs/libcurl-bc81cd8afe15b10c0821b181b6af8bd0.dll +0 -0
  118. pyogrio.libs/libexpat-fbe03ca8917dfda776562d4338b289b8.dll +0 -0
  119. pyogrio.libs/liblzma-6b36f24d54d3dd45f274a2aebef81085.dll +0 -0
  120. pyogrio.libs/libpng16-13928571ad910705eae8d7dd8eef8b11.dll +0 -0
  121. pyogrio.libs/msvcp140-46db46e967c8db2cb7a20fc75872a57e.dll +0 -0
  122. pyogrio.libs/proj-8a30239ef2dfc3b9dd2bb48e8abb330f.dll +0 -0
  123. pyogrio.libs/sqlite3-df30c3cf230727e23c43c40126a530f7.dll +0 -0
  124. pyogrio.libs/tiff-43630f30487a9015213475ae86ed3fa3.dll +0 -0
  125. {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/top_level.txt +0 -0
pyogrio/_geometry.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.0.10 */
1
+ /* Generated by Cython 3.0.12 */
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_12" __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 0x03000CF0
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"
@@ -1513,6 +1515,7 @@ static const char *__pyx_filename;
1513
1515
 
1514
1516
  static const char *__pyx_f[] = {
1515
1517
  "pyogrio\\\\_geometry.pyx",
1518
+ "pyogrio\\\\_err.pxd",
1516
1519
  };
1517
1520
  /* #### Code section: utility_code_proto_before_types ### */
1518
1521
  /* ForceInitThreads.proto */
@@ -1525,9 +1528,10 @@ static const char *__pyx_f[] = {
1525
1528
  /* #### Code section: type_declarations ### */
1526
1529
 
1527
1530
  /*--- Type declarations ---*/
1531
+ struct __pyx_obj_7pyogrio_4_err_ErrorHandler;
1528
1532
  struct __pyx_opt_args_7pyogrio_4_ogr_get_string;
1529
1533
 
1530
- /* "pyogrio/_ogr.pxd":444
1534
+ /* "pyogrio/_ogr.pxd":514
1531
1535
  *
1532
1536
  *
1533
1537
  * cdef get_string(const char *c_str, str encoding=*) # <<<<<<<<<<<<<<
@@ -1536,6 +1540,28 @@ struct __pyx_opt_args_7pyogrio_4_ogr_get_string {
1536
1540
  int __pyx_n;
1537
1541
  PyObject *encoding;
1538
1542
  };
1543
+
1544
+ /* "pyogrio/_err.pxd":5
1545
+ * cdef void *check_pointer(void *ptr) except NULL
1546
+ *
1547
+ * cdef class ErrorHandler: # <<<<<<<<<<<<<<
1548
+ * cdef object error_stack
1549
+ * cdef int check_int(self, int retval, bint squash_errors) except -1
1550
+ */
1551
+ struct __pyx_obj_7pyogrio_4_err_ErrorHandler {
1552
+ PyObject_HEAD
1553
+ struct __pyx_vtabstruct_7pyogrio_4_err_ErrorHandler *__pyx_vtab;
1554
+ PyObject *error_stack;
1555
+ };
1556
+
1557
+
1558
+
1559
+ struct __pyx_vtabstruct_7pyogrio_4_err_ErrorHandler {
1560
+ int (*check_int)(struct __pyx_obj_7pyogrio_4_err_ErrorHandler *, int, int);
1561
+ void *(*check_pointer)(struct __pyx_obj_7pyogrio_4_err_ErrorHandler *, void *, int);
1562
+ void (*_handle_error_stack)(struct __pyx_obj_7pyogrio_4_err_ErrorHandler *, int);
1563
+ };
1564
+ static struct __pyx_vtabstruct_7pyogrio_4_err_ErrorHandler *__pyx_vtabptr_7pyogrio_4_err_ErrorHandler;
1539
1565
  /* #### Code section: utility_code_proto ### */
1540
1566
 
1541
1567
  /* --- Runtime support code (head) --- */
@@ -1785,7 +1811,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
1785
1811
  #if !CYTHON_VECTORCALL
1786
1812
  #if PY_VERSION_HEX >= 0x03080000
1787
1813
  #include "frameobject.h"
1788
- #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
1814
+ #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
1789
1815
  #ifndef Py_BUILD_CORE
1790
1816
  #define Py_BUILD_CORE 1
1791
1817
  #endif
@@ -1824,9 +1850,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObj
1824
1850
  /* RaiseException.proto */
1825
1851
  static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1826
1852
 
1827
- /* PyObject_Str.proto */
1828
- #define __Pyx_PyObject_Str(obj)\
1829
- (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
1853
+ /* PyObject_Unicode.proto */
1854
+ #if PY_MAJOR_VERSION >= 3
1855
+ #define __Pyx_PyObject_Unicode(obj)\
1856
+ (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
1857
+ #else
1858
+ #define __Pyx_PyObject_Unicode(obj)\
1859
+ (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
1860
+ #endif
1830
1861
 
1831
1862
  /* SwapException.proto */
1832
1863
  #if CYTHON_FAST_THREAD_STATE
@@ -1932,6 +1963,28 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1932
1963
  #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1933
1964
  #endif
1934
1965
 
1966
+ /* TypeImport.proto */
1967
+ #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12
1968
+ #define __PYX_HAVE_RT_ImportType_proto_3_0_12
1969
+ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1970
+ #include <stdalign.h>
1971
+ #endif
1972
+ #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
1973
+ #define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s)
1974
+ #else
1975
+ #define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*)
1976
+ #endif
1977
+ enum __Pyx_ImportType_CheckSize_3_0_12 {
1978
+ __Pyx_ImportType_CheckSize_Error_3_0_12 = 0,
1979
+ __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1,
1980
+ __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2
1981
+ };
1982
+ static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size);
1983
+ #endif
1984
+
1985
+ /* GetVTable.proto */
1986
+ static void* __Pyx_GetVtable(PyTypeObject *type);
1987
+
1935
1988
  /* Import.proto */
1936
1989
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1937
1990
 
@@ -2053,7 +2106,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt
2053
2106
  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2054
2107
 
2055
2108
  /* FunctionImport.proto */
2056
- static int __Pyx_ImportFunction_3_0_10(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2109
+ static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2057
2110
 
2058
2111
  /* InitStrings.proto */
2059
2112
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
@@ -2069,7 +2122,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2069
2122
  /* Module declarations from "pyogrio._ogr" */
2070
2123
 
2071
2124
  /* Module declarations from "pyogrio._err" */
2072
- static void *(*__pyx_f_7pyogrio_4_err_exc_wrap_pointer)(void *); /*proto*/
2125
+ static void *(*__pyx_f_7pyogrio_4_err_check_pointer)(void *); /*proto*/
2073
2126
 
2074
2127
  /* Module declarations from "pyogrio._geometry" */
2075
2128
  static PyObject *__pyx_7genexpr__pyx_v_7pyogrio_9_geometry_k;
@@ -2107,6 +2160,7 @@ static const char __pyx_k_2_5D_Point[] = "2.5D Point";
2107
2160
  static const char __pyx_k_LineString[] = "LineString";
2108
2161
  static const char __pyx_k_LinearRing[] = "LinearRing";
2109
2162
  static const char __pyx_k_MultiPoint[] = "MultiPoint";
2163
+ static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2110
2164
  static const char __pyx_k_2_5D_Polygon[] = "2.5D Polygon";
2111
2165
  static const char __pyx_k_LineString_Z[] = "LineString Z";
2112
2166
  static const char __pyx_k_MultiPoint_Z[] = "MultiPoint Z";
@@ -2187,6 +2241,7 @@ typedef struct {
2187
2241
  #endif
2188
2242
  #if CYTHON_USE_MODULE_STATE
2189
2243
  #endif
2244
+ PyTypeObject *__pyx_ptype_7pyogrio_4_err_ErrorHandler;
2190
2245
  #if CYTHON_USE_MODULE_STATE
2191
2246
  #endif
2192
2247
  PyObject *__pyx_kp_u_;
@@ -2250,6 +2305,7 @@ typedef struct {
2250
2305
  PyObject *__pyx_n_s_name;
2251
2306
  PyObject *__pyx_n_s_pyogrio__err;
2252
2307
  PyObject *__pyx_n_s_pyogrio_errors;
2308
+ PyObject *__pyx_n_s_pyx_vtable;
2253
2309
  PyObject *__pyx_n_s_spec;
2254
2310
  PyObject *__pyx_n_s_test;
2255
2311
  PyObject *__pyx_n_s_update;
@@ -2304,6 +2360,7 @@ static int __pyx_m_clear(PyObject *m) {
2304
2360
  #ifdef __Pyx_FusedFunction_USED
2305
2361
  Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
2306
2362
  #endif
2363
+ Py_CLEAR(clear_module_state->__pyx_ptype_7pyogrio_4_err_ErrorHandler);
2307
2364
  Py_CLEAR(clear_module_state->__pyx_kp_u_);
2308
2365
  Py_CLEAR(clear_module_state->__pyx_kp_u_2_5D_GeometryCollection);
2309
2366
  Py_CLEAR(clear_module_state->__pyx_kp_u_2_5D_LineString);
@@ -2365,6 +2422,7 @@ static int __pyx_m_clear(PyObject *m) {
2365
2422
  Py_CLEAR(clear_module_state->__pyx_n_s_name);
2366
2423
  Py_CLEAR(clear_module_state->__pyx_n_s_pyogrio__err);
2367
2424
  Py_CLEAR(clear_module_state->__pyx_n_s_pyogrio_errors);
2425
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
2368
2426
  Py_CLEAR(clear_module_state->__pyx_n_s_spec);
2369
2427
  Py_CLEAR(clear_module_state->__pyx_n_s_test);
2370
2428
  Py_CLEAR(clear_module_state->__pyx_n_s_update);
@@ -2397,6 +2455,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2397
2455
  #ifdef __Pyx_FusedFunction_USED
2398
2456
  Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
2399
2457
  #endif
2458
+ Py_VISIT(traverse_module_state->__pyx_ptype_7pyogrio_4_err_ErrorHandler);
2400
2459
  Py_VISIT(traverse_module_state->__pyx_kp_u_);
2401
2460
  Py_VISIT(traverse_module_state->__pyx_kp_u_2_5D_GeometryCollection);
2402
2461
  Py_VISIT(traverse_module_state->__pyx_kp_u_2_5D_LineString);
@@ -2458,6 +2517,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2458
2517
  Py_VISIT(traverse_module_state->__pyx_n_s_name);
2459
2518
  Py_VISIT(traverse_module_state->__pyx_n_s_pyogrio__err);
2460
2519
  Py_VISIT(traverse_module_state->__pyx_n_s_pyogrio_errors);
2520
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
2461
2521
  Py_VISIT(traverse_module_state->__pyx_n_s_spec);
2462
2522
  Py_VISIT(traverse_module_state->__pyx_n_s_test);
2463
2523
  Py_VISIT(traverse_module_state->__pyx_n_s_update);
@@ -2508,6 +2568,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2508
2568
  #endif
2509
2569
  #if CYTHON_USE_MODULE_STATE
2510
2570
  #endif
2571
+ #define __pyx_ptype_7pyogrio_4_err_ErrorHandler __pyx_mstate_global->__pyx_ptype_7pyogrio_4_err_ErrorHandler
2511
2572
  #if CYTHON_USE_MODULE_STATE
2512
2573
  #endif
2513
2574
  #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
@@ -2571,6 +2632,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2571
2632
  #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
2572
2633
  #define __pyx_n_s_pyogrio__err __pyx_mstate_global->__pyx_n_s_pyogrio__err
2573
2634
  #define __pyx_n_s_pyogrio_errors __pyx_mstate_global->__pyx_n_s_pyogrio_errors
2635
+ #define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
2574
2636
  #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
2575
2637
  #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
2576
2638
  #define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update
@@ -2594,9 +2656,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2594
2656
  */
2595
2657
 
2596
2658
  static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr_layer) {
2597
- CYTHON_UNUSED void *__pyx_v_cogr_featuredef;
2598
- OGRwkbGeometryType __pyx_v_ogr_type;
2599
2659
  void *__pyx_v_ogr_featuredef;
2660
+ OGRwkbGeometryType __pyx_v_ogr_type;
2600
2661
  PyObject *__pyx_v_exc = NULL;
2601
2662
  PyObject *__pyx_v_original_type = NULL;
2602
2663
  PyObject *__pyx_r = NULL;
@@ -2612,18 +2673,19 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2612
2673
  int __pyx_t_9;
2613
2674
  PyObject *__pyx_t_10 = NULL;
2614
2675
  PyObject *__pyx_t_11 = NULL;
2615
- PyObject *__pyx_t_12 = NULL;
2616
- int __pyx_t_13;
2617
- char const *__pyx_t_14;
2618
- PyObject *__pyx_t_15 = NULL;
2676
+ unsigned int __pyx_t_12;
2677
+ PyObject *__pyx_t_13 = NULL;
2678
+ int __pyx_t_14;
2679
+ char const *__pyx_t_15;
2619
2680
  PyObject *__pyx_t_16 = NULL;
2620
2681
  PyObject *__pyx_t_17 = NULL;
2621
2682
  PyObject *__pyx_t_18 = NULL;
2622
2683
  PyObject *__pyx_t_19 = NULL;
2623
2684
  PyObject *__pyx_t_20 = NULL;
2624
- int __pyx_t_21;
2625
- Py_ssize_t __pyx_t_22;
2626
- Py_UCS4 __pyx_t_23;
2685
+ PyObject *__pyx_t_21 = NULL;
2686
+ int __pyx_t_22;
2687
+ Py_ssize_t __pyx_t_23;
2688
+ Py_UCS4 __pyx_t_24;
2627
2689
  int __pyx_lineno = 0;
2628
2690
  const char *__pyx_filename = NULL;
2629
2691
  int __pyx_clineno = 0;
@@ -2632,17 +2694,17 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2632
2694
  /* "pyogrio/_geometry.pyx":83
2633
2695
  * geometry type
2634
2696
  * """
2635
- * cdef void *cogr_featuredef = NULL # <<<<<<<<<<<<<<
2697
+ * cdef void *ogr_featuredef = NULL # <<<<<<<<<<<<<<
2636
2698
  * cdef OGRwkbGeometryType ogr_type
2637
2699
  *
2638
2700
  */
2639
- __pyx_v_cogr_featuredef = NULL;
2701
+ __pyx_v_ogr_featuredef = NULL;
2640
2702
 
2641
2703
  /* "pyogrio/_geometry.pyx":86
2642
2704
  * cdef OGRwkbGeometryType ogr_type
2643
2705
  *
2644
2706
  * try: # <<<<<<<<<<<<<<
2645
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
2707
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer))
2646
2708
  * except NullPointerError:
2647
2709
  */
2648
2710
  {
@@ -2657,18 +2719,18 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2657
2719
  /* "pyogrio/_geometry.pyx":87
2658
2720
  *
2659
2721
  * try:
2660
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer)) # <<<<<<<<<<<<<<
2722
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer)) # <<<<<<<<<<<<<<
2661
2723
  * except NullPointerError:
2662
2724
  * raise DataLayerError("Could not get layer definition")
2663
2725
  */
2664
- __pyx_t_4 = __pyx_f_7pyogrio_4_err_exc_wrap_pointer(OGR_L_GetLayerDefn(__pyx_v_ogr_layer)); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 87, __pyx_L3_error)
2726
+ __pyx_t_4 = __pyx_f_7pyogrio_4_err_check_pointer(OGR_L_GetLayerDefn(__pyx_v_ogr_layer)); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 87, __pyx_L3_error)
2665
2727
  __pyx_v_ogr_featuredef = __pyx_t_4;
2666
2728
 
2667
2729
  /* "pyogrio/_geometry.pyx":86
2668
2730
  * cdef OGRwkbGeometryType ogr_type
2669
2731
  *
2670
2732
  * try: # <<<<<<<<<<<<<<
2671
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
2733
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer))
2672
2734
  * except NullPointerError:
2673
2735
  */
2674
2736
  }
@@ -2680,7 +2742,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2680
2742
 
2681
2743
  /* "pyogrio/_geometry.pyx":88
2682
2744
  * try:
2683
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
2745
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer))
2684
2746
  * except NullPointerError: # <<<<<<<<<<<<<<
2685
2747
  * raise DataLayerError("Could not get layer definition")
2686
2748
  *
@@ -2700,7 +2762,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2700
2762
  __Pyx_XGOTREF(__pyx_t_5);
2701
2763
 
2702
2764
  /* "pyogrio/_geometry.pyx":89
2703
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
2765
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer))
2704
2766
  * except NullPointerError:
2705
2767
  * raise DataLayerError("Could not get layer definition") # <<<<<<<<<<<<<<
2706
2768
  *
@@ -2709,7 +2771,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2709
2771
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DataLayerError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L5_except_error)
2710
2772
  __Pyx_GOTREF(__pyx_t_10);
2711
2773
  __pyx_t_11 = NULL;
2712
- __pyx_t_9 = 0;
2774
+ __pyx_t_12 = 0;
2713
2775
  #if CYTHON_UNPACK_METHODS
2714
2776
  if (unlikely(PyMethod_Check(__pyx_t_10))) {
2715
2777
  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
@@ -2718,13 +2780,13 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2718
2780
  __Pyx_INCREF(__pyx_t_11);
2719
2781
  __Pyx_INCREF(function);
2720
2782
  __Pyx_DECREF_SET(__pyx_t_10, function);
2721
- __pyx_t_9 = 1;
2783
+ __pyx_t_12 = 1;
2722
2784
  }
2723
2785
  }
2724
2786
  #endif
2725
2787
  {
2726
2788
  PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_kp_u_Could_not_get_layer_definition};
2727
- __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
2789
+ __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
2728
2790
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2729
2791
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L5_except_error)
2730
2792
  __Pyx_GOTREF(__pyx_t_8);
@@ -2768,26 +2830,26 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2768
2830
  */
2769
2831
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DataLayerError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __pyx_L16_error)
2770
2832
  __Pyx_GOTREF(__pyx_t_10);
2771
- __pyx_t_11 = __Pyx_PyObject_Str(__pyx_v_exc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L16_error)
2833
+ __pyx_t_11 = __Pyx_PyObject_Unicode(__pyx_v_exc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L16_error)
2772
2834
  __Pyx_GOTREF(__pyx_t_11);
2773
- __pyx_t_12 = NULL;
2774
- __pyx_t_9 = 0;
2835
+ __pyx_t_13 = NULL;
2836
+ __pyx_t_12 = 0;
2775
2837
  #if CYTHON_UNPACK_METHODS
2776
2838
  if (unlikely(PyMethod_Check(__pyx_t_10))) {
2777
- __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
2778
- if (likely(__pyx_t_12)) {
2839
+ __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
2840
+ if (likely(__pyx_t_13)) {
2779
2841
  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
2780
- __Pyx_INCREF(__pyx_t_12);
2842
+ __Pyx_INCREF(__pyx_t_13);
2781
2843
  __Pyx_INCREF(function);
2782
2844
  __Pyx_DECREF_SET(__pyx_t_10, function);
2783
- __pyx_t_9 = 1;
2845
+ __pyx_t_12 = 1;
2784
2846
  }
2785
2847
  }
2786
2848
  #endif
2787
2849
  {
2788
- PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_11};
2789
- __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
2790
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2850
+ PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_11};
2851
+ __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
2852
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2791
2853
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2792
2854
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L16_error)
2793
2855
  __Pyx_GOTREF(__pyx_t_8);
@@ -2810,35 +2872,35 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2810
2872
  /*exception exit:*/{
2811
2873
  __Pyx_PyThreadState_declare
2812
2874
  __Pyx_PyThreadState_assign
2813
- __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
2875
+ __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
2814
2876
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2815
2877
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2816
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2878
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2817
2879
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2818
- if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
2819
- if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
2820
- __Pyx_XGOTREF(__pyx_t_15);
2880
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
2881
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
2821
2882
  __Pyx_XGOTREF(__pyx_t_16);
2822
2883
  __Pyx_XGOTREF(__pyx_t_17);
2823
2884
  __Pyx_XGOTREF(__pyx_t_18);
2824
2885
  __Pyx_XGOTREF(__pyx_t_19);
2825
2886
  __Pyx_XGOTREF(__pyx_t_20);
2826
- __pyx_t_9 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
2887
+ __Pyx_XGOTREF(__pyx_t_21);
2888
+ __pyx_t_9 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
2827
2889
  {
2828
2890
  __Pyx_DECREF(__pyx_v_exc); __pyx_v_exc = 0;
2829
2891
  }
2830
2892
  if (PY_MAJOR_VERSION >= 3) {
2831
- __Pyx_XGIVEREF(__pyx_t_18);
2832
2893
  __Pyx_XGIVEREF(__pyx_t_19);
2833
2894
  __Pyx_XGIVEREF(__pyx_t_20);
2834
- __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
2895
+ __Pyx_XGIVEREF(__pyx_t_21);
2896
+ __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
2835
2897
  }
2836
- __Pyx_XGIVEREF(__pyx_t_15);
2837
2898
  __Pyx_XGIVEREF(__pyx_t_16);
2838
2899
  __Pyx_XGIVEREF(__pyx_t_17);
2839
- __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
2840
- __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
2841
- __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
2900
+ __Pyx_XGIVEREF(__pyx_t_18);
2901
+ __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
2902
+ __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
2903
+ __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
2842
2904
  goto __pyx_L5_except_error;
2843
2905
  }
2844
2906
  }
@@ -2849,7 +2911,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2849
2911
  * cdef OGRwkbGeometryType ogr_type
2850
2912
  *
2851
2913
  * try: # <<<<<<<<<<<<<<
2852
- * ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
2914
+ * ogr_featuredef = check_pointer(OGR_L_GetLayerDefn(ogr_layer))
2853
2915
  * except NullPointerError:
2854
2916
  */
2855
2917
  __pyx_L5_except_error:;
@@ -2881,10 +2943,10 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2881
2943
  __Pyx_GOTREF(__pyx_t_5);
2882
2944
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_GEOMETRY_TYPES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
2883
2945
  __Pyx_GOTREF(__pyx_t_6);
2884
- __pyx_t_21 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_t_6, Py_NE)); if (unlikely((__pyx_t_21 < 0))) __PYX_ERR(0, 96, __pyx_L1_error)
2946
+ __pyx_t_22 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_t_6, Py_NE)); if (unlikely((__pyx_t_22 < 0))) __PYX_ERR(0, 96, __pyx_L1_error)
2885
2947
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2886
2948
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2887
- if (unlikely(__pyx_t_21)) {
2949
+ if (unlikely(__pyx_t_22)) {
2888
2950
 
2889
2951
  /* "pyogrio/_geometry.pyx":97
2890
2952
  *
@@ -2901,7 +2963,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2901
2963
  __Pyx_GOTREF(__pyx_t_8);
2902
2964
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2903
2965
  __pyx_t_7 = NULL;
2904
- __pyx_t_13 = 0;
2966
+ __pyx_t_12 = 0;
2905
2967
  #if CYTHON_UNPACK_METHODS
2906
2968
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
2907
2969
  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
@@ -2910,13 +2972,13 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2910
2972
  __Pyx_INCREF(__pyx_t_7);
2911
2973
  __Pyx_INCREF(function);
2912
2974
  __Pyx_DECREF_SET(__pyx_t_5, function);
2913
- __pyx_t_13 = 1;
2975
+ __pyx_t_12 = 1;
2914
2976
  }
2915
2977
  }
2916
2978
  #endif
2917
2979
  {
2918
2980
  PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
2919
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
2981
+ __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
2920
2982
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2921
2983
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2922
2984
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
@@ -2943,8 +3005,8 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2943
3005
  * original_type = GEOMETRY_TYPES[ogr_type]
2944
3006
  *
2945
3007
  */
2946
- __pyx_t_21 = (OGR_GT_HasM(__pyx_v_ogr_type) != 0);
2947
- if (__pyx_t_21) {
3008
+ __pyx_t_22 = (OGR_GT_HasM(__pyx_v_ogr_type) != 0);
3009
+ if (__pyx_t_22) {
2948
3010
 
2949
3011
  /* "pyogrio/_geometry.pyx":100
2950
3012
  *
@@ -2995,10 +3057,10 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
2995
3057
  */
2996
3058
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error)
2997
3059
  __Pyx_GOTREF(__pyx_t_5);
2998
- __pyx_t_22 = 0;
2999
- __pyx_t_23 = 127;
3060
+ __pyx_t_23 = 0;
3061
+ __pyx_t_24 = 127;
3000
3062
  __Pyx_INCREF(__pyx_kp_u_Measured_M_geometry_types_are_no);
3001
- __pyx_t_22 += 62;
3063
+ __pyx_t_23 += 62;
3002
3064
  __Pyx_GIVEREF(__pyx_kp_u_Measured_M_geometry_types_are_no);
3003
3065
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Measured_M_geometry_types_are_no);
3004
3066
 
@@ -3011,13 +3073,13 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
3011
3073
  */
3012
3074
  __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_original_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
3013
3075
  __Pyx_GOTREF(__pyx_t_7);
3014
- __pyx_t_23 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_23) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_23;
3015
- __pyx_t_22 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
3076
+ __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_24;
3077
+ __pyx_t_23 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
3016
3078
  __Pyx_GIVEREF(__pyx_t_7);
3017
3079
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
3018
3080
  __pyx_t_7 = 0;
3019
3081
  __Pyx_INCREF(__pyx_kp_u_is_converted_to);
3020
- __pyx_t_22 += 19;
3082
+ __pyx_t_23 += 19;
3021
3083
  __Pyx_GIVEREF(__pyx_kp_u_is_converted_to);
3022
3084
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_is_converted_to);
3023
3085
 
@@ -3039,13 +3101,13 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
3039
3101
  __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 109, __pyx_L1_error)
3040
3102
  __Pyx_GOTREF(__pyx_t_10);
3041
3103
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3042
- __pyx_t_23 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_23) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_23;
3043
- __pyx_t_22 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
3104
+ __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_24;
3105
+ __pyx_t_23 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
3044
3106
  __Pyx_GIVEREF(__pyx_t_10);
3045
3107
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_10);
3046
3108
  __pyx_t_10 = 0;
3047
3109
  __Pyx_INCREF(__pyx_kp_u_);
3048
- __pyx_t_22 += 1;
3110
+ __pyx_t_23 += 1;
3049
3111
  __Pyx_GIVEREF(__pyx_kp_u_);
3050
3112
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u_);
3051
3113
 
@@ -3056,11 +3118,11 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
3056
3118
  * f"Original type '{original_type}' "
3057
3119
  * f"is converted to '{GEOMETRY_TYPES[ogr_type]}'")
3058
3120
  */
3059
- __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_22, __pyx_t_23); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
3121
+ __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
3060
3122
  __Pyx_GOTREF(__pyx_t_10);
3061
3123
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3062
3124
  __pyx_t_5 = NULL;
3063
- __pyx_t_13 = 0;
3125
+ __pyx_t_12 = 0;
3064
3126
  #if CYTHON_UNPACK_METHODS
3065
3127
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
3066
3128
  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
@@ -3069,13 +3131,13 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
3069
3131
  __Pyx_INCREF(__pyx_t_5);
3070
3132
  __Pyx_INCREF(function);
3071
3133
  __Pyx_DECREF_SET(__pyx_t_6, function);
3072
- __pyx_t_13 = 1;
3134
+ __pyx_t_12 = 1;
3073
3135
  }
3074
3136
  }
3075
3137
  #endif
3076
3138
  {
3077
3139
  PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
3078
- __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
3140
+ __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
3079
3141
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3080
3142
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3081
3143
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
@@ -3130,7 +3192,7 @@ static PyObject *__pyx_f_7pyogrio_9_geometry_get_geometry_type(void *__pyx_v_ogr
3130
3192
  __Pyx_XDECREF(__pyx_t_8);
3131
3193
  __Pyx_XDECREF(__pyx_t_10);
3132
3194
  __Pyx_XDECREF(__pyx_t_11);
3133
- __Pyx_XDECREF(__pyx_t_12);
3195
+ __Pyx_XDECREF(__pyx_t_13);
3134
3196
  __Pyx_AddTraceback("pyogrio._geometry.get_geometry_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
3135
3197
  __pyx_r = 0;
3136
3198
  __pyx_L0:;
@@ -3157,7 +3219,7 @@ static OGRwkbGeometryType __pyx_f_7pyogrio_9_geometry_get_geometry_type_code(PyO
3157
3219
  PyObject *__pyx_t_3 = NULL;
3158
3220
  PyObject *__pyx_t_4 = NULL;
3159
3221
  PyObject *__pyx_t_5 = NULL;
3160
- int __pyx_t_6;
3222
+ unsigned int __pyx_t_6;
3161
3223
  OGRwkbGeometryType __pyx_t_7;
3162
3224
  int __pyx_lineno = 0;
3163
3225
  const char *__pyx_filename = NULL;
@@ -3340,6 +3402,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
3340
3402
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
3341
3403
  {&__pyx_n_s_pyogrio__err, __pyx_k_pyogrio__err, sizeof(__pyx_k_pyogrio__err), 0, 0, 1, 1},
3342
3404
  {&__pyx_n_s_pyogrio_errors, __pyx_k_pyogrio_errors, sizeof(__pyx_k_pyogrio_errors), 0, 0, 1, 1},
3405
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
3343
3406
  {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
3344
3407
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
3345
3408
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
@@ -3435,10 +3498,23 @@ static int __Pyx_modinit_type_init_code(void) {
3435
3498
 
3436
3499
  static int __Pyx_modinit_type_import_code(void) {
3437
3500
  __Pyx_RefNannyDeclarations
3501
+ PyObject *__pyx_t_1 = NULL;
3502
+ int __pyx_lineno = 0;
3503
+ const char *__pyx_filename = NULL;
3504
+ int __pyx_clineno = 0;
3438
3505
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
3439
3506
  /*--- Type import code ---*/
3507
+ __pyx_t_1 = PyImport_ImportModule("pyogrio._err"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
3508
+ __Pyx_GOTREF(__pyx_t_1);
3509
+ __pyx_ptype_7pyogrio_4_err_ErrorHandler = __Pyx_ImportType_3_0_12(__pyx_t_1, "pyogrio._err", "ErrorHandler", sizeof(struct __pyx_obj_7pyogrio_4_err_ErrorHandler), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_7pyogrio_4_err_ErrorHandler),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_7pyogrio_4_err_ErrorHandler) __PYX_ERR(1, 5, __pyx_L1_error)
3510
+ __pyx_vtabptr_7pyogrio_4_err_ErrorHandler = (struct __pyx_vtabstruct_7pyogrio_4_err_ErrorHandler*)__Pyx_GetVtable(__pyx_ptype_7pyogrio_4_err_ErrorHandler); if (unlikely(!__pyx_vtabptr_7pyogrio_4_err_ErrorHandler)) __PYX_ERR(1, 5, __pyx_L1_error)
3511
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3440
3512
  __Pyx_RefNannyFinishContext();
3441
3513
  return 0;
3514
+ __pyx_L1_error:;
3515
+ __Pyx_XDECREF(__pyx_t_1);
3516
+ __Pyx_RefNannyFinishContext();
3517
+ return -1;
3442
3518
  }
3443
3519
 
3444
3520
  static int __Pyx_modinit_variable_import_code(void) {
@@ -3459,7 +3535,7 @@ static int __Pyx_modinit_function_import_code(void) {
3459
3535
  /*--- Function import code ---*/
3460
3536
  __pyx_t_1 = PyImport_ImportModule("pyogrio._err"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
3461
3537
  __Pyx_GOTREF(__pyx_t_1);
3462
- 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)
3538
+ if (__Pyx_ImportFunction_3_0_12(__pyx_t_1, "check_pointer", (void (**)(void))&__pyx_f_7pyogrio_4_err_check_pointer, "void *(void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3463
3539
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3464
3540
  __Pyx_RefNannyFinishContext();
3465
3541
  return 0;
@@ -3746,7 +3822,7 @@ if (!__Pyx_RefNanny) {
3746
3822
  (void)__Pyx_modinit_variable_export_code();
3747
3823
  if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3748
3824
  (void)__Pyx_modinit_type_init_code();
3749
- (void)__Pyx_modinit_type_import_code();
3825
+ if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3750
3826
  (void)__Pyx_modinit_variable_import_code();
3751
3827
  if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3752
3828
  /*--- Execution code ---*/
@@ -3823,9 +3899,9 @@ if (!__Pyx_RefNanny) {
3823
3899
  /* "pyogrio/_geometry.pyx":11
3824
3900
  *
3825
3901
  * GEOMETRY_TYPES = {
3826
- * wkbUnknown: 'Unknown', # <<<<<<<<<<<<<<
3827
- * wkbPoint: 'Point',
3828
- * wkbLineString: 'LineString',
3902
+ * wkbUnknown: "Unknown", # <<<<<<<<<<<<<<
3903
+ * wkbPoint: "Point",
3904
+ * wkbLineString: "LineString",
3829
3905
  */
3830
3906
  __pyx_t_2 = __Pyx_PyDict_NewPresized(31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
3831
3907
  __Pyx_GOTREF(__pyx_t_2);
@@ -3836,10 +3912,10 @@ if (!__Pyx_RefNanny) {
3836
3912
 
3837
3913
  /* "pyogrio/_geometry.pyx":12
3838
3914
  * GEOMETRY_TYPES = {
3839
- * wkbUnknown: 'Unknown',
3840
- * wkbPoint: 'Point', # <<<<<<<<<<<<<<
3841
- * wkbLineString: 'LineString',
3842
- * wkbPolygon: 'Polygon',
3915
+ * wkbUnknown: "Unknown",
3916
+ * wkbPoint: "Point", # <<<<<<<<<<<<<<
3917
+ * wkbLineString: "LineString",
3918
+ * wkbPolygon: "Polygon",
3843
3919
  */
3844
3920
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPoint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error)
3845
3921
  __Pyx_GOTREF(__pyx_t_3);
@@ -3847,11 +3923,11 @@ if (!__Pyx_RefNanny) {
3847
3923
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3848
3924
 
3849
3925
  /* "pyogrio/_geometry.pyx":13
3850
- * wkbUnknown: 'Unknown',
3851
- * wkbPoint: 'Point',
3852
- * wkbLineString: 'LineString', # <<<<<<<<<<<<<<
3853
- * wkbPolygon: 'Polygon',
3854
- * wkbMultiPoint: 'MultiPoint',
3926
+ * wkbUnknown: "Unknown",
3927
+ * wkbPoint: "Point",
3928
+ * wkbLineString: "LineString", # <<<<<<<<<<<<<<
3929
+ * wkbPolygon: "Polygon",
3930
+ * wkbMultiPoint: "MultiPoint",
3855
3931
  */
3856
3932
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbLineString); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
3857
3933
  __Pyx_GOTREF(__pyx_t_3);
@@ -3859,11 +3935,11 @@ if (!__Pyx_RefNanny) {
3859
3935
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3860
3936
 
3861
3937
  /* "pyogrio/_geometry.pyx":14
3862
- * wkbPoint: 'Point',
3863
- * wkbLineString: 'LineString',
3864
- * wkbPolygon: 'Polygon', # <<<<<<<<<<<<<<
3865
- * wkbMultiPoint: 'MultiPoint',
3866
- * wkbMultiLineString: 'MultiLineString',
3938
+ * wkbPoint: "Point",
3939
+ * wkbLineString: "LineString",
3940
+ * wkbPolygon: "Polygon", # <<<<<<<<<<<<<<
3941
+ * wkbMultiPoint: "MultiPoint",
3942
+ * wkbMultiLineString: "MultiLineString",
3867
3943
  */
3868
3944
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPolygon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
3869
3945
  __Pyx_GOTREF(__pyx_t_3);
@@ -3871,11 +3947,11 @@ if (!__Pyx_RefNanny) {
3871
3947
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3872
3948
 
3873
3949
  /* "pyogrio/_geometry.pyx":15
3874
- * wkbLineString: 'LineString',
3875
- * wkbPolygon: 'Polygon',
3876
- * wkbMultiPoint: 'MultiPoint', # <<<<<<<<<<<<<<
3877
- * wkbMultiLineString: 'MultiLineString',
3878
- * wkbMultiPolygon: 'MultiPolygon',
3950
+ * wkbLineString: "LineString",
3951
+ * wkbPolygon: "Polygon",
3952
+ * wkbMultiPoint: "MultiPoint", # <<<<<<<<<<<<<<
3953
+ * wkbMultiLineString: "MultiLineString",
3954
+ * wkbMultiPolygon: "MultiPolygon",
3879
3955
  */
3880
3956
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPoint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
3881
3957
  __Pyx_GOTREF(__pyx_t_3);
@@ -3883,11 +3959,11 @@ if (!__Pyx_RefNanny) {
3883
3959
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3884
3960
 
3885
3961
  /* "pyogrio/_geometry.pyx":16
3886
- * wkbPolygon: 'Polygon',
3887
- * wkbMultiPoint: 'MultiPoint',
3888
- * wkbMultiLineString: 'MultiLineString', # <<<<<<<<<<<<<<
3889
- * wkbMultiPolygon: 'MultiPolygon',
3890
- * wkbGeometryCollection: 'GeometryCollection',
3962
+ * wkbPolygon: "Polygon",
3963
+ * wkbMultiPoint: "MultiPoint",
3964
+ * wkbMultiLineString: "MultiLineString", # <<<<<<<<<<<<<<
3965
+ * wkbMultiPolygon: "MultiPolygon",
3966
+ * wkbGeometryCollection: "GeometryCollection",
3891
3967
  */
3892
3968
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiLineString); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
3893
3969
  __Pyx_GOTREF(__pyx_t_3);
@@ -3895,10 +3971,10 @@ if (!__Pyx_RefNanny) {
3895
3971
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3896
3972
 
3897
3973
  /* "pyogrio/_geometry.pyx":17
3898
- * wkbMultiPoint: 'MultiPoint',
3899
- * wkbMultiLineString: 'MultiLineString',
3900
- * wkbMultiPolygon: 'MultiPolygon', # <<<<<<<<<<<<<<
3901
- * wkbGeometryCollection: 'GeometryCollection',
3974
+ * wkbMultiPoint: "MultiPoint",
3975
+ * wkbMultiLineString: "MultiLineString",
3976
+ * wkbMultiPolygon: "MultiPolygon", # <<<<<<<<<<<<<<
3977
+ * wkbGeometryCollection: "GeometryCollection",
3902
3978
  * wkbNone: None,
3903
3979
  */
3904
3980
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPolygon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
@@ -3907,11 +3983,11 @@ if (!__Pyx_RefNanny) {
3907
3983
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3908
3984
 
3909
3985
  /* "pyogrio/_geometry.pyx":18
3910
- * wkbMultiLineString: 'MultiLineString',
3911
- * wkbMultiPolygon: 'MultiPolygon',
3912
- * wkbGeometryCollection: 'GeometryCollection', # <<<<<<<<<<<<<<
3986
+ * wkbMultiLineString: "MultiLineString",
3987
+ * wkbMultiPolygon: "MultiPolygon",
3988
+ * wkbGeometryCollection: "GeometryCollection", # <<<<<<<<<<<<<<
3913
3989
  * wkbNone: None,
3914
- * wkbLinearRing: 'LinearRing',
3990
+ * wkbLinearRing: "LinearRing",
3915
3991
  */
3916
3992
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbGeometryCollection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
3917
3993
  __Pyx_GOTREF(__pyx_t_3);
@@ -3919,10 +3995,10 @@ if (!__Pyx_RefNanny) {
3919
3995
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3920
3996
 
3921
3997
  /* "pyogrio/_geometry.pyx":19
3922
- * wkbMultiPolygon: 'MultiPolygon',
3923
- * wkbGeometryCollection: 'GeometryCollection',
3998
+ * wkbMultiPolygon: "MultiPolygon",
3999
+ * wkbGeometryCollection: "GeometryCollection",
3924
4000
  * wkbNone: None, # <<<<<<<<<<<<<<
3925
- * wkbLinearRing: 'LinearRing',
4001
+ * wkbLinearRing: "LinearRing",
3926
4002
  * # WARNING: Measured types are not supported in GEOS and downstream uses
3927
4003
  */
3928
4004
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbNone); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error)
@@ -3931,9 +4007,9 @@ if (!__Pyx_RefNanny) {
3931
4007
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3932
4008
 
3933
4009
  /* "pyogrio/_geometry.pyx":20
3934
- * wkbGeometryCollection: 'GeometryCollection',
4010
+ * wkbGeometryCollection: "GeometryCollection",
3935
4011
  * wkbNone: None,
3936
- * wkbLinearRing: 'LinearRing', # <<<<<<<<<<<<<<
4012
+ * wkbLinearRing: "LinearRing", # <<<<<<<<<<<<<<
3937
4013
  * # WARNING: Measured types are not supported in GEOS and downstream uses
3938
4014
  * # these are stripped automatically to their corresponding 2D / 3D types
3939
4015
  */
@@ -3945,9 +4021,9 @@ if (!__Pyx_RefNanny) {
3945
4021
  /* "pyogrio/_geometry.pyx":23
3946
4022
  * # WARNING: Measured types are not supported in GEOS and downstream uses
3947
4023
  * # these are stripped automatically to their corresponding 2D / 3D types
3948
- * wkbPointM: 'PointM', # <<<<<<<<<<<<<<
3949
- * wkbLineStringM: 'Measured LineString',
3950
- * wkbPolygonM: 'Measured Polygon',
4024
+ * wkbPointM: "PointM", # <<<<<<<<<<<<<<
4025
+ * wkbLineStringM: "Measured LineString",
4026
+ * wkbPolygonM: "Measured Polygon",
3951
4027
  */
3952
4028
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPointM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
3953
4029
  __Pyx_GOTREF(__pyx_t_3);
@@ -3956,10 +4032,10 @@ if (!__Pyx_RefNanny) {
3956
4032
 
3957
4033
  /* "pyogrio/_geometry.pyx":24
3958
4034
  * # these are stripped automatically to their corresponding 2D / 3D types
3959
- * wkbPointM: 'PointM',
3960
- * wkbLineStringM: 'Measured LineString', # <<<<<<<<<<<<<<
3961
- * wkbPolygonM: 'Measured Polygon',
3962
- * wkbMultiPointM: 'Measured MultiPoint',
4035
+ * wkbPointM: "PointM",
4036
+ * wkbLineStringM: "Measured LineString", # <<<<<<<<<<<<<<
4037
+ * wkbPolygonM: "Measured Polygon",
4038
+ * wkbMultiPointM: "Measured MultiPoint",
3963
4039
  */
3964
4040
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbLineStringM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
3965
4041
  __Pyx_GOTREF(__pyx_t_3);
@@ -3967,11 +4043,11 @@ if (!__Pyx_RefNanny) {
3967
4043
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3968
4044
 
3969
4045
  /* "pyogrio/_geometry.pyx":25
3970
- * wkbPointM: 'PointM',
3971
- * wkbLineStringM: 'Measured LineString',
3972
- * wkbPolygonM: 'Measured Polygon', # <<<<<<<<<<<<<<
3973
- * wkbMultiPointM: 'Measured MultiPoint',
3974
- * wkbMultiLineStringM: 'Measured MultiLineString',
4046
+ * wkbPointM: "PointM",
4047
+ * wkbLineStringM: "Measured LineString",
4048
+ * wkbPolygonM: "Measured Polygon", # <<<<<<<<<<<<<<
4049
+ * wkbMultiPointM: "Measured MultiPoint",
4050
+ * wkbMultiLineStringM: "Measured MultiLineString",
3975
4051
  */
3976
4052
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPolygonM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)
3977
4053
  __Pyx_GOTREF(__pyx_t_3);
@@ -3979,11 +4055,11 @@ if (!__Pyx_RefNanny) {
3979
4055
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3980
4056
 
3981
4057
  /* "pyogrio/_geometry.pyx":26
3982
- * wkbLineStringM: 'Measured LineString',
3983
- * wkbPolygonM: 'Measured Polygon',
3984
- * wkbMultiPointM: 'Measured MultiPoint', # <<<<<<<<<<<<<<
3985
- * wkbMultiLineStringM: 'Measured MultiLineString',
3986
- * wkbMultiPolygonM: 'Measured MultiPolygon',
4058
+ * wkbLineStringM: "Measured LineString",
4059
+ * wkbPolygonM: "Measured Polygon",
4060
+ * wkbMultiPointM: "Measured MultiPoint", # <<<<<<<<<<<<<<
4061
+ * wkbMultiLineStringM: "Measured MultiLineString",
4062
+ * wkbMultiPolygonM: "Measured MultiPolygon",
3987
4063
  */
3988
4064
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPointM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
3989
4065
  __Pyx_GOTREF(__pyx_t_3);
@@ -3991,11 +4067,11 @@ if (!__Pyx_RefNanny) {
3991
4067
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3992
4068
 
3993
4069
  /* "pyogrio/_geometry.pyx":27
3994
- * wkbPolygonM: 'Measured Polygon',
3995
- * wkbMultiPointM: 'Measured MultiPoint',
3996
- * wkbMultiLineStringM: 'Measured MultiLineString', # <<<<<<<<<<<<<<
3997
- * wkbMultiPolygonM: 'Measured MultiPolygon',
3998
- * wkbGeometryCollectionM: 'Measured GeometryCollection',
4070
+ * wkbPolygonM: "Measured Polygon",
4071
+ * wkbMultiPointM: "Measured MultiPoint",
4072
+ * wkbMultiLineStringM: "Measured MultiLineString", # <<<<<<<<<<<<<<
4073
+ * wkbMultiPolygonM: "Measured MultiPolygon",
4074
+ * wkbGeometryCollectionM: "Measured GeometryCollection",
3999
4075
  */
4000
4076
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiLineStringM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
4001
4077
  __Pyx_GOTREF(__pyx_t_3);
@@ -4003,11 +4079,11 @@ if (!__Pyx_RefNanny) {
4003
4079
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4004
4080
 
4005
4081
  /* "pyogrio/_geometry.pyx":28
4006
- * wkbMultiPointM: 'Measured MultiPoint',
4007
- * wkbMultiLineStringM: 'Measured MultiLineString',
4008
- * wkbMultiPolygonM: 'Measured MultiPolygon', # <<<<<<<<<<<<<<
4009
- * wkbGeometryCollectionM: 'Measured GeometryCollection',
4010
- * wkbPointZM: 'Measured 3D Point',
4082
+ * wkbMultiPointM: "Measured MultiPoint",
4083
+ * wkbMultiLineStringM: "Measured MultiLineString",
4084
+ * wkbMultiPolygonM: "Measured MultiPolygon", # <<<<<<<<<<<<<<
4085
+ * wkbGeometryCollectionM: "Measured GeometryCollection",
4086
+ * wkbPointZM: "Measured 3D Point",
4011
4087
  */
4012
4088
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPolygonM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
4013
4089
  __Pyx_GOTREF(__pyx_t_3);
@@ -4015,11 +4091,11 @@ if (!__Pyx_RefNanny) {
4015
4091
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4016
4092
 
4017
4093
  /* "pyogrio/_geometry.pyx":29
4018
- * wkbMultiLineStringM: 'Measured MultiLineString',
4019
- * wkbMultiPolygonM: 'Measured MultiPolygon',
4020
- * wkbGeometryCollectionM: 'Measured GeometryCollection', # <<<<<<<<<<<<<<
4021
- * wkbPointZM: 'Measured 3D Point',
4022
- * wkbLineStringZM: 'Measured 3D LineString',
4094
+ * wkbMultiLineStringM: "Measured MultiLineString",
4095
+ * wkbMultiPolygonM: "Measured MultiPolygon",
4096
+ * wkbGeometryCollectionM: "Measured GeometryCollection", # <<<<<<<<<<<<<<
4097
+ * wkbPointZM: "Measured 3D Point",
4098
+ * wkbLineStringZM: "Measured 3D LineString",
4023
4099
  */
4024
4100
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbGeometryCollectionM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
4025
4101
  __Pyx_GOTREF(__pyx_t_3);
@@ -4027,11 +4103,11 @@ if (!__Pyx_RefNanny) {
4027
4103
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4028
4104
 
4029
4105
  /* "pyogrio/_geometry.pyx":30
4030
- * wkbMultiPolygonM: 'Measured MultiPolygon',
4031
- * wkbGeometryCollectionM: 'Measured GeometryCollection',
4032
- * wkbPointZM: 'Measured 3D Point', # <<<<<<<<<<<<<<
4033
- * wkbLineStringZM: 'Measured 3D LineString',
4034
- * wkbPolygonZM: 'Measured 3D Polygon',
4106
+ * wkbMultiPolygonM: "Measured MultiPolygon",
4107
+ * wkbGeometryCollectionM: "Measured GeometryCollection",
4108
+ * wkbPointZM: "Measured 3D Point", # <<<<<<<<<<<<<<
4109
+ * wkbLineStringZM: "Measured 3D LineString",
4110
+ * wkbPolygonZM: "Measured 3D Polygon",
4035
4111
  */
4036
4112
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPointZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
4037
4113
  __Pyx_GOTREF(__pyx_t_3);
@@ -4039,11 +4115,11 @@ if (!__Pyx_RefNanny) {
4039
4115
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4040
4116
 
4041
4117
  /* "pyogrio/_geometry.pyx":31
4042
- * wkbGeometryCollectionM: 'Measured GeometryCollection',
4043
- * wkbPointZM: 'Measured 3D Point',
4044
- * wkbLineStringZM: 'Measured 3D LineString', # <<<<<<<<<<<<<<
4045
- * wkbPolygonZM: 'Measured 3D Polygon',
4046
- * wkbMultiPointZM: 'Measured 3D MultiPoint',
4118
+ * wkbGeometryCollectionM: "Measured GeometryCollection",
4119
+ * wkbPointZM: "Measured 3D Point",
4120
+ * wkbLineStringZM: "Measured 3D LineString", # <<<<<<<<<<<<<<
4121
+ * wkbPolygonZM: "Measured 3D Polygon",
4122
+ * wkbMultiPointZM: "Measured 3D MultiPoint",
4047
4123
  */
4048
4124
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbLineStringZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
4049
4125
  __Pyx_GOTREF(__pyx_t_3);
@@ -4051,11 +4127,11 @@ if (!__Pyx_RefNanny) {
4051
4127
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4052
4128
 
4053
4129
  /* "pyogrio/_geometry.pyx":32
4054
- * wkbPointZM: 'Measured 3D Point',
4055
- * wkbLineStringZM: 'Measured 3D LineString',
4056
- * wkbPolygonZM: 'Measured 3D Polygon', # <<<<<<<<<<<<<<
4057
- * wkbMultiPointZM: 'Measured 3D MultiPoint',
4058
- * wkbMultiLineStringZM: 'Measured 3D MultiLineString',
4130
+ * wkbPointZM: "Measured 3D Point",
4131
+ * wkbLineStringZM: "Measured 3D LineString",
4132
+ * wkbPolygonZM: "Measured 3D Polygon", # <<<<<<<<<<<<<<
4133
+ * wkbMultiPointZM: "Measured 3D MultiPoint",
4134
+ * wkbMultiLineStringZM: "Measured 3D MultiLineString",
4059
4135
  */
4060
4136
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPolygonZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
4061
4137
  __Pyx_GOTREF(__pyx_t_3);
@@ -4063,11 +4139,11 @@ if (!__Pyx_RefNanny) {
4063
4139
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4064
4140
 
4065
4141
  /* "pyogrio/_geometry.pyx":33
4066
- * wkbLineStringZM: 'Measured 3D LineString',
4067
- * wkbPolygonZM: 'Measured 3D Polygon',
4068
- * wkbMultiPointZM: 'Measured 3D MultiPoint', # <<<<<<<<<<<<<<
4069
- * wkbMultiLineStringZM: 'Measured 3D MultiLineString',
4070
- * wkbMultiPolygonZM: 'Measured 3D MultiPolygon',
4142
+ * wkbLineStringZM: "Measured 3D LineString",
4143
+ * wkbPolygonZM: "Measured 3D Polygon",
4144
+ * wkbMultiPointZM: "Measured 3D MultiPoint", # <<<<<<<<<<<<<<
4145
+ * wkbMultiLineStringZM: "Measured 3D MultiLineString",
4146
+ * wkbMultiPolygonZM: "Measured 3D MultiPolygon",
4071
4147
  */
4072
4148
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPointZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error)
4073
4149
  __Pyx_GOTREF(__pyx_t_3);
@@ -4075,11 +4151,11 @@ if (!__Pyx_RefNanny) {
4075
4151
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4076
4152
 
4077
4153
  /* "pyogrio/_geometry.pyx":34
4078
- * wkbPolygonZM: 'Measured 3D Polygon',
4079
- * wkbMultiPointZM: 'Measured 3D MultiPoint',
4080
- * wkbMultiLineStringZM: 'Measured 3D MultiLineString', # <<<<<<<<<<<<<<
4081
- * wkbMultiPolygonZM: 'Measured 3D MultiPolygon',
4082
- * wkbGeometryCollectionZM: 'Measured 3D GeometryCollection',
4154
+ * wkbPolygonZM: "Measured 3D Polygon",
4155
+ * wkbMultiPointZM: "Measured 3D MultiPoint",
4156
+ * wkbMultiLineStringZM: "Measured 3D MultiLineString", # <<<<<<<<<<<<<<
4157
+ * wkbMultiPolygonZM: "Measured 3D MultiPolygon",
4158
+ * wkbGeometryCollectionZM: "Measured 3D GeometryCollection",
4083
4159
  */
4084
4160
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiLineStringZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
4085
4161
  __Pyx_GOTREF(__pyx_t_3);
@@ -4087,11 +4163,11 @@ if (!__Pyx_RefNanny) {
4087
4163
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4088
4164
 
4089
4165
  /* "pyogrio/_geometry.pyx":35
4090
- * wkbMultiPointZM: 'Measured 3D MultiPoint',
4091
- * wkbMultiLineStringZM: 'Measured 3D MultiLineString',
4092
- * wkbMultiPolygonZM: 'Measured 3D MultiPolygon', # <<<<<<<<<<<<<<
4093
- * wkbGeometryCollectionZM: 'Measured 3D GeometryCollection',
4094
- * wkbPoint25D: 'Point Z',
4166
+ * wkbMultiPointZM: "Measured 3D MultiPoint",
4167
+ * wkbMultiLineStringZM: "Measured 3D MultiLineString",
4168
+ * wkbMultiPolygonZM: "Measured 3D MultiPolygon", # <<<<<<<<<<<<<<
4169
+ * wkbGeometryCollectionZM: "Measured 3D GeometryCollection",
4170
+ * wkbPoint25D: "Point Z",
4095
4171
  */
4096
4172
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPolygonZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
4097
4173
  __Pyx_GOTREF(__pyx_t_3);
@@ -4099,11 +4175,11 @@ if (!__Pyx_RefNanny) {
4099
4175
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4100
4176
 
4101
4177
  /* "pyogrio/_geometry.pyx":36
4102
- * wkbMultiLineStringZM: 'Measured 3D MultiLineString',
4103
- * wkbMultiPolygonZM: 'Measured 3D MultiPolygon',
4104
- * wkbGeometryCollectionZM: 'Measured 3D GeometryCollection', # <<<<<<<<<<<<<<
4105
- * wkbPoint25D: 'Point Z',
4106
- * wkbLineString25D: 'LineString Z',
4178
+ * wkbMultiLineStringZM: "Measured 3D MultiLineString",
4179
+ * wkbMultiPolygonZM: "Measured 3D MultiPolygon",
4180
+ * wkbGeometryCollectionZM: "Measured 3D GeometryCollection", # <<<<<<<<<<<<<<
4181
+ * wkbPoint25D: "Point Z",
4182
+ * wkbLineString25D: "LineString Z",
4107
4183
  */
4108
4184
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbGeometryCollectionZM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
4109
4185
  __Pyx_GOTREF(__pyx_t_3);
@@ -4111,11 +4187,11 @@ if (!__Pyx_RefNanny) {
4111
4187
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4112
4188
 
4113
4189
  /* "pyogrio/_geometry.pyx":37
4114
- * wkbMultiPolygonZM: 'Measured 3D MultiPolygon',
4115
- * wkbGeometryCollectionZM: 'Measured 3D GeometryCollection',
4116
- * wkbPoint25D: 'Point Z', # <<<<<<<<<<<<<<
4117
- * wkbLineString25D: 'LineString Z',
4118
- * wkbPolygon25D: 'Polygon Z',
4190
+ * wkbMultiPolygonZM: "Measured 3D MultiPolygon",
4191
+ * wkbGeometryCollectionZM: "Measured 3D GeometryCollection",
4192
+ * wkbPoint25D: "Point Z", # <<<<<<<<<<<<<<
4193
+ * wkbLineString25D: "LineString Z",
4194
+ * wkbPolygon25D: "Polygon Z",
4119
4195
  */
4120
4196
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPoint25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
4121
4197
  __Pyx_GOTREF(__pyx_t_3);
@@ -4123,11 +4199,11 @@ if (!__Pyx_RefNanny) {
4123
4199
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4124
4200
 
4125
4201
  /* "pyogrio/_geometry.pyx":38
4126
- * wkbGeometryCollectionZM: 'Measured 3D GeometryCollection',
4127
- * wkbPoint25D: 'Point Z',
4128
- * wkbLineString25D: 'LineString Z', # <<<<<<<<<<<<<<
4129
- * wkbPolygon25D: 'Polygon Z',
4130
- * wkbMultiPoint25D: 'MultiPoint Z',
4202
+ * wkbGeometryCollectionZM: "Measured 3D GeometryCollection",
4203
+ * wkbPoint25D: "Point Z",
4204
+ * wkbLineString25D: "LineString Z", # <<<<<<<<<<<<<<
4205
+ * wkbPolygon25D: "Polygon Z",
4206
+ * wkbMultiPoint25D: "MultiPoint Z",
4131
4207
  */
4132
4208
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbLineString25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
4133
4209
  __Pyx_GOTREF(__pyx_t_3);
@@ -4135,11 +4211,11 @@ if (!__Pyx_RefNanny) {
4135
4211
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4136
4212
 
4137
4213
  /* "pyogrio/_geometry.pyx":39
4138
- * wkbPoint25D: 'Point Z',
4139
- * wkbLineString25D: 'LineString Z',
4140
- * wkbPolygon25D: 'Polygon Z', # <<<<<<<<<<<<<<
4141
- * wkbMultiPoint25D: 'MultiPoint Z',
4142
- * wkbMultiLineString25D: 'MultiLineString Z',
4214
+ * wkbPoint25D: "Point Z",
4215
+ * wkbLineString25D: "LineString Z",
4216
+ * wkbPolygon25D: "Polygon Z", # <<<<<<<<<<<<<<
4217
+ * wkbMultiPoint25D: "MultiPoint Z",
4218
+ * wkbMultiLineString25D: "MultiLineString Z",
4143
4219
  */
4144
4220
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPolygon25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
4145
4221
  __Pyx_GOTREF(__pyx_t_3);
@@ -4147,11 +4223,11 @@ if (!__Pyx_RefNanny) {
4147
4223
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4148
4224
 
4149
4225
  /* "pyogrio/_geometry.pyx":40
4150
- * wkbLineString25D: 'LineString Z',
4151
- * wkbPolygon25D: 'Polygon Z',
4152
- * wkbMultiPoint25D: 'MultiPoint Z', # <<<<<<<<<<<<<<
4153
- * wkbMultiLineString25D: 'MultiLineString Z',
4154
- * wkbMultiPolygon25D: 'MultiPolygon Z',
4226
+ * wkbLineString25D: "LineString Z",
4227
+ * wkbPolygon25D: "Polygon Z",
4228
+ * wkbMultiPoint25D: "MultiPoint Z", # <<<<<<<<<<<<<<
4229
+ * wkbMultiLineString25D: "MultiLineString Z",
4230
+ * wkbMultiPolygon25D: "MultiPolygon Z",
4155
4231
  */
4156
4232
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPoint25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
4157
4233
  __Pyx_GOTREF(__pyx_t_3);
@@ -4159,11 +4235,11 @@ if (!__Pyx_RefNanny) {
4159
4235
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4160
4236
 
4161
4237
  /* "pyogrio/_geometry.pyx":41
4162
- * wkbPolygon25D: 'Polygon Z',
4163
- * wkbMultiPoint25D: 'MultiPoint Z',
4164
- * wkbMultiLineString25D: 'MultiLineString Z', # <<<<<<<<<<<<<<
4165
- * wkbMultiPolygon25D: 'MultiPolygon Z',
4166
- * wkbGeometryCollection25D: 'GeometryCollection Z',
4238
+ * wkbPolygon25D: "Polygon Z",
4239
+ * wkbMultiPoint25D: "MultiPoint Z",
4240
+ * wkbMultiLineString25D: "MultiLineString Z", # <<<<<<<<<<<<<<
4241
+ * wkbMultiPolygon25D: "MultiPolygon Z",
4242
+ * wkbGeometryCollection25D: "GeometryCollection Z",
4167
4243
  */
4168
4244
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiLineString25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
4169
4245
  __Pyx_GOTREF(__pyx_t_3);
@@ -4171,10 +4247,10 @@ if (!__Pyx_RefNanny) {
4171
4247
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4172
4248
 
4173
4249
  /* "pyogrio/_geometry.pyx":42
4174
- * wkbMultiPoint25D: 'MultiPoint Z',
4175
- * wkbMultiLineString25D: 'MultiLineString Z',
4176
- * wkbMultiPolygon25D: 'MultiPolygon Z', # <<<<<<<<<<<<<<
4177
- * wkbGeometryCollection25D: 'GeometryCollection Z',
4250
+ * wkbMultiPoint25D: "MultiPoint Z",
4251
+ * wkbMultiLineString25D: "MultiLineString Z",
4252
+ * wkbMultiPolygon25D: "MultiPolygon Z", # <<<<<<<<<<<<<<
4253
+ * wkbGeometryCollection25D: "GeometryCollection Z",
4178
4254
  * }
4179
4255
  */
4180
4256
  __pyx_t_3 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPolygon25D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
@@ -4183,9 +4259,9 @@ if (!__Pyx_RefNanny) {
4183
4259
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4184
4260
 
4185
4261
  /* "pyogrio/_geometry.pyx":43
4186
- * wkbMultiLineString25D: 'MultiLineString Z',
4187
- * wkbMultiPolygon25D: 'MultiPolygon Z',
4188
- * wkbGeometryCollection25D: 'GeometryCollection Z', # <<<<<<<<<<<<<<
4262
+ * wkbMultiLineString25D: "MultiLineString Z",
4263
+ * wkbMultiPolygon25D: "MultiPolygon Z",
4264
+ * wkbGeometryCollection25D: "GeometryCollection Z", # <<<<<<<<<<<<<<
4189
4265
  * }
4190
4266
  *
4191
4267
  */
@@ -4199,7 +4275,7 @@ if (!__Pyx_RefNanny) {
4199
4275
  /* "pyogrio/_geometry.pyx":46
4200
4276
  * }
4201
4277
  *
4202
- * GEOMETRY_TYPE_CODES = {v:k for k, v in GEOMETRY_TYPES.items()} # <<<<<<<<<<<<<<
4278
+ * GEOMETRY_TYPE_CODES = {v: k for k, v in GEOMETRY_TYPES.items()} # <<<<<<<<<<<<<<
4203
4279
  *
4204
4280
  * # add additional aliases from 2.5D format
4205
4281
  */
@@ -4256,8 +4332,8 @@ if (!__Pyx_RefNanny) {
4256
4332
  *
4257
4333
  * # add additional aliases from 2.5D format
4258
4334
  * GEOMETRY_TYPE_CODES.update({ # <<<<<<<<<<<<<<
4259
- * '2.5D Point': wkbPoint25D,
4260
- * '2.5D LineString': wkbLineString25D,
4335
+ * "2.5D Point": wkbPoint25D,
4336
+ * "2.5D LineString": wkbLineString25D,
4261
4337
  */
4262
4338
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_GEOMETRY_TYPE_CODES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
4263
4339
  __Pyx_GOTREF(__pyx_t_2);
@@ -4268,9 +4344,9 @@ if (!__Pyx_RefNanny) {
4268
4344
  /* "pyogrio/_geometry.pyx":50
4269
4345
  * # add additional aliases from 2.5D format
4270
4346
  * GEOMETRY_TYPE_CODES.update({
4271
- * '2.5D Point': wkbPoint25D, # <<<<<<<<<<<<<<
4272
- * '2.5D LineString': wkbLineString25D,
4273
- * '2.5D Polygon': wkbPolygon25D,
4347
+ * "2.5D Point": wkbPoint25D, # <<<<<<<<<<<<<<
4348
+ * "2.5D LineString": wkbLineString25D,
4349
+ * "2.5D Polygon": wkbPolygon25D,
4274
4350
  */
4275
4351
  __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
4276
4352
  __Pyx_GOTREF(__pyx_t_2);
@@ -4281,10 +4357,10 @@ if (!__Pyx_RefNanny) {
4281
4357
 
4282
4358
  /* "pyogrio/_geometry.pyx":51
4283
4359
  * GEOMETRY_TYPE_CODES.update({
4284
- * '2.5D Point': wkbPoint25D,
4285
- * '2.5D LineString': wkbLineString25D, # <<<<<<<<<<<<<<
4286
- * '2.5D Polygon': wkbPolygon25D,
4287
- * '2.5D MultiPoint': wkbMultiPoint25D,
4360
+ * "2.5D Point": wkbPoint25D,
4361
+ * "2.5D LineString": wkbLineString25D, # <<<<<<<<<<<<<<
4362
+ * "2.5D Polygon": wkbPolygon25D,
4363
+ * "2.5D MultiPoint": wkbMultiPoint25D,
4288
4364
  */
4289
4365
  __pyx_t_7 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbLineString25D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error)
4290
4366
  __Pyx_GOTREF(__pyx_t_7);
@@ -4292,11 +4368,11 @@ if (!__Pyx_RefNanny) {
4292
4368
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4293
4369
 
4294
4370
  /* "pyogrio/_geometry.pyx":52
4295
- * '2.5D Point': wkbPoint25D,
4296
- * '2.5D LineString': wkbLineString25D,
4297
- * '2.5D Polygon': wkbPolygon25D, # <<<<<<<<<<<<<<
4298
- * '2.5D MultiPoint': wkbMultiPoint25D,
4299
- * '2.5D MultiLineString': wkbMultiLineString25D,
4371
+ * "2.5D Point": wkbPoint25D,
4372
+ * "2.5D LineString": wkbLineString25D,
4373
+ * "2.5D Polygon": wkbPolygon25D, # <<<<<<<<<<<<<<
4374
+ * "2.5D MultiPoint": wkbMultiPoint25D,
4375
+ * "2.5D MultiLineString": wkbMultiLineString25D,
4300
4376
  */
4301
4377
  __pyx_t_7 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbPolygon25D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error)
4302
4378
  __Pyx_GOTREF(__pyx_t_7);
@@ -4304,11 +4380,11 @@ if (!__Pyx_RefNanny) {
4304
4380
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4305
4381
 
4306
4382
  /* "pyogrio/_geometry.pyx":53
4307
- * '2.5D LineString': wkbLineString25D,
4308
- * '2.5D Polygon': wkbPolygon25D,
4309
- * '2.5D MultiPoint': wkbMultiPoint25D, # <<<<<<<<<<<<<<
4310
- * '2.5D MultiLineString': wkbMultiLineString25D,
4311
- * '2.5D MultiPolygon': wkbMultiPolygon25D,
4383
+ * "2.5D LineString": wkbLineString25D,
4384
+ * "2.5D Polygon": wkbPolygon25D,
4385
+ * "2.5D MultiPoint": wkbMultiPoint25D, # <<<<<<<<<<<<<<
4386
+ * "2.5D MultiLineString": wkbMultiLineString25D,
4387
+ * "2.5D MultiPolygon": wkbMultiPolygon25D,
4312
4388
  */
4313
4389
  __pyx_t_7 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPoint25D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 53, __pyx_L1_error)
4314
4390
  __Pyx_GOTREF(__pyx_t_7);
@@ -4316,11 +4392,11 @@ if (!__Pyx_RefNanny) {
4316
4392
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4317
4393
 
4318
4394
  /* "pyogrio/_geometry.pyx":54
4319
- * '2.5D Polygon': wkbPolygon25D,
4320
- * '2.5D MultiPoint': wkbMultiPoint25D,
4321
- * '2.5D MultiLineString': wkbMultiLineString25D, # <<<<<<<<<<<<<<
4322
- * '2.5D MultiPolygon': wkbMultiPolygon25D,
4323
- * '2.5D GeometryCollection': wkbGeometryCollection25D
4395
+ * "2.5D Polygon": wkbPolygon25D,
4396
+ * "2.5D MultiPoint": wkbMultiPoint25D,
4397
+ * "2.5D MultiLineString": wkbMultiLineString25D, # <<<<<<<<<<<<<<
4398
+ * "2.5D MultiPolygon": wkbMultiPolygon25D,
4399
+ * "2.5D GeometryCollection": wkbGeometryCollection25D
4324
4400
  */
4325
4401
  __pyx_t_7 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiLineString25D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
4326
4402
  __Pyx_GOTREF(__pyx_t_7);
@@ -4328,10 +4404,10 @@ if (!__Pyx_RefNanny) {
4328
4404
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4329
4405
 
4330
4406
  /* "pyogrio/_geometry.pyx":55
4331
- * '2.5D MultiPoint': wkbMultiPoint25D,
4332
- * '2.5D MultiLineString': wkbMultiLineString25D,
4333
- * '2.5D MultiPolygon': wkbMultiPolygon25D, # <<<<<<<<<<<<<<
4334
- * '2.5D GeometryCollection': wkbGeometryCollection25D
4407
+ * "2.5D MultiPoint": wkbMultiPoint25D,
4408
+ * "2.5D MultiLineString": wkbMultiLineString25D,
4409
+ * "2.5D MultiPolygon": wkbMultiPolygon25D, # <<<<<<<<<<<<<<
4410
+ * "2.5D GeometryCollection": wkbGeometryCollection25D
4335
4411
  * })
4336
4412
  */
4337
4413
  __pyx_t_7 = __Pyx_PyInt_From_OGRwkbGeometryType(wkbMultiPolygon25D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error)
@@ -4340,9 +4416,9 @@ if (!__Pyx_RefNanny) {
4340
4416
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4341
4417
 
4342
4418
  /* "pyogrio/_geometry.pyx":56
4343
- * '2.5D MultiLineString': wkbMultiLineString25D,
4344
- * '2.5D MultiPolygon': wkbMultiPolygon25D,
4345
- * '2.5D GeometryCollection': wkbGeometryCollection25D # <<<<<<<<<<<<<<
4419
+ * "2.5D MultiLineString": wkbMultiLineString25D,
4420
+ * "2.5D MultiPolygon": wkbMultiPolygon25D,
4421
+ * "2.5D GeometryCollection": wkbGeometryCollection25D # <<<<<<<<<<<<<<
4346
4422
  * })
4347
4423
  *
4348
4424
  */
@@ -4355,8 +4431,8 @@ if (!__Pyx_RefNanny) {
4355
4431
  *
4356
4432
  * # add additional aliases from 2.5D format
4357
4433
  * GEOMETRY_TYPE_CODES.update({ # <<<<<<<<<<<<<<
4358
- * '2.5D Point': wkbPoint25D,
4359
- * '2.5D LineString': wkbLineString25D,
4434
+ * "2.5D Point": wkbPoint25D,
4435
+ * "2.5D LineString": wkbLineString25D,
4360
4436
  */
4361
4437
  __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
4362
4438
  __Pyx_GOTREF(__pyx_t_7);
@@ -4368,8 +4444,8 @@ if (!__Pyx_RefNanny) {
4368
4444
  *
4369
4445
  * # 2.5D also represented using negative numbers not enumerated above
4370
4446
  * GEOMETRY_TYPES.update({ # <<<<<<<<<<<<<<
4371
- * -2147483647: 'Point Z',
4372
- * -2147483646: 'LineString Z',
4447
+ * -2147483647: "Point Z",
4448
+ * -2147483646: "LineString Z",
4373
4449
  */
4374
4450
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_GEOMETRY_TYPES); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error)
4375
4451
  __Pyx_GOTREF(__pyx_t_7);
@@ -4380,9 +4456,9 @@ if (!__Pyx_RefNanny) {
4380
4456
  /* "pyogrio/_geometry.pyx":61
4381
4457
  * # 2.5D also represented using negative numbers not enumerated above
4382
4458
  * GEOMETRY_TYPES.update({
4383
- * -2147483647: 'Point Z', # <<<<<<<<<<<<<<
4384
- * -2147483646: 'LineString Z',
4385
- * -2147483645: 'Polygon Z',
4459
+ * -2147483647: "Point Z", # <<<<<<<<<<<<<<
4460
+ * -2147483646: "LineString Z",
4461
+ * -2147483645: "Polygon Z",
4386
4462
  */
4387
4463
  __pyx_t_7 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 61, __pyx_L1_error)
4388
4464
  __Pyx_GOTREF(__pyx_t_7);
@@ -4398,8 +4474,8 @@ if (!__Pyx_RefNanny) {
4398
4474
  *
4399
4475
  * # 2.5D also represented using negative numbers not enumerated above
4400
4476
  * GEOMETRY_TYPES.update({ # <<<<<<<<<<<<<<
4401
- * -2147483647: 'Point Z',
4402
- * -2147483646: 'LineString Z',
4477
+ * -2147483647: "Point Z",
4478
+ * -2147483646: "LineString Z",
4403
4479
  */
4404
4480
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
4405
4481
  __Pyx_GOTREF(__pyx_t_3);
@@ -5912,6 +5988,106 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
5912
5988
  }
5913
5989
  #endif
5914
5990
 
5991
+ /* TypeImport */
5992
+ #ifndef __PYX_HAVE_RT_ImportType_3_0_12
5993
+ #define __PYX_HAVE_RT_ImportType_3_0_12
5994
+ static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name,
5995
+ size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size)
5996
+ {
5997
+ PyObject *result = 0;
5998
+ char warning[200];
5999
+ Py_ssize_t basicsize;
6000
+ Py_ssize_t itemsize;
6001
+ #if CYTHON_COMPILING_IN_LIMITED_API
6002
+ PyObject *py_basicsize;
6003
+ PyObject *py_itemsize;
6004
+ #endif
6005
+ result = PyObject_GetAttrString(module, class_name);
6006
+ if (!result)
6007
+ goto bad;
6008
+ if (!PyType_Check(result)) {
6009
+ PyErr_Format(PyExc_TypeError,
6010
+ "%.200s.%.200s is not a type object",
6011
+ module_name, class_name);
6012
+ goto bad;
6013
+ }
6014
+ #if !CYTHON_COMPILING_IN_LIMITED_API
6015
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
6016
+ itemsize = ((PyTypeObject *)result)->tp_itemsize;
6017
+ #else
6018
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
6019
+ if (!py_basicsize)
6020
+ goto bad;
6021
+ basicsize = PyLong_AsSsize_t(py_basicsize);
6022
+ Py_DECREF(py_basicsize);
6023
+ py_basicsize = 0;
6024
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
6025
+ goto bad;
6026
+ py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
6027
+ if (!py_itemsize)
6028
+ goto bad;
6029
+ itemsize = PyLong_AsSsize_t(py_itemsize);
6030
+ Py_DECREF(py_itemsize);
6031
+ py_itemsize = 0;
6032
+ if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
6033
+ goto bad;
6034
+ #endif
6035
+ if (itemsize) {
6036
+ if (size % alignment) {
6037
+ alignment = size % alignment;
6038
+ }
6039
+ if (itemsize < (Py_ssize_t)alignment)
6040
+ itemsize = (Py_ssize_t)alignment;
6041
+ }
6042
+ if ((size_t)(basicsize + itemsize) < size) {
6043
+ PyErr_Format(PyExc_ValueError,
6044
+ "%.200s.%.200s size changed, may indicate binary incompatibility. "
6045
+ "Expected %zd from C header, got %zd from PyObject",
6046
+ module_name, class_name, size, basicsize+itemsize);
6047
+ goto bad;
6048
+ }
6049
+ if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 &&
6050
+ ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
6051
+ PyErr_Format(PyExc_ValueError,
6052
+ "%.200s.%.200s size changed, may indicate binary incompatibility. "
6053
+ "Expected %zd from C header, got %zd-%zd from PyObject",
6054
+ module_name, class_name, size, basicsize, basicsize+itemsize);
6055
+ goto bad;
6056
+ }
6057
+ else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) {
6058
+ PyOS_snprintf(warning, sizeof(warning),
6059
+ "%s.%s size changed, may indicate binary incompatibility. "
6060
+ "Expected %zd from C header, got %zd from PyObject",
6061
+ module_name, class_name, size, basicsize);
6062
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
6063
+ }
6064
+ return (PyTypeObject *)result;
6065
+ bad:
6066
+ Py_XDECREF(result);
6067
+ return NULL;
6068
+ }
6069
+ #endif
6070
+
6071
+ /* GetVTable */
6072
+ static void* __Pyx_GetVtable(PyTypeObject *type) {
6073
+ void* ptr;
6074
+ #if CYTHON_COMPILING_IN_LIMITED_API
6075
+ PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable);
6076
+ #else
6077
+ PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable);
6078
+ #endif
6079
+ if (!ob)
6080
+ goto bad;
6081
+ ptr = PyCapsule_GetPointer(ob, 0);
6082
+ if (!ptr && !PyErr_Occurred())
6083
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
6084
+ Py_DECREF(ob);
6085
+ return ptr;
6086
+ bad:
6087
+ Py_XDECREF(ob);
6088
+ return NULL;
6089
+ }
6090
+
5915
6091
  /* Import */
5916
6092
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5917
6093
  PyObject *module = 0;
@@ -6615,7 +6791,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
6615
6791
  #include "compile.h"
6616
6792
  #include "frameobject.h"
6617
6793
  #include "traceback.h"
6618
- #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
6794
+ #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
6619
6795
  #ifndef Py_BUILD_CORE
6620
6796
  #define Py_BUILD_CORE 1
6621
6797
  #endif
@@ -6856,12 +7032,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_OGRwkbGeometryType(OGRwkbGeometr
6856
7032
  }
6857
7033
  }
6858
7034
  {
6859
- int one = 1; int little = (int)*(unsigned char *)&one;
6860
7035
  unsigned char *bytes = (unsigned char *)&value;
6861
- #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
7036
+ #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
7037
+ if (is_unsigned) {
7038
+ return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
7039
+ } else {
7040
+ return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
7041
+ }
7042
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
7043
+ int one = 1; int little = (int)*(unsigned char *)&one;
6862
7044
  return _PyLong_FromByteArray(bytes, sizeof(OGRwkbGeometryType),
6863
7045
  little, !is_unsigned);
6864
7046
  #else
7047
+ int one = 1; int little = (int)*(unsigned char *)&one;
6865
7048
  PyObject *from_bytes, *result = NULL;
6866
7049
  PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
6867
7050
  from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
@@ -6911,151 +7094,174 @@ static CYTHON_INLINE OGRwkbGeometryType __Pyx_PyInt_As_OGRwkbGeometryType(PyObje
6911
7094
  }
6912
7095
  return (OGRwkbGeometryType) val;
6913
7096
  }
6914
- } else
7097
+ }
6915
7098
  #endif
6916
- if (likely(PyLong_Check(x))) {
6917
- if (is_unsigned) {
7099
+ if (unlikely(!PyLong_Check(x))) {
7100
+ OGRwkbGeometryType val;
7101
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7102
+ if (!tmp) return (OGRwkbGeometryType) -1;
7103
+ val = __Pyx_PyInt_As_OGRwkbGeometryType(tmp);
7104
+ Py_DECREF(tmp);
7105
+ return val;
7106
+ }
7107
+ if (is_unsigned) {
6918
7108
  #if CYTHON_USE_PYLONG_INTERNALS
6919
- if (unlikely(__Pyx_PyLong_IsNeg(x))) {
6920
- goto raise_neg_overflow;
6921
- } else if (__Pyx_PyLong_IsCompact(x)) {
6922
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
6923
- } else {
6924
- const digit* digits = __Pyx_PyLong_Digits(x);
6925
- assert(__Pyx_PyLong_DigitCount(x) > 1);
6926
- switch (__Pyx_PyLong_DigitCount(x)) {
6927
- case 2:
6928
- if ((8 * sizeof(OGRwkbGeometryType) > 1 * PyLong_SHIFT)) {
6929
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6930
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6931
- } else if ((8 * sizeof(OGRwkbGeometryType) >= 2 * PyLong_SHIFT)) {
6932
- return (OGRwkbGeometryType) (((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6933
- }
7109
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
7110
+ goto raise_neg_overflow;
7111
+ } else if (__Pyx_PyLong_IsCompact(x)) {
7112
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
7113
+ } else {
7114
+ const digit* digits = __Pyx_PyLong_Digits(x);
7115
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7116
+ switch (__Pyx_PyLong_DigitCount(x)) {
7117
+ case 2:
7118
+ if ((8 * sizeof(OGRwkbGeometryType) > 1 * PyLong_SHIFT)) {
7119
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7120
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7121
+ } else if ((8 * sizeof(OGRwkbGeometryType) >= 2 * PyLong_SHIFT)) {
7122
+ return (OGRwkbGeometryType) (((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6934
7123
  }
6935
- break;
6936
- case 3:
6937
- if ((8 * sizeof(OGRwkbGeometryType) > 2 * PyLong_SHIFT)) {
6938
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6939
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6940
- } else if ((8 * sizeof(OGRwkbGeometryType) >= 3 * PyLong_SHIFT)) {
6941
- return (OGRwkbGeometryType) (((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6942
- }
7124
+ }
7125
+ break;
7126
+ case 3:
7127
+ if ((8 * sizeof(OGRwkbGeometryType) > 2 * PyLong_SHIFT)) {
7128
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7129
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7130
+ } else if ((8 * sizeof(OGRwkbGeometryType) >= 3 * PyLong_SHIFT)) {
7131
+ return (OGRwkbGeometryType) (((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6943
7132
  }
6944
- break;
6945
- case 4:
6946
- if ((8 * sizeof(OGRwkbGeometryType) > 3 * PyLong_SHIFT)) {
6947
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6948
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6949
- } else if ((8 * sizeof(OGRwkbGeometryType) >= 4 * PyLong_SHIFT)) {
6950
- return (OGRwkbGeometryType) (((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6951
- }
7133
+ }
7134
+ break;
7135
+ case 4:
7136
+ if ((8 * sizeof(OGRwkbGeometryType) > 3 * PyLong_SHIFT)) {
7137
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7138
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7139
+ } else if ((8 * sizeof(OGRwkbGeometryType) >= 4 * PyLong_SHIFT)) {
7140
+ return (OGRwkbGeometryType) (((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0]));
6952
7141
  }
6953
- break;
6954
- }
7142
+ }
7143
+ break;
6955
7144
  }
7145
+ }
6956
7146
  #endif
6957
7147
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
6958
- if (unlikely(Py_SIZE(x) < 0)) {
6959
- goto raise_neg_overflow;
6960
- }
7148
+ if (unlikely(Py_SIZE(x) < 0)) {
7149
+ goto raise_neg_overflow;
7150
+ }
6961
7151
  #else
6962
- {
6963
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6964
- if (unlikely(result < 0))
6965
- return (OGRwkbGeometryType) -1;
6966
- if (unlikely(result == 1))
6967
- goto raise_neg_overflow;
6968
- }
7152
+ {
7153
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7154
+ if (unlikely(result < 0))
7155
+ return (OGRwkbGeometryType) -1;
7156
+ if (unlikely(result == 1))
7157
+ goto raise_neg_overflow;
7158
+ }
6969
7159
  #endif
6970
- if ((sizeof(OGRwkbGeometryType) <= sizeof(unsigned long))) {
6971
- __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, unsigned long, PyLong_AsUnsignedLong(x))
7160
+ if ((sizeof(OGRwkbGeometryType) <= sizeof(unsigned long))) {
7161
+ __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, unsigned long, PyLong_AsUnsignedLong(x))
6972
7162
  #ifdef HAVE_LONG_LONG
6973
- } else if ((sizeof(OGRwkbGeometryType) <= sizeof(unsigned PY_LONG_LONG))) {
6974
- __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7163
+ } else if ((sizeof(OGRwkbGeometryType) <= sizeof(unsigned PY_LONG_LONG))) {
7164
+ __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6975
7165
  #endif
6976
- }
6977
- } else {
7166
+ }
7167
+ } else {
6978
7168
  #if CYTHON_USE_PYLONG_INTERNALS
6979
- if (__Pyx_PyLong_IsCompact(x)) {
6980
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
6981
- } else {
6982
- const digit* digits = __Pyx_PyLong_Digits(x);
6983
- assert(__Pyx_PyLong_DigitCount(x) > 1);
6984
- switch (__Pyx_PyLong_SignedDigitCount(x)) {
6985
- case -2:
6986
- if ((8 * sizeof(OGRwkbGeometryType) - 1 > 1 * PyLong_SHIFT)) {
6987
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6988
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6989
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
6990
- return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
6991
- }
7169
+ if (__Pyx_PyLong_IsCompact(x)) {
7170
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
7171
+ } else {
7172
+ const digit* digits = __Pyx_PyLong_Digits(x);
7173
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7174
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
7175
+ case -2:
7176
+ if ((8 * sizeof(OGRwkbGeometryType) - 1 > 1 * PyLong_SHIFT)) {
7177
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7178
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7179
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
7180
+ return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
6992
7181
  }
6993
- break;
6994
- case 2:
6995
- if ((8 * sizeof(OGRwkbGeometryType) > 1 * PyLong_SHIFT)) {
6996
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6997
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6998
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
6999
- return (OGRwkbGeometryType) ((((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7000
- }
7182
+ }
7183
+ break;
7184
+ case 2:
7185
+ if ((8 * sizeof(OGRwkbGeometryType) > 1 * PyLong_SHIFT)) {
7186
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7187
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7188
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
7189
+ return (OGRwkbGeometryType) ((((((OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7001
7190
  }
7002
- break;
7003
- case -3:
7004
- if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
7005
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7006
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7007
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7008
- return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7009
- }
7191
+ }
7192
+ break;
7193
+ case -3:
7194
+ if ((8 * sizeof(OGRwkbGeometryType) - 1 > 2 * PyLong_SHIFT)) {
7195
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7196
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7197
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7198
+ return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7010
7199
  }
7011
- break;
7012
- case 3:
7013
- if ((8 * sizeof(OGRwkbGeometryType) > 2 * PyLong_SHIFT)) {
7014
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7015
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7016
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7017
- return (OGRwkbGeometryType) ((((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7018
- }
7200
+ }
7201
+ break;
7202
+ case 3:
7203
+ if ((8 * sizeof(OGRwkbGeometryType) > 2 * PyLong_SHIFT)) {
7204
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7205
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7206
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7207
+ return (OGRwkbGeometryType) ((((((((OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7019
7208
  }
7020
- break;
7021
- case -4:
7022
- if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7023
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7024
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7025
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 4 * PyLong_SHIFT)) {
7026
- return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7027
- }
7209
+ }
7210
+ break;
7211
+ case -4:
7212
+ if ((8 * sizeof(OGRwkbGeometryType) - 1 > 3 * PyLong_SHIFT)) {
7213
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7214
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7215
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 4 * PyLong_SHIFT)) {
7216
+ return (OGRwkbGeometryType) (((OGRwkbGeometryType)-1)*(((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7028
7217
  }
7029
- break;
7030
- case 4:
7031
- if ((8 * sizeof(OGRwkbGeometryType) > 3 * PyLong_SHIFT)) {
7032
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7033
- __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7034
- } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 4 * PyLong_SHIFT)) {
7035
- return (OGRwkbGeometryType) ((((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7036
- }
7218
+ }
7219
+ break;
7220
+ case 4:
7221
+ if ((8 * sizeof(OGRwkbGeometryType) > 3 * PyLong_SHIFT)) {
7222
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7223
+ __PYX_VERIFY_RETURN_INT(OGRwkbGeometryType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7224
+ } else if ((8 * sizeof(OGRwkbGeometryType) - 1 > 4 * PyLong_SHIFT)) {
7225
+ return (OGRwkbGeometryType) ((((((((((OGRwkbGeometryType)digits[3]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[2]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[1]) << PyLong_SHIFT) | (OGRwkbGeometryType)digits[0])));
7037
7226
  }
7038
- break;
7039
- }
7227
+ }
7228
+ break;
7040
7229
  }
7230
+ }
7041
7231
  #endif
7042
- if ((sizeof(OGRwkbGeometryType) <= sizeof(long))) {
7043
- __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, long, PyLong_AsLong(x))
7232
+ if ((sizeof(OGRwkbGeometryType) <= sizeof(long))) {
7233
+ __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, long, PyLong_AsLong(x))
7044
7234
  #ifdef HAVE_LONG_LONG
7045
- } else if ((sizeof(OGRwkbGeometryType) <= sizeof(PY_LONG_LONG))) {
7046
- __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, PY_LONG_LONG, PyLong_AsLongLong(x))
7235
+ } else if ((sizeof(OGRwkbGeometryType) <= sizeof(PY_LONG_LONG))) {
7236
+ __PYX_VERIFY_RETURN_INT_EXC(OGRwkbGeometryType, PY_LONG_LONG, PyLong_AsLongLong(x))
7047
7237
  #endif
7048
- }
7049
7238
  }
7050
- PyErr_SetString(PyExc_RuntimeError,
7051
- "_PyLong_AsByteArray() not available, cannot convert large enums");
7052
- return (OGRwkbGeometryType) -1;
7053
- } else {
7239
+ }
7240
+ {
7054
7241
  OGRwkbGeometryType val;
7055
- PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7056
- if (!tmp) return (OGRwkbGeometryType) -1;
7057
- val = __Pyx_PyInt_As_OGRwkbGeometryType(tmp);
7058
- Py_DECREF(tmp);
7242
+ int ret = -1;
7243
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
7244
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
7245
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
7246
+ if (unlikely(bytes_copied == -1)) {
7247
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
7248
+ goto raise_overflow;
7249
+ } else {
7250
+ ret = 0;
7251
+ }
7252
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
7253
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
7254
+ unsigned char *bytes = (unsigned char *)&val;
7255
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
7256
+ bytes, sizeof(val),
7257
+ is_little, !is_unsigned);
7258
+ #else
7259
+ PyErr_SetString(PyExc_RuntimeError,
7260
+ "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
7261
+ val = (OGRwkbGeometryType) -1;
7262
+ #endif
7263
+ if (unlikely(ret))
7264
+ return (OGRwkbGeometryType) -1;
7059
7265
  return val;
7060
7266
  }
7061
7267
  raise_overflow:
@@ -7115,12 +7321,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
7115
7321
  }
7116
7322
  }
7117
7323
  {
7118
- int one = 1; int little = (int)*(unsigned char *)&one;
7119
7324
  unsigned char *bytes = (unsigned char *)&value;
7120
- #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
7325
+ #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
7326
+ if (is_unsigned) {
7327
+ return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
7328
+ } else {
7329
+ return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
7330
+ }
7331
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
7332
+ int one = 1; int little = (int)*(unsigned char *)&one;
7121
7333
  return _PyLong_FromByteArray(bytes, sizeof(long),
7122
7334
  little, !is_unsigned);
7123
7335
  #else
7336
+ int one = 1; int little = (int)*(unsigned char *)&one;
7124
7337
  PyObject *from_bytes, *result = NULL;
7125
7338
  PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
7126
7339
  from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
@@ -7170,245 +7383,239 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
7170
7383
  }
7171
7384
  return (long) val;
7172
7385
  }
7173
- } else
7386
+ }
7174
7387
  #endif
7175
- if (likely(PyLong_Check(x))) {
7176
- if (is_unsigned) {
7388
+ if (unlikely(!PyLong_Check(x))) {
7389
+ long val;
7390
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7391
+ if (!tmp) return (long) -1;
7392
+ val = __Pyx_PyInt_As_long(tmp);
7393
+ Py_DECREF(tmp);
7394
+ return val;
7395
+ }
7396
+ if (is_unsigned) {
7177
7397
  #if CYTHON_USE_PYLONG_INTERNALS
7178
- if (unlikely(__Pyx_PyLong_IsNeg(x))) {
7179
- goto raise_neg_overflow;
7180
- } else if (__Pyx_PyLong_IsCompact(x)) {
7181
- __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
7182
- } else {
7183
- const digit* digits = __Pyx_PyLong_Digits(x);
7184
- assert(__Pyx_PyLong_DigitCount(x) > 1);
7185
- switch (__Pyx_PyLong_DigitCount(x)) {
7186
- case 2:
7187
- if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
7188
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7189
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7190
- } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
7191
- return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7192
- }
7398
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
7399
+ goto raise_neg_overflow;
7400
+ } else if (__Pyx_PyLong_IsCompact(x)) {
7401
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
7402
+ } else {
7403
+ const digit* digits = __Pyx_PyLong_Digits(x);
7404
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7405
+ switch (__Pyx_PyLong_DigitCount(x)) {
7406
+ case 2:
7407
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
7408
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7409
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7410
+ } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
7411
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7193
7412
  }
7194
- break;
7195
- case 3:
7196
- if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
7197
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7198
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7199
- } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
7200
- return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7201
- }
7413
+ }
7414
+ break;
7415
+ case 3:
7416
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
7417
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7418
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7419
+ } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
7420
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7202
7421
  }
7203
- break;
7204
- case 4:
7205
- if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
7206
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7207
- __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])))
7208
- } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
7209
- return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7210
- }
7422
+ }
7423
+ break;
7424
+ case 4:
7425
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
7426
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7427
+ __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])))
7428
+ } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
7429
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7211
7430
  }
7212
- break;
7213
- }
7431
+ }
7432
+ break;
7214
7433
  }
7434
+ }
7215
7435
  #endif
7216
7436
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
7217
- if (unlikely(Py_SIZE(x) < 0)) {
7218
- goto raise_neg_overflow;
7219
- }
7437
+ if (unlikely(Py_SIZE(x) < 0)) {
7438
+ goto raise_neg_overflow;
7439
+ }
7220
7440
  #else
7221
- {
7222
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7223
- if (unlikely(result < 0))
7224
- return (long) -1;
7225
- if (unlikely(result == 1))
7226
- goto raise_neg_overflow;
7227
- }
7441
+ {
7442
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7443
+ if (unlikely(result < 0))
7444
+ return (long) -1;
7445
+ if (unlikely(result == 1))
7446
+ goto raise_neg_overflow;
7447
+ }
7228
7448
  #endif
7229
- if ((sizeof(long) <= sizeof(unsigned long))) {
7230
- __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
7449
+ if ((sizeof(long) <= sizeof(unsigned long))) {
7450
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
7231
7451
  #ifdef HAVE_LONG_LONG
7232
- } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
7233
- __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7452
+ } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
7453
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7234
7454
  #endif
7235
- }
7236
- } else {
7455
+ }
7456
+ } else {
7237
7457
  #if CYTHON_USE_PYLONG_INTERNALS
7238
- if (__Pyx_PyLong_IsCompact(x)) {
7239
- __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
7240
- } else {
7241
- const digit* digits = __Pyx_PyLong_Digits(x);
7242
- assert(__Pyx_PyLong_DigitCount(x) > 1);
7243
- switch (__Pyx_PyLong_SignedDigitCount(x)) {
7244
- case -2:
7245
- if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
7246
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7247
- __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7248
- } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7249
- return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7250
- }
7458
+ if (__Pyx_PyLong_IsCompact(x)) {
7459
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
7460
+ } else {
7461
+ const digit* digits = __Pyx_PyLong_Digits(x);
7462
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7463
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
7464
+ case -2:
7465
+ if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
7466
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7467
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7468
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7469
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7251
7470
  }
7252
- break;
7253
- case 2:
7254
- if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
7255
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7256
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7257
- } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7258
- return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7259
- }
7471
+ }
7472
+ break;
7473
+ case 2:
7474
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
7475
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7476
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7477
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7478
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7260
7479
  }
7261
- break;
7262
- case -3:
7263
- if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7264
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7265
- __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7266
- } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7267
- return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7268
- }
7480
+ }
7481
+ break;
7482
+ case -3:
7483
+ if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
7484
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7485
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7486
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7487
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7269
7488
  }
7270
- break;
7271
- case 3:
7272
- if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
7273
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7274
- __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7275
- } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7276
- return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7277
- }
7489
+ }
7490
+ break;
7491
+ case 3:
7492
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
7493
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7494
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7495
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7496
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7278
7497
  }
7279
- break;
7280
- case -4:
7281
- if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7282
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7283
- __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])))
7284
- } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
7285
- return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7286
- }
7498
+ }
7499
+ break;
7500
+ case -4:
7501
+ if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
7502
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7503
+ __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])))
7504
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
7505
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7287
7506
  }
7288
- break;
7289
- case 4:
7290
- if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
7291
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7292
- __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])))
7293
- } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
7294
- return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7295
- }
7507
+ }
7508
+ break;
7509
+ case 4:
7510
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
7511
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7512
+ __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])))
7513
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
7514
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7296
7515
  }
7297
- break;
7298
- }
7516
+ }
7517
+ break;
7299
7518
  }
7519
+ }
7300
7520
  #endif
7301
- if ((sizeof(long) <= sizeof(long))) {
7302
- __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
7521
+ if ((sizeof(long) <= sizeof(long))) {
7522
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
7303
7523
  #ifdef HAVE_LONG_LONG
7304
- } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
7305
- __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
7524
+ } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
7525
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
7306
7526
  #endif
7307
- }
7527
+ }
7528
+ }
7529
+ {
7530
+ long val;
7531
+ int ret = -1;
7532
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
7533
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
7534
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
7535
+ if (unlikely(bytes_copied == -1)) {
7536
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
7537
+ goto raise_overflow;
7538
+ } else {
7539
+ ret = 0;
7540
+ }
7541
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
7542
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
7543
+ unsigned char *bytes = (unsigned char *)&val;
7544
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
7545
+ bytes, sizeof(val),
7546
+ is_little, !is_unsigned);
7547
+ #else
7548
+ PyObject *v;
7549
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
7550
+ int bits, remaining_bits, is_negative = 0;
7551
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
7552
+ if (likely(PyLong_CheckExact(x))) {
7553
+ v = __Pyx_NewRef(x);
7554
+ } else {
7555
+ v = PyNumber_Long(x);
7556
+ if (unlikely(!v)) return (long) -1;
7557
+ assert(PyLong_CheckExact(v));
7308
7558
  }
7309
7559
  {
7310
- long val;
7311
- PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7312
- #if PY_MAJOR_VERSION < 3
7313
- if (likely(v) && !PyLong_Check(v)) {
7314
- PyObject *tmp = v;
7315
- v = PyNumber_Long(tmp);
7316
- Py_DECREF(tmp);
7317
- }
7318
- #endif
7319
- if (likely(v)) {
7320
- int ret = -1;
7321
- #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
7322
- int one = 1; int is_little = (int)*(unsigned char *)&one;
7323
- unsigned char *bytes = (unsigned char *)&val;
7324
- ret = _PyLong_AsByteArray((PyLongObject *)v,
7325
- bytes, sizeof(val),
7326
- is_little, !is_unsigned);
7327
- #else
7328
- PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
7329
- int bits, remaining_bits, is_negative = 0;
7330
- long idigit;
7331
- int chunk_size = (sizeof(long) < 8) ? 30 : 62;
7332
- if (unlikely(!PyLong_CheckExact(v))) {
7333
- PyObject *tmp = v;
7334
- v = PyNumber_Long(v);
7335
- assert(PyLong_CheckExact(v));
7336
- Py_DECREF(tmp);
7337
- if (unlikely(!v)) return (long) -1;
7338
- }
7339
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7340
- if (Py_SIZE(x) == 0)
7341
- return (long) 0;
7342
- is_negative = Py_SIZE(x) < 0;
7343
- #else
7344
- {
7345
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7346
- if (unlikely(result < 0))
7347
- return (long) -1;
7348
- is_negative = result == 1;
7349
- }
7350
- #endif
7351
- if (is_unsigned && unlikely(is_negative)) {
7352
- goto raise_neg_overflow;
7353
- } else if (is_negative) {
7354
- stepval = PyNumber_Invert(v);
7355
- if (unlikely(!stepval))
7356
- return (long) -1;
7357
- } else {
7358
- stepval = __Pyx_NewRef(v);
7359
- }
7360
- val = (long) 0;
7361
- mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
7362
- shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
7363
- for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
7364
- PyObject *tmp, *digit;
7365
- digit = PyNumber_And(stepval, mask);
7366
- if (unlikely(!digit)) goto done;
7367
- idigit = PyLong_AsLong(digit);
7368
- Py_DECREF(digit);
7369
- if (unlikely(idigit < 0)) goto done;
7370
- tmp = PyNumber_Rshift(stepval, shift);
7371
- if (unlikely(!tmp)) goto done;
7372
- Py_DECREF(stepval); stepval = tmp;
7373
- val |= ((long) idigit) << bits;
7374
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7375
- if (Py_SIZE(stepval) == 0)
7376
- goto unpacking_done;
7377
- #endif
7378
- }
7379
- idigit = PyLong_AsLong(stepval);
7380
- if (unlikely(idigit < 0)) goto done;
7381
- remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
7382
- if (unlikely(idigit >= (1L << remaining_bits)))
7383
- goto raise_overflow;
7384
- val |= ((long) idigit) << bits;
7385
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7386
- unpacking_done:
7387
- #endif
7388
- if (!is_unsigned) {
7389
- if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
7390
- goto raise_overflow;
7391
- if (is_negative)
7392
- val = ~val;
7393
- }
7394
- ret = 0;
7395
- done:
7396
- Py_XDECREF(shift);
7397
- Py_XDECREF(mask);
7398
- Py_XDECREF(stepval);
7399
- #endif
7560
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
7561
+ if (unlikely(result < 0)) {
7400
7562
  Py_DECREF(v);
7401
- if (likely(!ret))
7402
- return val;
7563
+ return (long) -1;
7403
7564
  }
7404
- return (long) -1;
7565
+ is_negative = result == 1;
7405
7566
  }
7406
- } else {
7407
- long val;
7408
- PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7409
- if (!tmp) return (long) -1;
7410
- val = __Pyx_PyInt_As_long(tmp);
7411
- Py_DECREF(tmp);
7567
+ if (is_unsigned && unlikely(is_negative)) {
7568
+ Py_DECREF(v);
7569
+ goto raise_neg_overflow;
7570
+ } else if (is_negative) {
7571
+ stepval = PyNumber_Invert(v);
7572
+ Py_DECREF(v);
7573
+ if (unlikely(!stepval))
7574
+ return (long) -1;
7575
+ } else {
7576
+ stepval = v;
7577
+ }
7578
+ v = NULL;
7579
+ val = (long) 0;
7580
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
7581
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
7582
+ for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
7583
+ PyObject *tmp, *digit;
7584
+ long idigit;
7585
+ digit = PyNumber_And(stepval, mask);
7586
+ if (unlikely(!digit)) goto done;
7587
+ idigit = PyLong_AsLong(digit);
7588
+ Py_DECREF(digit);
7589
+ if (unlikely(idigit < 0)) goto done;
7590
+ val |= ((long) idigit) << bits;
7591
+ tmp = PyNumber_Rshift(stepval, shift);
7592
+ if (unlikely(!tmp)) goto done;
7593
+ Py_DECREF(stepval); stepval = tmp;
7594
+ }
7595
+ Py_DECREF(shift); shift = NULL;
7596
+ Py_DECREF(mask); mask = NULL;
7597
+ {
7598
+ long idigit = PyLong_AsLong(stepval);
7599
+ if (unlikely(idigit < 0)) goto done;
7600
+ remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
7601
+ if (unlikely(idigit >= (1L << remaining_bits)))
7602
+ goto raise_overflow;
7603
+ val |= ((long) idigit) << bits;
7604
+ }
7605
+ if (!is_unsigned) {
7606
+ if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
7607
+ goto raise_overflow;
7608
+ if (is_negative)
7609
+ val = ~val;
7610
+ }
7611
+ ret = 0;
7612
+ done:
7613
+ Py_XDECREF(shift);
7614
+ Py_XDECREF(mask);
7615
+ Py_XDECREF(stepval);
7616
+ #endif
7617
+ if (unlikely(ret))
7618
+ return (long) -1;
7412
7619
  return val;
7413
7620
  }
7414
7621
  raise_overflow:
@@ -7443,245 +7650,239 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
7443
7650
  }
7444
7651
  return (int) val;
7445
7652
  }
7446
- } else
7653
+ }
7447
7654
  #endif
7448
- if (likely(PyLong_Check(x))) {
7449
- if (is_unsigned) {
7655
+ if (unlikely(!PyLong_Check(x))) {
7656
+ int val;
7657
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7658
+ if (!tmp) return (int) -1;
7659
+ val = __Pyx_PyInt_As_int(tmp);
7660
+ Py_DECREF(tmp);
7661
+ return val;
7662
+ }
7663
+ if (is_unsigned) {
7450
7664
  #if CYTHON_USE_PYLONG_INTERNALS
7451
- if (unlikely(__Pyx_PyLong_IsNeg(x))) {
7452
- goto raise_neg_overflow;
7453
- } else if (__Pyx_PyLong_IsCompact(x)) {
7454
- __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
7455
- } else {
7456
- const digit* digits = __Pyx_PyLong_Digits(x);
7457
- assert(__Pyx_PyLong_DigitCount(x) > 1);
7458
- switch (__Pyx_PyLong_DigitCount(x)) {
7459
- case 2:
7460
- if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
7461
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7462
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7463
- } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
7464
- return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7465
- }
7665
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
7666
+ goto raise_neg_overflow;
7667
+ } else if (__Pyx_PyLong_IsCompact(x)) {
7668
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
7669
+ } else {
7670
+ const digit* digits = __Pyx_PyLong_Digits(x);
7671
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7672
+ switch (__Pyx_PyLong_DigitCount(x)) {
7673
+ case 2:
7674
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
7675
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7676
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7677
+ } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
7678
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7466
7679
  }
7467
- break;
7468
- case 3:
7469
- if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
7470
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7471
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7472
- } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
7473
- return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7474
- }
7680
+ }
7681
+ break;
7682
+ case 3:
7683
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
7684
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7685
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7686
+ } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
7687
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7475
7688
  }
7476
- break;
7477
- case 4:
7478
- if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
7479
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7480
- __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])))
7481
- } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
7482
- return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7483
- }
7689
+ }
7690
+ break;
7691
+ case 4:
7692
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
7693
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7694
+ __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])))
7695
+ } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
7696
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7484
7697
  }
7485
- break;
7486
- }
7698
+ }
7699
+ break;
7487
7700
  }
7701
+ }
7488
7702
  #endif
7489
7703
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
7490
- if (unlikely(Py_SIZE(x) < 0)) {
7491
- goto raise_neg_overflow;
7492
- }
7704
+ if (unlikely(Py_SIZE(x) < 0)) {
7705
+ goto raise_neg_overflow;
7706
+ }
7493
7707
  #else
7494
- {
7495
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7496
- if (unlikely(result < 0))
7497
- return (int) -1;
7498
- if (unlikely(result == 1))
7499
- goto raise_neg_overflow;
7500
- }
7708
+ {
7709
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7710
+ if (unlikely(result < 0))
7711
+ return (int) -1;
7712
+ if (unlikely(result == 1))
7713
+ goto raise_neg_overflow;
7714
+ }
7501
7715
  #endif
7502
- if ((sizeof(int) <= sizeof(unsigned long))) {
7503
- __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
7716
+ if ((sizeof(int) <= sizeof(unsigned long))) {
7717
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
7504
7718
  #ifdef HAVE_LONG_LONG
7505
- } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
7506
- __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7719
+ } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
7720
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7507
7721
  #endif
7508
- }
7509
- } else {
7722
+ }
7723
+ } else {
7510
7724
  #if CYTHON_USE_PYLONG_INTERNALS
7511
- if (__Pyx_PyLong_IsCompact(x)) {
7512
- __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
7513
- } else {
7514
- const digit* digits = __Pyx_PyLong_Digits(x);
7515
- assert(__Pyx_PyLong_DigitCount(x) > 1);
7516
- switch (__Pyx_PyLong_SignedDigitCount(x)) {
7517
- case -2:
7518
- if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
7519
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7520
- __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7521
- } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7522
- return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7523
- }
7725
+ if (__Pyx_PyLong_IsCompact(x)) {
7726
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
7727
+ } else {
7728
+ const digit* digits = __Pyx_PyLong_Digits(x);
7729
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
7730
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
7731
+ case -2:
7732
+ if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
7733
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7734
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7735
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7736
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7524
7737
  }
7525
- break;
7526
- case 2:
7527
- if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
7528
- if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7529
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7530
- } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7531
- return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7532
- }
7738
+ }
7739
+ break;
7740
+ case 2:
7741
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
7742
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
7743
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7744
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7745
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7533
7746
  }
7534
- break;
7535
- case -3:
7536
- if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7537
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7538
- __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7539
- } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7540
- return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7541
- }
7747
+ }
7748
+ break;
7749
+ case -3:
7750
+ if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
7751
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7752
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7753
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7754
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7542
7755
  }
7543
- break;
7544
- case 3:
7545
- if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
7546
- if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7547
- __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7548
- } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7549
- return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7550
- }
7756
+ }
7757
+ break;
7758
+ case 3:
7759
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
7760
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
7761
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7762
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7763
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7551
7764
  }
7552
- break;
7553
- case -4:
7554
- if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7555
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7556
- __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])))
7557
- } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
7558
- return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7559
- }
7765
+ }
7766
+ break;
7767
+ case -4:
7768
+ if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
7769
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7770
+ __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])))
7771
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
7772
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7560
7773
  }
7561
- break;
7562
- case 4:
7563
- if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
7564
- if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7565
- __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])))
7566
- } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
7567
- return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7568
- }
7774
+ }
7775
+ break;
7776
+ case 4:
7777
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
7778
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
7779
+ __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])))
7780
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
7781
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7569
7782
  }
7570
- break;
7571
- }
7783
+ }
7784
+ break;
7572
7785
  }
7786
+ }
7573
7787
  #endif
7574
- if ((sizeof(int) <= sizeof(long))) {
7575
- __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
7788
+ if ((sizeof(int) <= sizeof(long))) {
7789
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
7576
7790
  #ifdef HAVE_LONG_LONG
7577
- } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
7578
- __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
7791
+ } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
7792
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
7579
7793
  #endif
7580
- }
7794
+ }
7795
+ }
7796
+ {
7797
+ int val;
7798
+ int ret = -1;
7799
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
7800
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
7801
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
7802
+ if (unlikely(bytes_copied == -1)) {
7803
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
7804
+ goto raise_overflow;
7805
+ } else {
7806
+ ret = 0;
7807
+ }
7808
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
7809
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
7810
+ unsigned char *bytes = (unsigned char *)&val;
7811
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
7812
+ bytes, sizeof(val),
7813
+ is_little, !is_unsigned);
7814
+ #else
7815
+ PyObject *v;
7816
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
7817
+ int bits, remaining_bits, is_negative = 0;
7818
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
7819
+ if (likely(PyLong_CheckExact(x))) {
7820
+ v = __Pyx_NewRef(x);
7821
+ } else {
7822
+ v = PyNumber_Long(x);
7823
+ if (unlikely(!v)) return (int) -1;
7824
+ assert(PyLong_CheckExact(v));
7581
7825
  }
7582
7826
  {
7583
- int val;
7584
- PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7585
- #if PY_MAJOR_VERSION < 3
7586
- if (likely(v) && !PyLong_Check(v)) {
7587
- PyObject *tmp = v;
7588
- v = PyNumber_Long(tmp);
7589
- Py_DECREF(tmp);
7590
- }
7591
- #endif
7592
- if (likely(v)) {
7593
- int ret = -1;
7594
- #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
7595
- int one = 1; int is_little = (int)*(unsigned char *)&one;
7596
- unsigned char *bytes = (unsigned char *)&val;
7597
- ret = _PyLong_AsByteArray((PyLongObject *)v,
7598
- bytes, sizeof(val),
7599
- is_little, !is_unsigned);
7600
- #else
7601
- PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
7602
- int bits, remaining_bits, is_negative = 0;
7603
- long idigit;
7604
- int chunk_size = (sizeof(long) < 8) ? 30 : 62;
7605
- if (unlikely(!PyLong_CheckExact(v))) {
7606
- PyObject *tmp = v;
7607
- v = PyNumber_Long(v);
7608
- assert(PyLong_CheckExact(v));
7609
- Py_DECREF(tmp);
7610
- if (unlikely(!v)) return (int) -1;
7611
- }
7612
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7613
- if (Py_SIZE(x) == 0)
7614
- return (int) 0;
7615
- is_negative = Py_SIZE(x) < 0;
7616
- #else
7617
- {
7618
- int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7619
- if (unlikely(result < 0))
7620
- return (int) -1;
7621
- is_negative = result == 1;
7622
- }
7623
- #endif
7624
- if (is_unsigned && unlikely(is_negative)) {
7625
- goto raise_neg_overflow;
7626
- } else if (is_negative) {
7627
- stepval = PyNumber_Invert(v);
7628
- if (unlikely(!stepval))
7629
- return (int) -1;
7630
- } else {
7631
- stepval = __Pyx_NewRef(v);
7632
- }
7633
- val = (int) 0;
7634
- mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
7635
- shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
7636
- for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
7637
- PyObject *tmp, *digit;
7638
- digit = PyNumber_And(stepval, mask);
7639
- if (unlikely(!digit)) goto done;
7640
- idigit = PyLong_AsLong(digit);
7641
- Py_DECREF(digit);
7642
- if (unlikely(idigit < 0)) goto done;
7643
- tmp = PyNumber_Rshift(stepval, shift);
7644
- if (unlikely(!tmp)) goto done;
7645
- Py_DECREF(stepval); stepval = tmp;
7646
- val |= ((int) idigit) << bits;
7647
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7648
- if (Py_SIZE(stepval) == 0)
7649
- goto unpacking_done;
7650
- #endif
7651
- }
7652
- idigit = PyLong_AsLong(stepval);
7653
- if (unlikely(idigit < 0)) goto done;
7654
- remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
7655
- if (unlikely(idigit >= (1L << remaining_bits)))
7656
- goto raise_overflow;
7657
- val |= ((int) idigit) << bits;
7658
- #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
7659
- unpacking_done:
7660
- #endif
7661
- if (!is_unsigned) {
7662
- if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
7663
- goto raise_overflow;
7664
- if (is_negative)
7665
- val = ~val;
7666
- }
7667
- ret = 0;
7668
- done:
7669
- Py_XDECREF(shift);
7670
- Py_XDECREF(mask);
7671
- Py_XDECREF(stepval);
7672
- #endif
7827
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
7828
+ if (unlikely(result < 0)) {
7673
7829
  Py_DECREF(v);
7674
- if (likely(!ret))
7675
- return val;
7830
+ return (int) -1;
7676
7831
  }
7677
- return (int) -1;
7832
+ is_negative = result == 1;
7678
7833
  }
7679
- } else {
7680
- int val;
7681
- PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7682
- if (!tmp) return (int) -1;
7683
- val = __Pyx_PyInt_As_int(tmp);
7684
- Py_DECREF(tmp);
7834
+ if (is_unsigned && unlikely(is_negative)) {
7835
+ Py_DECREF(v);
7836
+ goto raise_neg_overflow;
7837
+ } else if (is_negative) {
7838
+ stepval = PyNumber_Invert(v);
7839
+ Py_DECREF(v);
7840
+ if (unlikely(!stepval))
7841
+ return (int) -1;
7842
+ } else {
7843
+ stepval = v;
7844
+ }
7845
+ v = NULL;
7846
+ val = (int) 0;
7847
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
7848
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
7849
+ for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
7850
+ PyObject *tmp, *digit;
7851
+ long idigit;
7852
+ digit = PyNumber_And(stepval, mask);
7853
+ if (unlikely(!digit)) goto done;
7854
+ idigit = PyLong_AsLong(digit);
7855
+ Py_DECREF(digit);
7856
+ if (unlikely(idigit < 0)) goto done;
7857
+ val |= ((int) idigit) << bits;
7858
+ tmp = PyNumber_Rshift(stepval, shift);
7859
+ if (unlikely(!tmp)) goto done;
7860
+ Py_DECREF(stepval); stepval = tmp;
7861
+ }
7862
+ Py_DECREF(shift); shift = NULL;
7863
+ Py_DECREF(mask); mask = NULL;
7864
+ {
7865
+ long idigit = PyLong_AsLong(stepval);
7866
+ if (unlikely(idigit < 0)) goto done;
7867
+ remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
7868
+ if (unlikely(idigit >= (1L << remaining_bits)))
7869
+ goto raise_overflow;
7870
+ val |= ((int) idigit) << bits;
7871
+ }
7872
+ if (!is_unsigned) {
7873
+ if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
7874
+ goto raise_overflow;
7875
+ if (is_negative)
7876
+ val = ~val;
7877
+ }
7878
+ ret = 0;
7879
+ done:
7880
+ Py_XDECREF(shift);
7881
+ Py_XDECREF(mask);
7882
+ Py_XDECREF(stepval);
7883
+ #endif
7884
+ if (unlikely(ret))
7885
+ return (int) -1;
7685
7886
  return val;
7686
7887
  }
7687
7888
  raise_overflow:
@@ -7775,9 +7976,9 @@ bad:
7775
7976
  }
7776
7977
 
7777
7978
  /* FunctionImport */
7778
- #ifndef __PYX_HAVE_RT_ImportFunction_3_0_10
7779
- #define __PYX_HAVE_RT_ImportFunction_3_0_10
7780
- static int __Pyx_ImportFunction_3_0_10(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
7979
+ #ifndef __PYX_HAVE_RT_ImportFunction_3_0_12
7980
+ #define __PYX_HAVE_RT_ImportFunction_3_0_12
7981
+ static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
7781
7982
  PyObject *d = 0;
7782
7983
  PyObject *cobj = 0;
7783
7984
  union {