From 98ac8ffaf620aca2bfb4f6de9cab5afee227b61e Mon Sep 17 00:00:00 2001 From: Zach Pearson Date: Fri, 20 Dec 2024 17:31:51 -0800 Subject: [PATCH] fix(core): bool8 doesn't exist as an alias to bool_ anymore in numpy --- src/bundles/core/src/_serial_python.py | 2 +- src/bundles/core/src/_serialize.pyx | 2 +- src/bundles/core/src/serialize.py | 2 +- src/bundles/core/src/state.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bundles/core/src/_serial_python.py b/src/bundles/core/src/_serial_python.py index ceada90c91..6197ed57ef 100644 --- a/src/bundles/core/src/_serial_python.py +++ b/src/bundles/core/src/_serial_python.py @@ -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): diff --git a/src/bundles/core/src/_serialize.pyx b/src/bundles/core/src/_serialize.pyx index 1dcb7d5bf2..5f43e00021 100644 --- a/src/bundles/core/src/_serialize.pyx +++ b/src/bundles/core/src/_serialize.pyx @@ -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, diff --git a/src/bundles/core/src/serialize.py b/src/bundles/core/src/serialize.py index 46c8b4b361..662b5c8647 100644 --- a/src/bundles/core/src/serialize.py +++ b/src/bundles/core/src/serialize.py @@ -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) diff --git a/src/bundles/core/src/state.py b/src/bundles/core/src/state.py index 5a4e657d28..2733eda446 100644 --- a/src/bundles/core/src/state.py +++ b/src/bundles/core/src/state.py @@ -157,7 +157,6 @@ def numpy_numbers(): except Exception: pass yield numpy.bool_ - yield numpy.bool8 _final_primitives = ( type(None),