From ddbdfff4d341f28c2f6a0dd71f3b352ea0decc9e Mon Sep 17 00:00:00 2001 From: Jongbin Jung Date: Sat, 5 Oct 2024 12:31:55 -0700 Subject: [PATCH] Allow string subtypes as H3str --- src/h3/_cy/h3lib.pxd | 3 ++- src/h3/api/basic_int/__init__.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/h3/_cy/h3lib.pxd b/src/h3/_cy/h3lib.pxd index a578a8fe..e91cc2df 100644 --- a/src/h3/_cy/h3lib.pxd +++ b/src/h3/_cy/h3lib.pxd @@ -1,7 +1,8 @@ +# cython: c_string_type=unicode, c_string_encoding=utf8 from cpython cimport bool from libc.stdint cimport uint32_t, uint64_t, int64_t -ctypedef basestring H3str +ctypedef object H3str cdef extern from 'h3api.h': cdef int H3_VERSION_MAJOR diff --git a/src/h3/api/basic_int/__init__.py b/src/h3/api/basic_int/__init__.py index 992fce78..60359662 100644 --- a/src/h3/api/basic_int/__init__.py +++ b/src/h3/api/basic_int/__init__.py @@ -53,7 +53,7 @@ def str_to_int(h): int Unsigned 64-bit integer """ - return _cy.str_to_int(str(h)) + return _cy.str_to_int(h) def int_to_str(x):