We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0cb0b1 commit b7f7375Copy full SHA for b7f7375
1 file changed
pypdf/_writer.py
@@ -268,12 +268,11 @@ def _get_clone_from(
268
):
269
return clone_from
270
cloning = True
271
- if isinstance(fileobj, (str, Path)) and (
272
- not Path(str(fileobj)).exists()
273
- or Path(str(fileobj)).stat().st_size == 0
274
- ):
275
- cloning = False
276
- if isinstance(fileobj, (IOBase, BytesIO)):
+ if isinstance(fileobj, (str, Path)):
+ fileobj_path = Path(fileobj)
+ if not fileobj_path.exists() or fileobj_path.stat().st_size == 0:
+ cloning = False
+ elif isinstance(fileobj, (IOBase, BytesIO)):
277
t = fileobj.tell()
278
if fileobj.seek(0, 2) == 0:
279
cloning = False
0 commit comments