changeset 40247:844deb408a5b

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
author Augie Fackler <augie@google.com>
date Sat, 13 Oct 2018 07:51:22 -0400
parents be0a5d2d5c78
children b24c23f7c1f9
files mercurial/archival.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Sat Oct 13 06:34:53 2018 -0400
+++ b/mercurial/archival.py	Sat Oct 13 07:51:22 2018 -0400
@@ -203,7 +203,9 @@
     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)