1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Date: Sun Mar 25 19:26:47 BST 2012
Author: Thomas Kluyver <thomas@kluyver.me.uk>
Subject: Fix reading binary tzinfo files.
Fix already made upstream.
--- a/dateutil/tz.py
+++ b/dateutil/tz.py
@@ -196,7 +196,7 @@
def __init__(self, fileobj):
if isinstance(fileobj, str):
self._filename = fileobj
- fileobj = open(fileobj)
+ fileobj = open(fileobj, "rb")
elif hasattr(fileobj, "name"):
self._filename = fileobj.name
else:
@@ -212,7 +212,7 @@
# ``standard'' byte order (the high-order byte
# of the value is written first).
- if fileobj.read(4).decode() != "TZif":
+ if fileobj.read(4) != b"TZif":
raise ValueError("magic not found")
fileobj.read(16)
|