Skip to content

Commit 997d5f9

Browse files
serhiy-storchakaclaude
authored andcommitted
gh-154551: Fix ctypes.util.find_library() in non-UTF-8 locales (GH-154552)
_findLib_ld() failed to decode the localized "ld" stderr in the locale encoding. (cherry picked from commit 66e313f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent aed19a7 commit 997d5f9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/ctypes/util.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,7 @@ def _findLib_ld(name):
422422
result = None
423423
try:
424424
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
425-
stderr=subprocess.PIPE,
426-
universal_newlines=True)
425+
stderr=subprocess.PIPE)
427426
out, _ = p.communicate()
428427
res = re.findall(expr, os.fsdecode(out))
429428
for file in res:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :func:`ctypes.util.find_library` returning ``None`` in non-UTF-8 locales.

0 commit comments

Comments
 (0)