[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-15 Thread STINNER Victor
STINNER Victor added the comment: I commited the last patch (fall back to UTF-8): r81190 (3.x), blocked in 3.1 (r81191). I opened a new issue for the UTF-8/ASCII fallback: #8725, because the ASCII fallback is a different issue. -- resolution: -> fixed status: open -> closed ___

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
STINNER Victor added the comment: I realized that fallback to ASCII instead of UTF-8 is not possible yet because of #8611: if it fallbacks to ASCII, it's not more possible to run Python in a non-ASCII directory. I have a patch set fixing #8611 but it's huge and complex. I will not be fixed qu

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file17244/initfsencoding-3.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
STINNER Victor added the comment: Version 4: I forgot #include in bltinmodule.c. -- Added file: http://bugs.python.org/file17247/initfsencoding-4.patch ___ Python tracker ___ __

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > >> +codec = _PyCodec_Lookup(Py_FileSystemDefaultEncoding); >> +if (!codec) { >> +Py_FatalError( >> +"Py_Initialize: unable to load the file system codec"); >> >> It's better to use the same approac

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file17242/initfsencoding-2.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
Changes by STINNER Victor : Added file: http://bugs.python.org/file17244/initfsencoding-3.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread STINNER Victor
STINNER Victor added the comment: Le vendredi 07 mai 2010 11:19:52, vous avez écrit : > > Ok, you conviced me with your PYTHONFSENCODING suggestion (#8622). Can > > you review my last patch please? > > I don't think we can change the fallback encoding in 3.2. But you > can start a discussion on

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > > "I think that using ASCII is a safer choice in case of errors. (...) Ouch, > that was a poor choice." > > Ok, you conviced me with your PYTHONFSENCODING suggestion (#8622). Can you > revie

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-06 Thread STINNER Victor
STINNER Victor added the comment: "I think that using ASCII is a safer choice in case of errors. (...) Ouch, that was a poor choice." Ok, you conviced me with your PYTHONFSENCODING suggestion (#8622). Can you review my last patch please? -- ___ Py

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-06 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file17214/initfsencoding.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-06 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file17213/no_fsencoding_error.patch ___ Python tracker ___ ___ Python-bugs-lis

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-06 Thread STINNER Victor
STINNER Victor added the comment: New patch: - set encoding to ASCII on nl_langinfo(CODESET) failure - set encoding to ASCII if nl_langinfo(CODESET) is missing - document the changes NEWS entry: "Issue #8610: Load file system codec at startup, and display a fatal error on failure. Set the f

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: I've opened issue8622 for the env. var idea. -- ___ Python tracker ___ ___ Python-bugs-list mail

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > >> I think that using ASCII is a safer choice in case of errors. > > I choosed UTF-8 to keep backward compatibility: > PyUnicode_DecodeFSDefaultAndSize() uses utf-8 if > Py_FileSystemDefault

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread STINNER Victor
STINNER Victor added the comment: > I think that using ASCII is a safer choice in case of errors. I choosed UTF-8 to keep backward compatibility: PyUnicode_DecodeFSDefaultAndSize() uses utf-8 if Py_FileSystemDefaultEncoding==NULL. If the OS has no nl_langinfo(CODESET) function at all, Python

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > >> manpage for nl_langinfo() doesn't mention any errors that could >> be raised by it > > It's more about get_codeset(). This function can fail for different reasons: > > - nl_langinfo() res

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread STINNER Victor
STINNER Victor added the comment: > manpage for nl_langinfo() doesn't mention any errors that could > be raised by it It's more about get_codeset(). This function can fail for different reasons: - nl_langinfo() result is an empty string: "If item is not valid, a pointer to an empty string is

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > I don't think it's a good idea to display an fatal error at runtime. If > nl_langinfo(CODESET) is not available, configure should fail or we should > fallback to an hardcoded encoding (ok but which one?). If nl_langinfo(CODESET)

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: Patch for the second solution (fallback to utf-8 on get_codeset() failure): - create a subfunction initfsencoding() (Py_InitializeEx is already very long) - hardcode the encoding to utf-8 if nl_langinfo(CODESET) is missing - don't call get_codeset() on Windo

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: Here is a patch for the first solution: display a fatal error if we are unable to get the locale encoding. It does always exit with a fatal error if nl_langinfo(CODESET) is not available (and Py_FileSystemDefaultEncoding is not set). I don't think it's a goo

[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor
New submission from STINNER Victor : On POSIX (but not on Mac OS X), Python3 calls get_codeset() to get the file system encoding. If this function fails, sys.getfilesystemencoding() returns None. PyUnicode_DecodeFSDefaultAndSize() fallbacks to utf-8 whereas subprocess fail: ... File "/ho