# HG changeset patch # User Augie Fackler # Date 2018-10-13 11:51:22 # Node ID 844deb408a5b3c537cb41732637fe2955c338d96 # Parent be0a5d2d5c78221d4f8104b32b6a2f191ba98a9c archival: don't try and fsdecode non-{bytes,str} objects This function accepts both bytes and file-like objects. Differential Revision: https://phab.mercurial-scm.org/D5073 diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -203,7 +203,9 @@ class zipit(object): or compressed with deflate.''' def __init__(self, dest, mtime, compress=True): - self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w', + if isinstance(dest, bytes): + dest = pycompat.fsdecode(dest) + self.z = zipfile.ZipFile(dest, r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED)