Skip to content

Commit

Permalink
fix joblib.load from stream
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroFrolov authored and Frolov Petr committed Mar 23, 2021
1 parent 457d2c8 commit 6a9edf4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion joblib/numpy_pickle_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def _detect_compressor(fileobj):
first_bytes = fileobj.peek(max_prefix_len)
else:
# Fallback to seek if the fileobject is not peekable.
prev_pos = fileobj.tell()
first_bytes = fileobj.read(max_prefix_len)
fileobj.seek(0)
fileobj.seek(prev_pos)

if first_bytes.startswith(_ZFILE_PREFIX):
return "compat"
Expand Down

0 comments on commit 6a9edf4

Please sign in to comment.