From 144951e6a23d2d811c60e270eb50c4163484df48 Mon Sep 17 00:00:00 2001 From: Kathia Barahona Date: Wed, 29 Nov 2023 09:50:45 +0100 Subject: [PATCH] verify if provided object has seekable function when verifying if its empty --- rohmu/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rohmu/util.py b/rohmu/util.py index 98f4268c..36c3c4d2 100644 --- a/rohmu/util.py +++ b/rohmu/util.py @@ -58,7 +58,7 @@ def set_stream_nonblocking(stream: HasFileno) -> None: def file_object_is_empty(fd: BinaryIO) -> bool: # not seekable, so we cannot verify it has no contents - if not fd.seekable(): + if not hasattr(fd, "seekable") or not fd.seekable(): return False fd.seek(0)