mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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.
This commit is contained in:
parent
84d79ddce2
commit
98f9746740
3 changed files with 27 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue