Skip to content

Commit cb21249

Browse files
committed
Force the C locale on readelf output
1 parent 82d5208 commit cb21249

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/test/test_dtrace.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,14 @@ def setUpClass(cls):
378378
def get_readelf_version():
379379
try:
380380
cmd = ["readelf", "--version"]
381+
# Force the C locale to disable localization.
382+
env = dict(os.environ, LC_ALL="C")
381383
proc = subprocess.Popen(
382384
cmd,
383385
stdout=subprocess.PIPE,
384386
stderr=subprocess.PIPE,
385387
universal_newlines=True,
388+
env=env,
386389
)
387390
with proc:
388391
version, stderr = proc.communicate()
@@ -427,11 +430,14 @@ def get_readelf_output(self):
427430
break
428431

429432
command = ["readelf", "-n", binary]
433+
# Force the C locale to disable localization.
434+
env = dict(os.environ, LC_ALL="C")
430435
stdout, _ = subprocess.Popen(
431436
command,
432437
stdout=subprocess.PIPE,
433438
stderr=subprocess.STDOUT,
434439
universal_newlines=True,
440+
env=env,
435441
).communicate()
436442
return stdout
437443

0 commit comments

Comments
 (0)