[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-12-17 Thread Xavier de Gaye
Xavier de Gaye added the comment: Closing as invalid, it is useful to have the test failing on platforms that do not have CODESET and detect that too many modules are imported on startup. For Android, this problem is fixed in issue 28596. -- resolution: -> not a bug stage: commit revi

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Submitted a patch to issue28596 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread STINNER Victor
STINNER Victor added the comment: In Python, the most important functions are Py_DecodeLocale() and Py_EncodeLocale() which use mbstowcs() and wvstombs(). -- ___ Python tracker _

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: There are some locale strings supported in setlocale(): https://android.googlesource.com/platform/bionic/+/master/libc/bionic/locale.cpp#104. However, seems mbstowcs just ignores such a setting on Android. Here's an example: #include #include #include #incl

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread STINNER Victor
STINNER Victor added the comment: If it is not possible to change the locale, it makes sense to hardcode utf8. Note: to avoid mojibake, it's better if sys.getfilesystemencoding() and locale.getpreferredencoding(False) are equal. I understand that both must be utf8. -- _

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Seems Android/BioniC always uses UTF-8: https://android.googlesource.com/platform/bionic/+/master/libc/bionic/mbrtoc32.cpp#83 -- nosy: +Chi Hsuan Yen ___ Python tracker ___

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread STINNER Victor
STINNER Victor added the comment: > The problem is caused by the fact that android does not have HAVE_LANGINFO_H > and CODESET set Hum, is it possible to get the locale encoding by another way? If not, what is the locale encoding? Does Android provide mbstowcs() and wcstombs() functions? ---

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-18 Thread Xavier de Gaye
Xavier de Gaye added the comment: Patch that follows closely the conditionals in the __bootlocale module. -- stage: patch review -> commit review Added file: http://bugs.python.org/file45530/skip_test_2.patch ___ Python tracker

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-11-03 Thread Xavier de Gaye
Xavier de Gaye added the comment: This patch fixes test_startup_imports when the platform does not have langinfo.h. Entered new issue 28596: "on Android _bootlocale on startup relies on too many library modules". -- assignee: -> xdegaye components: +Tests -Cross-Build, Library (Lib)

[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-05-21 Thread ppperry
Changes by ppperry : -- title: _bootlocale imports locale at startup on Android -> _bootlocale imports locale at startup on Android, causing test_site to fail ___ Python tracker ___

[issue26928] _bootlocale imports locale at startup on Android

2016-05-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: An improvement to Python startup time on Android (Android does not have nl_langinfo()) is to have _bootlocale.getpreferredencoding() return 'ascii' without importing locale, when none of the locale environment variables is set. With patch no-locale-envvar.patc

[issue26928] _bootlocale imports locale at startup on Android

2016-05-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: Sorry for the confusion, the file system encoding is not the locale encoding. In issue #9548, Antoine proposed a patch that avoids the import of the re, collections and functools modules by the _io module on startup, by refactoring and moving code from locale