From ff7013e45754c619382225cc94cca6c0dea6d020 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 14 Nov 2025 18:47:50 -0500 Subject: [PATCH] Fixed warning from numpy relating to copy keyword in np.array(buffer) --- numpy_ringbuffer/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/numpy_ringbuffer/__init__.py b/numpy_ringbuffer/__init__.py index 95a5130..b188a35 100644 --- a/numpy_ringbuffer/__init__.py +++ b/numpy_ringbuffer/__init__.py @@ -53,7 +53,9 @@ def is_full(self): return len(self) == self._capacity # numpy compatibility - def __array__(self): + def __array__(self, copy=True): + if not copy: + raise ValueError("Cannot create a numpy array without copying. Pass copy=True.") return self._unwrap() @property