On 12 March 2017 at 22:57, Nick Coghlan firstname.lastname@example.org wrote:
However, I'm also open to having [PYTHONCOERCECLOCALE=0] also disable the runtime warning from the shared library.
Considering this a little further, I think this is going to be necessary in order to sensibly handle the build time "--with[out]-c-locale-warning" flag in the test suite.
Currently, there are a number of tests beyond the new ones in Lib/test/test_locale_coercion.py that would need to know whether or not to expect to see a warning in subprocesses in order to correctly handle the "--without-c-locale-warning" case: https://github.com/ncoghlan/cpython/commit/78c17a7cea04aed7cd1fce8ae5afb085a...
If PYTHONCOERCECLOCALE=0 turned off the runtime warning as well, then the behaviour of those tests would remain independent of the build flag as long as they set the new environment variable in the child process - the warning would be disabled either at build time via "--without-c-locale-warning" or at runtime with "PYTHONCOERCECLOCALE=0".
The check for the runtime C locale warning would then be added to _testembed rather than going through a normal Python subprocess, and that test would be the only one that needed to know whether or not the locale warning had been disabled at build time (which we could indicate simply by compiling the embedding part of the test differently in that case).