Commit Graph

8 Commits

Author SHA1 Message Date
xdegaye 1588be66d7
bpo-28180: Fix the implementation of PEP 538 on Android (GH-4334) 2017-11-12 12:45:59 +01:00
Nick Coghlan f0b6a261bb bpo-30836: fix test_c_locale_coercion on AIX (GH-2713)
AIX uses iso8859-1 in the C locale, not ASCII

AIX doesn't currently provide any of the locale
coercion locales, but we leave locale coercion
enabled in case one gets added in the future.
2017-07-15 22:51:05 +10:00
Nick Coghlan 18974c35ad bpo-30647: Check nl_langinfo(CODESET) in locale coercion (GH-2374)
- On some versions of FreeBSD, setting the "UTF-8" locale
  succeeds, but a subsequent "nl_langinfo(CODESET)" fails
- adding a check for this in the coercion logic means that
  coercion will happen on systems where this check succeeds,
  and will be skipped otherwise
- that way CPython should automatically adapt to changes in
  platform behaviour, rather than needing a new release to
  enable coercion at build time
- this also allows UTF-8 to be re-enabled as a coercion
  target, restoring the locale coercion behaviour on Mac OS X
2017-06-30 00:48:14 +10:00
Nick Coghlan eb81795d7d bpo-30565: Add PYTHONCOERCECLOCALE=warn runtime flag (GH-2260)
- removes PY_WARN_ON_C_LOCALE build time flag
- locale coercion and compatibility warnings are now always compiled
  in, but are off by default
- adds PYTHONCOERCECLOCALE=warn runtime option to aid in
  debugging potentially locale related compatibility problems

Due to not-yet-resolved test failures on *BSD systems (including
Mac OS X), this also temporarily disables UTF-8 as a locale coercion
target, and skips testing the interpreter's behavior in the POSIX locale.
2017-06-18 12:29:42 +10:00
Nick Coghlan 7926516ff9 bpo-28180: Standard stream & FS encoding differ on Mac OS X (GH-2208)
In the C locale on Mac OS X, the default filesystem encoding
used for operating system interfaces is UTF-8, but the
default encoding used on the standard streams is still ASCII.

Setting the POSIX locale also behaves differently from setting
other locales on Mac OS X, so skip that in the test suite for now.
2017-06-15 19:11:39 +10:00
Nick Coghlan 4563099d28 bpo-28180: assume UTF-8 for Mac OS X PEP 538 tests (GH-2130) 2017-06-13 22:49:44 +10:00
Victor Stinner 023564bf7d bpo-30635: Fix refleak in test_c_locale_coercion (#2126)
When checking for reference leaks, test_c_locale_coercion is run
multiple times and so _LocaleCoercionTargetsTestCase.setUpClass() is
called multiple times. setUpClass() appends new value at each call,
so it looks like a reference leak.

Moving the setup from setUpClass() to setUpModule() avoids
this, eliminating the false alarm.
2017-06-13 21:32:31 +10:00
Nick Coghlan 6ea4186de3 bpo-28180: Implementation for PEP 538 (#659)
- new PYTHONCOERCECLOCALE config setting
- coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default
- always uses C.UTF-8 on Android
- uses `surrogateescape` on stdin and stdout in the coercion
  target locales
- configure option to disable locale coercion at build time
- configure option to disable C locale warning at build time
2017-06-11 13:16:15 +10:00