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.

Author loewis
Recipients asmodai, catherinedevlin, heikki, jminka, loewis
Date 2009-05-02.22:07:55
SpamBayes Score 2.56184e-13
Marked as misclassified No
Message-id <>
In-reply-to <>
> If a pointer to a string is given for locale and the selection can be
> honored, the setlocale function returns a pointer to the string
> associated with the specified category for the new locale. If the
> selection cannot be honored, the setlocale function returns a null
> pointer and the program’s locale is not changed."
> Note that neither C or POSIX defines any errors or sets errno or the
> likes. It simply returns a null pointer.

Still, this is considered as an error case.

> #include <locale.h>
> int main(int argc, char *argv[]) {
> 	setlocale(LC_CTYPE, "");
> 	...
> }
> This will try to set the locale to what the native environment
> specifies, but will not error out if the value

Yes, but that's a bug in the C code, which fails to check the
return value of setlocale. The fact that the bug is wide-spread
doesn't make it any better.

> As such I think PyLocale_setlocale() in Modules/_localemodule.c needs to
> be adjusted

-1. Errors should never pass silently. That's the whole point of exceptions.
Date User Action Args
2009-05-02 22:07:57loewissetrecipients: + loewis, catherinedevlin, jminka, heikki, asmodai
2009-05-02 22:07:55loewislinkissue1443504 messages
2009-05-02 22:07:55loewiscreate