You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my debug builds, for years, I used to compile my third-parties from the source code in debug mode.
For example, I compile python 3.10.8 in debug mode and it produces:
python_d.exe
python3_d.dll
python310_d.dll
python3_d.lib
python310_d.lib
On my build chain, I would like to add the python cryptography third-party. When I compile it from the source code in debug mode, I have the following error:
If I change WINDOWS_ABI3_LIB_NAME to "python310_d", it is linking fine and the cryptography third-party is working.
However, if I change WINDOWS_ABI3_LIB_NAME to "python3_d", it is linking fine but I have an error on the runtime: ImportError: Module use of python3_d.dll conflicts with this version of Python.
The variable buffer is equals to python310_d.dll and the variable import_python is equals to python3_d.dll.
Could the linking of PyO3 in debug mode on Windows be fixed?
Steps to Reproduce
Compile python in debug mode
Compile python cryptography in debug mode
Backtrace
Here is the backtrace of the runtime error when I change WINDOWS_ABI3_LIB_NAME to "python3_d":
python_d.exe -vvvvvvvvv -c "from cryptography.fernet import Fernet"
...
# trying C:\usrlib\python\Lib\site-packages\cryptography\hazmat\bindings\_rust_d.cp310-win_amd64.pyd
Traceback (most recent call last):
File "<string>", line 1, in<module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\usrlib\python\Lib\site-packages\cryptography\fernet.py", line 14, in<module>
from cryptography.hazmat.primitives import hashes, padding
File "<frozen importlib._bootstrap>", line 1078, in _handle_fromlist
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\usrlib\python\Lib\site-packages\cryptography\hazmat\primitives\padding.py", line 11, in<module>
from cryptography.hazmat.bindings._rust import (
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1176, in create_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: Module use of python3_d.dll conflicts with this version of Python.
Your operating system and version
Windows 10 21H2 (OS Build 19044.2130)
Your Python version (python --version)
Python 3.10.8 (in debug mode)
Your Rust version (rustc --version)
rustc 1.65.0 (897e37553 2022-11-02)
Your PyO3 version
0.15.2
How did you install python? Did you use a virtualenv?
Compilation from the source code in debug mode.
Additional Info
No response
The text was updated successfully, but these errors were encountered:
Bug Description
In my debug builds, for years, I used to compile my third-parties from the source code in debug mode.
For example, I compile python 3.10.8 in debug mode and it produces:
python_d.exe
python3_d.dll
python310_d.dll
python3_d.lib
python310_d.lib
On my build chain, I would like to add the python cryptography third-party. When I compile it from the source code in debug mode, I have the following error:
This error is coming from the following line:
pyo3/pyo3-build-config/src/impl_.rs
Line 1536 in 56f11c2
If I change
WINDOWS_ABI3_LIB_NAME
to"python310_d"
, it is linking fine and the cryptography third-party is working.However, if I change
WINDOWS_ABI3_LIB_NAME
to"python3_d"
, it is linking fine but I have an error on the runtime:ImportError: Module use of python3_d.dll conflicts with this version of Python.
This error is coming the following line in cpython repo:
https://github.com/python/cpython/blob/5f4ae86a639fb84260d622e31468da21dc468265/Python/dynload_win.c#L309-L330
The variable
buffer
is equals topython310_d.dll
and the variableimport_python
is equals topython3_d.dll
.Could the linking of PyO3 in debug mode on Windows be fixed?
Steps to Reproduce
Backtrace
Your operating system and version
Windows 10 21H2 (OS Build 19044.2130)
Your Python version (
python --version
)Python 3.10.8 (in debug mode)
Your Rust version (
rustc --version
)rustc 1.65.0 (897e37553 2022-11-02)
Your PyO3 version
0.15.2
How did you install python? Did you use a virtualenv?
Compilation from the source code in debug mode.
Additional Info
No response
The text was updated successfully, but these errors were encountered: