@@ -1700,7 +1700,8 @@ pymain_cmdline(_PyMain *pymain, _PyCoreConfig *config)
17001700
17011701
17021702static int
1703- pymain_init (_PyMain * pymain , PyInterpreterState * * interp_p )
1703+ pymain_init (_PyMain * pymain , PyInterpreterState * * interp_p ,
1704+ int use_c_locale_coercion )
17041705{
17051706 /* 754 requires that FP exceptions run in "no stop" mode by default,
17061707 * and until C vendors implement C99's ways to control FP exceptions,
@@ -1713,6 +1714,11 @@ pymain_init(_PyMain *pymain, PyInterpreterState **interp_p)
17131714
17141715 _PyCoreConfig local_config = _PyCoreConfig_INIT ;
17151716 _PyCoreConfig * config = & local_config ;
1717+ if (use_c_locale_coercion ) {
1718+ /* set to -1 to be able to enable the feature */
1719+ config -> _coerce_c_locale = -1 ;
1720+ config -> _coerce_c_locale_warn = -1 ;
1721+ }
17161722
17171723 _PyCoreConfig_GetGlobalConfig (config );
17181724
@@ -1747,10 +1753,10 @@ pymain_init(_PyMain *pymain, PyInterpreterState **interp_p)
17471753
17481754
17491755static int
1750- pymain_main (_PyMain * pymain )
1756+ pymain_main (_PyMain * pymain , int use_c_locale_coercion )
17511757{
17521758 PyInterpreterState * interp ;
1753- int res = pymain_init (pymain , & interp );
1759+ int res = pymain_init (pymain , & interp , use_c_locale_coercion );
17541760 if (res != 1 ) {
17551761 if (pymain_run_python (pymain , interp ) < 0 ) {
17561762 _Py_FatalInitError (pymain -> err );
@@ -1777,10 +1783,22 @@ Py_Main(int argc, wchar_t **argv)
17771783 pymain .argc = argc ;
17781784 pymain .wchar_argv = argv ;
17791785
1780- return pymain_main (& pymain );
1786+ return pymain_main (& pymain , 0 );
17811787}
17821788
17831789
1790+ #ifdef MS_WINDOWS
1791+ int
1792+ _Py_WindowsMain (int argc , wchar_t * * argv )
1793+ {
1794+ _PyMain pymain = _PyMain_INIT ;
1795+ pymain .use_bytes_argv = 0 ;
1796+ pymain .argc = argc ;
1797+ pymain .wchar_argv = argv ;
1798+
1799+ return pymain_main (& pymain , 1 );
1800+ }
1801+ #else
17841802int
17851803_Py_UnixMain (int argc , char * * argv )
17861804{
@@ -1789,8 +1807,9 @@ _Py_UnixMain(int argc, char **argv)
17891807 pymain .argc = argc ;
17901808 pymain .bytes_argv = argv ;
17911809
1792- return pymain_main (& pymain );
1810+ return pymain_main (& pymain , 1 );
17931811}
1812+ #endif
17941813
17951814
17961815/* this is gonna seem *real weird*, but if you put some other code between
0 commit comments