[Python-Dev] RE: test_strptime; test_logging; test_time failure
Brett C.
drifty@alum.berkeley.edu
Thu, 24 Jul 2003 13:49:31 -0700
Tim Peters wrote:
> [Tim "Hairy Thunderer" Peters]
>
>>>It was a mistake to check this in without confirming first that it
>>>actually cured the problem. In fact, the same failure still occurs
>>>when test_logging's restoration of locale is removed:
>
>
> [Brett C.]
>
>>Yes, it was a mistake on my part. This was an instance of me becoming
>>very frustrated with myself and just wanting to get this thing solved
>>and stop being the last nagging issue for this release. Sorry to
>>everyone (and especially the plutocratic release team of Tim and
>>Barry) for causing all of this grief.
>
>
> OK, that's enough groveling -- thanks! Not all mistakes are catastrophes,
> and this one was pretty minor.
>
Damn. And I had this poetic apology letter that would have brought
everyone to tears.
OK, I will stop apologizing for my mistake now.
>
>>...
>>Well, I think I found the actual problem. Guess what the TimeRE had
>>as its parameter list for __init__ : ``locale_time = LocaleTime()`` .
>>Aaaaaahhhhhh!!!!!! I can't believe I didn't spot that sooner! The
>>damn caching was probably working but every instance was using the
>>default value that is created at module initialization instead of
>>recreating it on every instantiation of TimeRE.
>
>
> Ah. As most people suspected, then, it was really Guido's fault! Default
> arguments should only be used as low-level speed hacks to avoid lookups in
> the builtin namespace.
>
I know I have learned my lesson: set initial values to None unless it is
a constant type for default parameter values.
>
>>Barry OK'ed fixing this and I am still going to leave the caching out.
>>I need to really go over this module and work on it with my new Dutch
>>knowledge of Python for 2.4 to get rid of these nagging newbie
>>mistakes that I initially made in this module.
>
>
> You did fine, Brett, and I'm glad we've got _strptime.py. Overall, it was
> almost a win <wink>. BTW, I can confirm that the goofy locale-related
> buglets have gone away now on Win2K.
>
Damn it. Now I have to get something in that is a complete win. =)
Glad to hear it's fixed now.
-Brett