-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: pybind11-config --includes does not quote paths #5300
Comments
What would the correct way to quote them on Windows? (https://docs.python.org/3/library/shlex.html#shlex.quote has a big warning about Windows) |
Doesn't |
Meson has an implementation here; I have not compared them, so I can't say what the difference is.
Probably true yes, but I guess Meson uses the pkgconfig file and doesn't worry about that program. |
Can you try 2.13.3? |
Unfortunately, that didn't work; it ends up as (with spaces between each argument replaced by newlines for readability):
and after passing through Meson, it becomes:
I believe that's because on Windows, you must use double quotes (which Meson is doing, but So unfortunately, because this also affects the latter path (which didn't need quoting in this case), and single quotes are just normal characters that aren't stripped, |
I just noticed #4874 exists, which might cover all the cases? |
FYI: 2.13.3 broke the build of SciPy: scipy/scipy#21385, scipy/scipy#21391 The problem is as @QuLogic explained above: the compiler arguments are wrapped in both double and single quotes, e.g. |
Releasing momentarily. |
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.13.1
Problem description
On a Windows VM, I installed Python (from python.org) globally for external reasons; this resulted in an install to
C:\Program Files\Python312
. Sincepybind11-config --includes
addssysconfig.get_path("include")
andsysconfig.get_path("platinclude")
, the result includes that system path as well.Because these paths contain spaces, and the paths are not quoted, they can be interpreted as multiple arguments. I have not tried the CMake integration, but at least with Meson, they are split into separate
-IC:\Program
andFiles\Python312\Include
. For example, a build of Matplotlib outputs:Magically, this just happens to work because the right include path was added for other reasons, and MSVC ignores the broken one:
but if it were to become more strict, it might break.
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: