Skip to content

Commit

Permalink
fix(core): bool8 doesn't exist as an alias to bool_ anymore in numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp committed Dec 21, 2024
1 parent 4abb20c commit 98ac8ff
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bundles/core/src/_serial_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _encode_ext(obj):
return ExtType(8, packer.pack([obj.days, obj.seconds, obj.microseconds]))
if isinstance(obj, Image.Image):
return ExtType(9, _encode_image(obj))
if isinstance(obj, (numpy.number, numpy.bool_, numpy.bool8)):
if isinstance(obj, (numpy.number, numpy.bool_)):
# handle numpy scalar subclasses
return ExtType(10, packer.pack(_encode_numpy_number(obj)))
if isinstance(obj, FinalizedState):
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/core/src/_serialize.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PRIMITIVE_TYPES = frozenset((
bool, int, float, bytes, bytearray, str, dict, list, memoryview, type(None),
# additionally supported types
complex, tuple, range, _UniqueName,
numpy.ndarray, numpy.number, numpy.bool_, numpy.bool8,
numpy.ndarray, numpy.number, numpy.bool_,
set, frozenset, deque, OrderedDict,
datetime, timedelta, timezone,
Image.Image, FinalizedState,
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/core/src/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _count_object_types(obj):
if isinstance(obj, numpy.ndarray):
_object_counts[numpy.ndarray] += 1
return
if isinstance(obj, (numpy.number, numpy.bool_, numpy.bool8)):
if isinstance(obj, (numpy.number, numpy.bool_)):
_object_counts[numpy.number] += 1
return
t = type(obj)
Expand Down
1 change: 0 additions & 1 deletion src/bundles/core/src/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def numpy_numbers():
except Exception:
pass
yield numpy.bool_
yield numpy.bool8

_final_primitives = (
type(None),
Expand Down

0 comments on commit 98ac8ff

Please sign in to comment.