[Python-3000-checkins] r64033 - python/branches/py3k/Lib/calendar.py

Neal Norwitz nnorwitz at gmail.com
Fri Jun 13 08:55:21 CEST 2008


On Thu, Jun 12, 2008 at 11:33 PM, Georg Brandl <g.brandl at gmx.net> wrote:
> Neal Norwitz schrieb:
>>
>> On Sun, Jun 8, 2008 at 1:40 AM, georg.brandl
>> <python-3000-checkins at python.org> wrote:
>>>
>>> Author: georg.brandl
>>> Date: Sun Jun  8 10:40:05 2008
>>> New Revision: 64033
>>>
>>> Log:
>>> #3059: Stop decoding Unicode in calendar module.
>>> The strftime routines must know how to decode
>>> localized month/day names themselves.
>>>
>>>
>>> Modified:
>>>  python/branches/py3k/Lib/calendar.py
>>>
>>> Modified: python/branches/py3k/Lib/calendar.py
>>>
>>> ==============================================================================
>>> --- python/branches/py3k/Lib/calendar.py        (original)
>>> +++ python/branches/py3k/Lib/calendar.py        Sun Jun  8 10:40:05 2008
>>> @@ -481,13 +481,13 @@
>>>        return ''.join(v).encode(encoding, "xmlcharrefreplace")
>>>
>>>
>>> -class TimeEncoding:
>>> +class different_locale:
>>>    def __init__(self, locale):
>>>        self.locale = locale
>>>
>>>    def __enter__(self):
>>>        self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
>>> -        return _locale.getlocale(_locale.LC_TIME)[1]
>>> +        #return _locale.getlocale(_locale.LC_TIME)[1]
>>
>> This doesn't seem right, ie returning None from an __enter__ method.
>
> The code that uses it does
>
> with different_locale(self.locale):
>    ...
>
> so returning something isn't necessary.

Do you want to leave the old code in and commented out?

Do you want to prevent code like:

  with different_locale(self.locale) as old_locale:
    ...

(I see different_locale isn't exported in __all__ and probably not
considered public.)

n


More information about the Python-3000-checkins mailing list