Skip to content

Commit 517d54b

Browse files
authored
Merge pull request #133 from faisal-shah/fix/as_dict-for-arrays
Fix as_dict for arrays
2 parents 2cec7bf + 494b836 commit 517d54b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ctypeslib/data/structure_type.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class AsDictMixin:
1717
type_ = type(value)
1818
if hasattr(value, "_length_") and hasattr(value, "_type_"):
1919
# array
20-
if not hasattr(type_, "as_dict"):
21-
value = [v for v in value]
22-
else:
23-
type_ = type_._type_
20+
type_ = type_._type_
21+
if hasattr(type_, 'as_dict'):
2422
value = [type_.as_dict(v) for v in value]
23+
else:
24+
value = [i for i in value]
2525
elif hasattr(value, "contents") and hasattr(value, "_type_"):
2626
# pointer
2727
try:

0 commit comments

Comments
 (0)