@@ -139,7 +139,7 @@ def _handle_output_variations(data):
139
139
return data
140
140
141
141
@classmethod
142
- def get_child_details (cls , env_vars , xoption = None ):
142
+ def get_child_details (cls , env_vars ):
143
143
"""Retrieves fsencoding and standard stream details from a child process
144
144
145
145
Returns (encoding_details, stderr_lines):
@@ -150,11 +150,10 @@ def get_child_details(cls, env_vars, xoption=None):
150
150
The child is run in isolated mode if the current interpreter supports
151
151
that.
152
152
"""
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
+ )
158
157
if not result .rc == 0 :
159
158
result .fail (py_cmd )
160
159
# All subprocess outputs in this test case should be pure ASCII
@@ -213,16 +212,15 @@ def _check_child_encoding_details(self,
213
212
expected_fs_encoding ,
214
213
expected_stream_encoding ,
215
214
expected_warnings ,
216
- coercion_expected ,
217
- xoption = None ):
215
+ coercion_expected ):
218
216
"""Check the C locale handling for the given process environment
219
217
220
218
Parameters:
221
219
expected_fs_encoding: expected sys.getfilesystemencoding() result
222
220
expected_stream_encoding: expected encoding for standard streams
223
221
expected_warning: stderr output to expect (if any)
224
222
"""
225
- result = EncodingDetails .get_child_details (env_vars , xoption )
223
+ result = EncodingDetails .get_child_details (env_vars )
226
224
encoding_details , stderr_lines = result
227
225
expected_details = EncodingDetails .get_expected_details (
228
226
coercion_expected ,
@@ -292,7 +290,6 @@ def _check_c_locale_coercion(self,
292
290
coerce_c_locale ,
293
291
expected_warnings = None ,
294
292
coercion_expected = True ,
295
- use_xoption = False ,
296
293
** extra_vars ):
297
294
"""Check the C locale handling for various configurations
298
295
@@ -322,12 +319,8 @@ def _check_c_locale_coercion(self,
322
319
"PYTHONCOERCECLOCALE" : "" ,
323
320
}
324
321
base_var_dict .update (extra_vars )
325
- xoption = None
326
322
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
331
324
332
325
# Check behaviour for the default locale
333
326
with self .subTest (default_locale = True ,
@@ -349,8 +342,7 @@ def _check_c_locale_coercion(self,
349
342
fs_encoding ,
350
343
stream_encoding ,
351
344
_expected_warnings ,
352
- _coercion_expected ,
353
- xoption = xoption )
345
+ _coercion_expected )
354
346
355
347
# Check behaviour for explicitly configured locales
356
348
for locale_to_set in EXPECTED_C_LOCALE_EQUIVALENTS :
@@ -365,8 +357,7 @@ def _check_c_locale_coercion(self,
365
357
fs_encoding ,
366
358
stream_encoding ,
367
359
expected_warnings ,
368
- coercion_expected ,
369
- xoption = xoption )
360
+ coercion_expected )
370
361
371
362
def test_PYTHONCOERCECLOCALE_not_set (self ):
372
363
# This should coerce to the first available target locale by default
@@ -413,32 +404,6 @@ def test_LC_ALL_set_to_C(self):
413
404
expected_warnings = [LEGACY_LOCALE_WARNING ],
414
405
coercion_expected = False )
415
406
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
-
442
407
def test_main ():
443
408
test .support .run_unittest (
444
409
LocaleConfigurationTests ,
0 commit comments