[Python-Dev] logging module broken because of locale

Mihai Ibanescu misa at redhat.com
Mon Jul 17 21:39:55 CEST 2006


Hi,

This is reported on sourceforge:

http://sourceforge.net/tracker/index.php?func=detail&aid=1524081&group_id=5470&atid=105470

I am willing to try and patch the problem, but I'd like to discuss my ideas
first.

The basic problem is that, in some locale, "INFO".lower() != "info". So,
initializing a dictionary with keys that appear to be lower-case in English
is unsafe for other locale.

Now, the other problem is, people can choose to initialize the locale any time
they want, and can choose to change it too. My initial approach was to create
the dictionary with strings to which lower() was explicitly called.

But, since priority_names is class-scoped, it gets evaluated at module import
time, which is way too early in the game (most likely the locale will be set
afterwards).

Any thoughts on the proper way to approach this?

Thanks,
Misa


More information about the Python-Dev mailing list