[Python-Dev] RE: test_strptime; test_logging; test_time failure

Tim Peters tim.one@comcast.net
Thu, 24 Jul 2003 16:37:16 -0400


[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.

> ...
> 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.

> 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.