Message180750
Try this at a command-prompt:
$ python -m calendar -L ja_JP --encoding utf8
The result is a crash:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/calendar.py", line 708, in <module>
main(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/calendar.py", line 703, in main
result = result.encode(options.encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 49: ordinal not in range(128)
The reason is because the TimeEncoding class doesn't properly return the encoding it should use, so 'encoding' ends up being None in "with TimeEncoding(self.locale) as encoding:" lines.
Trivial patch:
--- calendar.py 2013-01-27 03:48:08.000000000 -0500
+++ calendar.py 2013-01-27 03:48:08.000000000 -0500
@@ -488,6 +488,7 @@
def __enter__(self):
self.oldlocale = _locale.getlocale(_locale.LC_TIME)
_locale.setlocale(_locale.LC_TIME, self.locale)
+ return self.locale[1]
def __exit__(self, *args):
_locale.setlocale(_locale.LC_TIME, self.oldlocale) |
|
Date |
User |
Action |
Args |
2013-01-27 08:48:46 | nneonneo | set | recipients:
+ nneonneo |
2013-01-27 08:48:46 | nneonneo | set | messageid: <1359276526.88.0.340808653296.issue17049@psf.upfronthosting.co.za> |
2013-01-27 08:48:46 | nneonneo | link | issue17049 messages |
2013-01-27 08:48:46 | nneonneo | create | |
|