@@ -139,7 +139,7 @@ def _handle_output_variations(data):
139139 return data
140140
141141 @classmethod
142- def get_child_details (cls , env_vars , xoption = None ):
142+ def get_child_details (cls , env_vars ):
143143 """Retrieves fsencoding and standard stream details from a child process
144144
145145 Returns (encoding_details, stderr_lines):
@@ -150,11 +150,10 @@ def get_child_details(cls, env_vars, xoption=None):
150150 The child is run in isolated mode if the current interpreter supports
151151 that.
152152 """
153- args = []
154- if xoption :
155- args .extend (("-X" , f"coerce_c_locale={ xoption } " ))
156- args .extend (("-X" , "utf8=0" , "-c" , cls .CHILD_PROCESS_SCRIPT ))
157- result , py_cmd = run_python_until_end (* args , ** env_vars )
153+ result , py_cmd = run_python_until_end (
154+ "-X" , "utf8=0" , "-c" , cls .CHILD_PROCESS_SCRIPT ,
155+ ** env_vars
156+ )
158157 if not result .rc == 0 :
159158 result .fail (py_cmd )
160159 # All subprocess outputs in this test case should be pure ASCII
@@ -213,16 +212,15 @@ def _check_child_encoding_details(self,
213212 expected_fs_encoding ,
214213 expected_stream_encoding ,
215214 expected_warnings ,
216- coercion_expected ,
217- xoption = None ):
215+ coercion_expected ):
218216 """Check the C locale handling for the given process environment
219217
220218 Parameters:
221219 expected_fs_encoding: expected sys.getfilesystemencoding() result
222220 expected_stream_encoding: expected encoding for standard streams
223221 expected_warning: stderr output to expect (if any)
224222 """
225- result = EncodingDetails .get_child_details (env_vars , xoption )
223+ result = EncodingDetails .get_child_details (env_vars )
226224 encoding_details , stderr_lines = result
227225 expected_details = EncodingDetails .get_expected_details (
228226 coercion_expected ,
@@ -292,7 +290,6 @@ def _check_c_locale_coercion(self,
292290 coerce_c_locale ,
293291 expected_warnings = None ,
294292 coercion_expected = True ,
295- use_xoption = False ,
296293 ** extra_vars ):
297294 """Check the C locale handling for various configurations
298295
@@ -322,12 +319,8 @@ def _check_c_locale_coercion(self,
322319 "PYTHONCOERCECLOCALE" : "" ,
323320 }
324321 base_var_dict .update (extra_vars )
325- xoption = None
326322 if coerce_c_locale is not None :
327- if use_xoption :
328- xoption = coerce_c_locale
329- else :
330- base_var_dict ["PYTHONCOERCECLOCALE" ] = coerce_c_locale
323+ base_var_dict ["PYTHONCOERCECLOCALE" ] = coerce_c_locale
331324
332325 # Check behaviour for the default locale
333326 with self .subTest (default_locale = True ,
@@ -349,8 +342,7 @@ def _check_c_locale_coercion(self,
349342 fs_encoding ,
350343 stream_encoding ,
351344 _expected_warnings ,
352- _coercion_expected ,
353- xoption = xoption )
345+ _coercion_expected )
354346
355347 # Check behaviour for explicitly configured locales
356348 for locale_to_set in EXPECTED_C_LOCALE_EQUIVALENTS :
@@ -365,8 +357,7 @@ def _check_c_locale_coercion(self,
365357 fs_encoding ,
366358 stream_encoding ,
367359 expected_warnings ,
368- coercion_expected ,
369- xoption = xoption )
360+ coercion_expected )
370361
371362 def test_PYTHONCOERCECLOCALE_not_set (self ):
372363 # This should coerce to the first available target locale by default
@@ -413,32 +404,6 @@ def test_LC_ALL_set_to_C(self):
413404 expected_warnings = [LEGACY_LOCALE_WARNING ],
414405 coercion_expected = False )
415406
416- def test_xoption_set_to_1 (self ):
417- self ._check_c_locale_coercion ("utf-8" , "utf-8" , coerce_c_locale = "1" ,
418- use_xoption = True )
419-
420- def test_xoption_set_to_zero (self ):
421- # The setting "0" should result in the locale coercion being disabled
422- self ._check_c_locale_coercion (EXPECTED_C_LOCALE_FS_ENCODING ,
423- EXPECTED_C_LOCALE_STREAM_ENCODING ,
424- coerce_c_locale = "0" ,
425- coercion_expected = False ,
426- use_xoption = True )
427- # Setting LC_ALL=C shouldn't make any difference to the behaviour
428- self ._check_c_locale_coercion (EXPECTED_C_LOCALE_FS_ENCODING ,
429- EXPECTED_C_LOCALE_STREAM_ENCODING ,
430- coerce_c_locale = "0" ,
431- LC_ALL = "C" ,
432- coercion_expected = False ,
433- use_xoption = True )
434-
435- def test_xoption_set_to_warn (self ):
436- # -X coerce_c_locale=warn enables runtime warnings for legacy locales
437- self ._check_c_locale_coercion ("utf-8" , "utf-8" ,
438- coerce_c_locale = "warn" ,
439- expected_warnings = [CLI_COERCION_WARNING ],
440- use_xoption = True )
441-
442407def test_main ():
443408 test .support .run_unittest (
444409 LocaleConfigurationTests ,
0 commit comments