Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
Build a debug version of CPython on Windows.
Build an an extension module linked against this debug CPython'spython3_d.dll.
This crashes at runtime with the following error:
ImportError: Module use of python3_d.dll conflicts with this version of Python.This originates from
Lines 311 to 330 in7a25310
| PyOS_snprintf(buffer,sizeof(buffer), | |
| #ifdef_DEBUG | |
| "python%d%d_d.dll", | |
| #else | |
| "python%d%d.dll", | |
| #endif | |
| PY_MAJOR_VERSION,PY_MINOR_VERSION); | |
| import_python=GetPythonImport(hDLL); | |
| if (import_python&& | |
| _stricmp(buffer,import_python)) { | |
| PyErr_Format(PyExc_ImportError, | |
| "Module use of %.150s conflicts " | |
| "with this version of Python.", | |
| import_python); | |
| Py_BEGIN_ALLOW_THREADS | |
| FreeLibrary(hDLL); | |
| Py_END_ALLOW_THREADS | |
| returnNULL; | |
| } |
It looks like this code doesn't account for the possibility of linking againstpython3_d.dll when using a debug build.
Your environment
- CPython versions tested on: main branch,7a25310
- Operating system and architecture: Windows 12 amd64
Originally reported to me inPyO3/pyo3#2780
Linked PRs
- gh-101614: don't treat python3_d.dll as a Python dll #101615
- [3.11] gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615) #101690
- [3.10] gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615) #101691