GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cannot import extensions linked against `python3_d.dll` debug build on Windows · Issue #101614 · python/cpython

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

New issue
Copy link
New issue
Copy link
Closed
Closed
Cannot import extensions linked against python3_d.dll debug build on Windows#101614
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@davidhewitt
davidhewitt
opened on Feb 6, 2023
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

cpython/Python/dynload_win.c

Lines 311 to 330 in 7a25310

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

  • 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

Activity

  1. davidhewitt
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 6, 2023
  2. davidhewitt
    added a commit that references this issue on Feb 6, 2023

    pythongh-101614: don't treat python3_d.dll as a Python dll

    d8e29ba
  3. bors
    added a commit that references this issue on Feb 7, 2023

    Merge #2937

    2db351b
  4. zooba
    added a commit that references this issue on Feb 8, 2023

    gh-101614: Don't treat python3_d.dll as a Python DLL when checking ex…

    3a88de7
  5. miss-islington
    added 4 commits that reference this issue on Feb 8, 2023

    pythongh-101614: Don't treat python3_d.dll as a Python DLL when check…

    b5e22f3

    pythongh-101614: Don't treat python3_d.dll as a Python DLL when check…

    fed02dd

    gh-101614: Don't treat python3_d.dll as a Python DLL when checking ex…

    c63d7c9

    gh-101614: Don't treat python3_d.dll as a Python DLL when checking ex…

    e8ce85d
  6. carljm
    added a commit that references this issue on Feb 9, 2023

    Merge branch 'main' into inlinecomp2

    be3becc
  7. hugovk commented on Nov 10, 2023

    @hugovk
    hugovk
    on Nov 10, 2023
    Member
    More actions

    Thanks for the fixes!

    Reacted by David Hewitt
  8. hugovk
    closed this as completedon Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.