Skip to content

Commit bc4d4ff

Browse files
committed
Fix issues when array is a numpy array, not blosc2
1 parent d3148a1 commit bc4d4ff

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/blosc2/indexing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _copy_descriptor_for_token(array: blosc2.NDArray, token: str) -> dict:
256256

257257

258258
def _is_persistent_array(array: blosc2.NDArray) -> bool:
259-
return array.urlpath is not None
259+
return getattr(array, "urlpath", None) is not None
260260

261261

262262
def _tmpdir_for_array(array: blosc2.NDArray) -> str | None:
@@ -267,8 +267,9 @@ def _tmpdir_for_array(array: blosc2.NDArray) -> str | None:
267267
size limits on ``/tmp`` (commonly a tmpfs with only a few GB).
268268
For in-memory arrays we fall back to the system default (``None``).
269269
"""
270-
if array.urlpath is not None:
271-
return str(Path(array.urlpath).resolve().parent)
270+
urlpath = getattr(array, "urlpath", None)
271+
if urlpath is not None:
272+
return str(Path(urlpath).resolve().parent)
272273
return None
273274

274275

0 commit comments

Comments
 (0)