-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Embedded Python 3.11 on windows warns about <exec_prefix>
#98790
Comments
I can confirm this isn't a PyO issue. This happening in Visual Studio running C++ code. |
All you probably need to do is create an empty Incidentally, for an embedded Python, you really want to set paths yourself. Your app is very open to attack if it's allowed to pick up libraries from anywhere on disk, and the only ways to prevent this ( Now, for the case where we are expecting a "standard" layout and don't find it, we actually only run because Windows has always implicitly included the executable's directory in |
Alternatively, you can set Changing this default might be the best fix here anyway. Right now, it's based on the Not sure who has the most thoughts about this vs. changing platlib search (which may be unnecessary if we can rely on it always being relative to the stdlib directory)? Maybe @vstinner or @FFY00? |
Py_SetPath no longer works in Python 3.11. |
…cutable_dir contains PYD files instead
I've posted two PRs - one which I think is more correct (suppressing debug messages by default), and one that just adds a Windows-specific hack to never warn about not having found I still think getpath.py could do with a revamp, but I don't have enough context to do it for all platforms (might be a project for @FFY00 😉 ). The aim is to have more consistency, rather than less, which is why the OS-specific hacks are all marked and are less preferred. |
Looks like your right. Py_SetPath still does work. VS 2022 just doesn't compile without #pragma warning(suppress : 4996) in 3.11 it seems. Thanks. Didn't think of that without. |
Touching that is very tricky, and ought to break things, so I think we probably should only do it with a PEP, but yeah, I think making it more consistent across platforms would be really nice. For now, I think we should try to mimic the old initialization as best-effort, so I am in favor of the PR changing the behavior back to close of what it was. |
* `python`: we now link against python 3.11 - the latest stable python * change all GH workflows to use python 3.11 * add empty DLLs directory to suppress python 3.11 warning as per python/cpython#98790
…e_dir contains PYD files instead (GH-98936)
This is resolved in 3.12 and backporting to 3.11, by changing the rule slightly on how
|
…cutable_dir contains PYD files instead (pythonGH-98936)
…e_dir contains PYD files instead (GH-98936)
FYI this caused a regression in 3.11.1 that prevents some users from using it at all. #100171 |
Bug report
On Windows, with Python 3.11, an embedded Python interpreter prints a new warning at startup
Could not find platform dependent libraries <exec_prefix>
.3.10 and older versions do not exhibit this.
Sample program (I'm using Rust / PyO3 because it's what I know, however I'm fairly sure that it's not relevant to the repro. If you've got a recommended way to configure a windows C toolchain for building an embedded Python I'd be happy to demonstrate the same issue in C):
Running outputs:
Execution then proceeds without issue. (We observe this in PyO3's test suite, which passes all 3.11 tests despite emitting this warning.)
I have a couple of thoughts:
exec_prefix
suggests it is irrelevant on Windows. So is this warning actually useful?getpath
into Python? (Rewrite getpath.c in Python #89745)Your environment
The text was updated successfully, but these errors were encountered: