[Python-checkins] cpython: Issue #16455: On FreeBSD and Solaris, if the locale is C, the

Christian Heimes christian at python.org
Tue Dec 4 08:33:17 CET 2012


Am 04.12.2012 03:23, schrieb victor.stinner:
> http://hg.python.org/cpython/rev/c25635b137cc
> changeset:   80718:c25635b137cc
> parent:      80716:b845901cf702
> user:        Victor Stinner <victor.stinner at gmail.com>
> date:        Tue Dec 04 01:34:47 2012 +0100
> summary:
>   Issue #16455: On FreeBSD and Solaris, if the locale is C, the
> ASCII/surrogateescape codec is now used, instead of the locale encoding, to
> decode the command line arguments. This change fixes inconsistencies with
> os.fsencode() and os.fsdecode() because these operating systems announces an
> ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
> 
> files:
>   Include/unicodeobject.h          |    2 +-
>   Lib/test/test_cmd_line_script.py |    9 +-
>   Misc/NEWS                        |    6 +
>   Objects/unicodeobject.c          |   24 +-
>   Python/fileutils.c               |  240 +++++++++++++++++-
>   5 files changed, 241 insertions(+), 40 deletions(-)

...

> @@ -3110,7 +3110,8 @@
>          *surrogateescape = 0;
>          return 0;
>      }
> -    if (strcmp(errors, "surrogateescape") == 0) {
> +    if (errors == "surrogateescape"
> +        || strcmp(errors, "surrogateescape") == 0) {
>          *surrogateescape = 1;
>          return 0;
>      }

Victor, That doesn't look right. :) GCC is complaining about the code:

Objects/unicodeobject.c: In function 'locale_error_handler':
Objects/unicodeobject.c:3113:16: warning: comparison with string literal
results in unspecified behavior [-Waddress]


I'm also getting additional warnings in PyUnicode_Format().

Objects/unicodeobject.c: In function 'PyUnicode_Format':
Objects/unicodeobject.c:13782:8: warning: 'arg.sign' may be used
uninitialized in this function [-Wmaybe-uninitialized]
Objects/unicodeobject.c:13893:33: note: 'arg.sign' was declared here
Objects/unicodeobject.c:13779:12: warning: 'str' may be used
uninitialized in this function [-Wmaybe-uninitialized]
Objects/unicodeobject.c:13894:15: note: 'str' was declared here



More information about the Python-checkins mailing list