Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cannot import extensions linked against python3_d.dll debug build on Windows #101614

Copy link
Copy link
Closed
@davidhewitt

Description

@davidhewitt
Issue body actions

Bug report

Build a debug version of CPython on Windows.
Build an an extension module linked against this debug CPython's python3_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

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
return NULL;
}

It looks like this code doesn't account for the possibility of linking against python3_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 in PyO3/pyo3#2780

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.