Skip to content

Commit b22309e

Browse files
yocaleboixhamza
authored andcommitted
fix crash on >= python3.10
1 parent 7178d58 commit b22309e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nvpair.pxi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ from types cimport *
99
from libc.stdint cimport uintptr_t
1010
from libc.stdlib cimport malloc, free
1111

12+
try:
13+
from collections import Sequence
14+
except ImportError:
15+
# >= py3.10 moved everything into top-level "abc" module
16+
# https://docs.python.org/3.9/library/collections.html
17+
from collections.abc import Sequence
18+
1219

1320
@cython.internal
1421
cdef class NVList(object):
@@ -247,7 +254,7 @@ cdef class NVList(object):
247254
nvpair.nvlist_add_nvlist(self.handle, key, cnvlist.handle)
248255
return
249256

250-
if isinstance(value, collections.Sequence):
257+
if isinstance(value, Sequence):
251258
if typeid == nvpair.DATA_TYPE_STRING_ARRAY:
252259
carray = malloc(len(value) * sizeof(char*))
253260
for idx, i in enumerate(value):

0 commit comments

Comments
 (0)