Skip to content

[BUG] Path separator in Python include path breaks building extension modules #5023

Open
@manueljacob

Description

@manueljacob

When the Python include dir contains a colon (as e.g. in /home/user/colon_in_path_bug/foo:bar/include), extension modules get compiled with the wrong include dirs being passed to the C compiler (e.g. gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/user/colon_in_path_bug/foo -Ibar/include/python3.15 -c foo.c -o build/temp.linux-x86_64-cpython-315/foo.o).

This bug was introduced by python/cpython@85e102a#diff-cc924b02acb3e0db7d519de53c31e0b3945e013e7d387439d8ea32355a1ae99eR164. It was required to return multiple include dirs from distutils.sysconfig.get_python_inc(), so it was changed to join multiple include directories by a path separator. However, if the include dir e.g. returned by sysconfig.get_path("include") already contains a path separator, there is ambiguity about whether the path seperator is used as a path separator or happens to be in the path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions