diff options
author | Guido van Rossum <guido@python.org> | 2007-04-13 03:31:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-04-13 03:31:13 (GMT) |
commit | 98f9746740e95bd0307a4a1a1f1adf69cc585e61 (patch) | |
tree | 66ce1f83cb22b87e627a4c2520055507a25c8cc8 /Lib/zipfile.py | |
parent | 84d79ddce2176ae54825da32e096d6332a8d5138 (diff) | |
download | cpython-98f9746740e95bd0307a4a1a1f1adf69cc585e61.zip cpython-98f9746740e95bd0307a4a1a1f1adf69cc585e61.tar.gz cpython-98f9746740e95bd0307a4a1a1f1adf69cc585e61.tar.bz2 |
Support marshal.dump(x, f) where f is not a real file.
Support ord(b) where b is a 1-byte string.
In zipfile.py, work around bytes being ints instead of chars, sometimes.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index dc51168..d0a1f65 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -348,7 +348,13 @@ class _ZipDecrypter: def __call__(self, c): """Decrypt a single character.""" - c = ord(c) + # XXX When this is called with a byte instead of a char, ord() + # isn't needed. Don't die in that case. In the future we should + # just leave this out, once we're always using bytes. + try: + c = ord(c) + except TypeError: + pass k = self.key2 | 2 c = c ^ (((k * (k^1)) >> 8) & 255) c = chr(c) |