• Martin Panter's avatar
    Issue #22636: avoid using a shell in the ctypes.util module · bfb15ab7
    Martin Panter authored
    Replace os.popen() with subprocess.Popen. Based on patch by Victor Stinner.
    
    If the "gcc", "cc" or "objdump" command is not available, the code was
    supposed to raise an OSError exception. But there was a bug in the code. The
    shell code returns the exit code 10 if the required command is missing, and the
    code tries to check for the status 10. The problem is that os.popen() doesn't
    return the exit code directly, but a status which should be processed by
    os.WIFEXITED() and os.WEXITSTATUS(). In practice, the exception was never
    raised. The OSError exception was not documented and ctypes.util.find_library()
    is expected to return None if the library is not found.
    bfb15ab7
NEWS 325 KB