This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年01月27日 08:48 by nneonneo, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| calendar_locale-2.7.patch | serhiy.storchaka, 2013年01月27日 10:13 | Patch for 2.7 | review | |
| calendar_locale_test-3.x.patch | serhiy.storchaka, 2013年01月27日 10:14 | Test for 3.x | review | |
| Messages (8) | |||
|---|---|---|---|
| msg180750 - (view) | Author: Robert Xiao (nneonneo) * | Date: 2013年01月27日 08:48 | |
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) |
|||
| msg180756 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月27日 10:13 | |
Thank you for report and suggestion, Robert Xiao. The patch should be a little more complex however. |
|||
| msg180757 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月27日 10:14 | |
And here is an updated test for 3.x. |
|||
| msg180786 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年01月27日 20:11 | |
See also Issue13539. |
|||
| msg180865 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2013年01月28日 17:42 | |
Serhiy: not sure why all those people belong in the nosy list. |
|||
| msg180866 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月28日 17:46 | |
They moved from issue13539 which I have closed as a duplicate. |
|||
| msg181020 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月31日 13:58 | |
New changeset af41eca1959e by Serhiy Storchaka in branch '2.7': Issue #17049: Localized calendar methods now return unicode if a locale http://hg.python.org/cpython/rev/af41eca1959e |
|||
| msg181022 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月31日 14:17 | |
Committed. Thank you for reports, Robert Xiao and psam. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:41 | admin | set | github: 61251 |
| 2013年01月31日 14:17:36 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg181022 stage: patch review -> resolved |
| 2013年01月31日 13:58:35 | python-dev | set | nosy:
+ python-dev messages: + msg181020 |
| 2013年01月28日 17:46:56 | serhiy.storchaka | set | messages: + msg180866 |
| 2013年01月28日 17:42:24 | georg.brandl | set | messages: + msg180865 |
| 2013年01月28日 17:11:18 | serhiy.storchaka | set | nosy:
+ twouters, georg.brandl, ixokai, vstinner, christian.heimes, tim.golden, eric.araujo, Retro, r.david.murray, JJeffries, psam |
| 2013年01月28日 17:10:14 | serhiy.storchaka | link | issue13539 superseder |
| 2013年01月27日 20:11:11 | ned.deily | set | nosy:
+ ned.deily messages: + msg180786 |
| 2013年01月27日 10:14:45 | serhiy.storchaka | set | files:
+ calendar_locale_test-3.x.patch messages: + msg180757 versions: + Python 3.2, Python 3.3, Python 3.4 |
| 2013年01月27日 10:13:43 | serhiy.storchaka | set | files:
+ calendar_locale-2.7.patch type: behavior keywords: + patch nosy: + rhettinger, serhiy.storchaka messages: + msg180756 stage: patch review |
| 2013年01月27日 08:48:46 | nneonneo | create | |