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 <49FCC411.9070806@v.loewis.de>
In-reply-to <1241300914.39.0.216667218535.issue1443504@psf.upfronthosting.co.za>
Content
> 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.
History
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