fix shm path test on macos (#2357)

AttributeError: 'PosixPath' object has no attribute 'startswith'
This commit is contained in:
chenyu
2023-11-18 17:37:42 -05:00
committed by GitHub
parent f02e17a967
commit 0443cbfbb9

View File

@@ -14,7 +14,7 @@ class RawDiskBuffer(RawBufferMapped):
self.offset = offset # this is an offset in bytes
assert device is not None or buf is not None, "disk tensor needs a path or a buf"
if device is not None:
if device.startswith("shm:"):
if str(device).startswith("shm:"):
if OSX:
with open(f"/tmp/shm_{device[4:]}", "w+b") as f:
f.truncate(size * dtype.itemsize)