Message86985
> 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:57 | loewis | set | recipients:
+ loewis, catherinedevlin, jminka, heikki, asmodai |
2009-05-02 22:07:55 | loewis | link | issue1443504 messages |
2009-05-02 22:07:55 | loewis | create | |
|