Skip to content

Commit

Permalink
fix crash on >= python3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo authored and ixhamza committed Jan 19, 2024
1 parent 7178d58 commit b22309e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nvpair.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ from types cimport *
from libc.stdint cimport uintptr_t
from libc.stdlib cimport malloc, free

try:
from collections import Sequence
except ImportError:
# >= py3.10 moved everything into top-level "abc" module
# https://docs.python.org/3.9/library/collections.html
from collections.abc import Sequence


@cython.internal
cdef class NVList(object):
Expand Down Expand Up @@ -247,7 +254,7 @@ cdef class NVList(object):
nvpair.nvlist_add_nvlist(self.handle, key, cnvlist.handle)
return

if isinstance(value, collections.Sequence):
if isinstance(value, Sequence):
if typeid == nvpair.DATA_TYPE_STRING_ARRAY:
carray = malloc(len(value) * sizeof(char*))
for idx, i in enumerate(value):
Expand Down

0 comments on commit b22309e

Please sign in to comment.