Skip to content

Commit aae159f

Browse files
committed
Put guard around check involving numpy
1 parent 9ae90e8 commit aae159f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bson/binary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def from_vector(
491491
assert isinstance(dtype, BinaryVectorDtype)
492492
metadata = struct.pack("<sB", dtype.value, padding)
493493

494-
if isinstance(vector, np.ndarray):
494+
if _NUMPY_AVAILABLE and isinstance(vector, np.ndarray):
495495
data = _numpy_vector_to_bytes(vector, dtype)
496496
else:
497497
if dtype == BinaryVectorDtype.INT8: # pack ints in [-128, 127] as signed int8

0 commit comments

Comments
 (0)