[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-02-01 Thread Steffen Daode Nurpmeso
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: Most of this is much too loud for a newbie who is about to read PEP 7 anyway. And if this community has chosen to try (?!?) not to break compatibility with code which does not have a notion of a locale setting (i.e. naively uses

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-01-31 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Attached patch replaces locale.getpreferredencoding() by locale.getpreferredencoding(False) in _io.TextIOWrapper and _pyio.TextIOWrapper. -- keywords: +patch Added file:

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-01-31 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11022 ___ ___ Python-bugs-list

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-01-31 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Steffan: I'm not sure what your post means, but I think there is a chance you might be confused about something. Python should *never* change the locale from the C locale. A Python *program* can do so, by calling setlocale, but Python

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-01-29 Thread Steffen Daode Nurpmeso
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: Also in respect to Issue 6203 i could talk about a project which did not link against anything in the end, only ld(1) and syscalls and the undocumented third 'char **envp' arg to UNIX main()s. Thus: all of you should be *very*

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ

2011-01-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: STINNER Victor victor.stin...@haypocalc.com added the comment: upon program startup, init LibC environment: setlocale(LC_ALL, ); Python 3 does something like that: Py_InitializeEx() calls setlocale(LC_CTYPE,

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ does

2011-01-28 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- title: locale.setlocale() doesn't change I/O codec, os.environ - locale.setlocale() doesn't change I/O codec, os.environ does ___ Python tracker rep...@bugs.python.org

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread Steffen Daode Nurpmeso
New submission from Steffen Daode Nurpmeso sdao...@googlemail.com: This bug may be based on same problem as Issue 6203. - My system locale is en_GB.UTF-8. - Given a latin1 text file, open()+ will fail with 'UnicodeDecodeError: 'utf8' codec can't decode byte 0xf6...' - Using

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread Steffen Daode Nurpmeso
Changes by Steffen Daode Nurpmeso sdao...@googlemail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11022 ___ ___

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: - Using locale.setlocale(..., ...) - Re-open causes same error, I/O layer codec has not been changed! Yes, this is the expected behaviour with the current code. TextIOWrapper uses indirectly locale.getpreferredencoding() to

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: This bug may be based on same problem as Issue 6203. Nope, both issues are different. Here you want that TextIOWrapper reads your current locale, and not your environment variables. Issue #6203 asks why LC_CTYPE is not C by

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread Steffen Daode Nurpmeso
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: Anyway, I don't know understand why do you change your locale, because you know that your file encoding is Latin1. Why don't you use directly: open(filename, encoding='latin1')? Fortunately Issue 9124 is being solved soon due

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11022 ___

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ[] does

2011-01-27 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Both cases indicate the users desire to change a specific locale setting and thus - of course - all the changes which that implies! So why should there be a difference? I don't think it's intentional. I would be +1 on changing to

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ

2011-01-27 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Both cases indicate the users desire to change a specific locale setting and thus - of course - all the changes which that implies! So why should there be a difference? I don't think it's intentional. I would be +1 on changing to

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ

2011-01-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Set version to 3.3, I think that it is too late to change such critical code in Python 3.2. -- versions: +Python 3.3 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ

2011-01-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: upon program startup, init LibC environment: setlocale(LC_ALL, ); Python 3 does something like that: Py_InitializeEx() calls setlocale(LC_CTYPE, ). But I (and others) consider that as a bug (see #6203 discussion): Python should

[issue11022] locale.setlocale() doesn't change I/O codec, os.environ

2011-01-27 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Both cases indicate the users desire to change a specific locale setting and thus - of course - all the changes which that implies! So why should there be a difference? I don't think it's intentional. I would be +1 on changing to