Comment 8 for bug 746550

Revision history for this message
Taavi Burns (taavi-burns) wrote :

I peeked at the diff and noticed a docstring that isn't (because "import six" happens first):

=== modified file 'dateutil/tz.py'
234 --- dateutil/tz.py 2011-03-24 17:37:46 +0000
235 +++ dateutil/tz.py 2012-02-18 20:49:17 +0000
236 @@ -25,6 +25,20 @@
237 except (ImportError, OSError):
238 tzwin, tzwinlocal = None, None
239
240 +def tzname_in_python2(myfunc):
241 + import six
242 + """Change unicode output into bytestrings in Python 2
243 +
244 + tzname() API changed in Python 3. It used to return bytes, but was changed
245 + to unicode strings
246 + """
247 + def inner_func(*args, **kwargs):
248 + if six.PY3:
249 + return myfunc(*args, **kwargs)
250 + else:
251 + return myfunc(*args, **kwargs).encode()
252 + return inner_func
253 +