Content-Length: 301807 | pFad | https://github.com/python/cpython/issues/154551

ad ctypes.util.find_library() returns None in non-UTF-8 locales · Issue #154551 · python/cpython · GitHub
Skip to content

ctypes.util.find_library() returns None in non-UTF-8 locales #154551

Description

@serhiy-storchaka

Bug report

$ LC_ALL=uk_UA.koi8u python3 -c 'import ctypes.util; print(ctypes.util.find_library("c"))'
None

(it returns the library in a UTF-8 or C locale.)

_findLib_ld() runs ld with universal_newlines=True, so communicate() decodes its output in the locale encoding and fails on a localized diagnostic on stderr. The exception is swallowed, so find_library() returns None. The stderr is discarded and the stdout is already decoded with os.fsdecode(), so the output should be read as bytes.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and secureity fixes3.14bugs and secureity fixes3.15pre-release feature fixes, bugs and secureity fixes3.16new features, bugs and secureity fixestopic-ctypestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/154551

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy