[Python-checkins] gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615)

miss-islington webhook-mailer at python.org
Wed Feb 8 09:50:51 EST 2023


https://github.com/python/cpython/commit/e8ce85de594e62c73db8d523408c9e1b720f0d0b
commit: e8ce85de594e62c73db8d523408c9e1b720f0d0b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-02-08T06:50:43-08:00
summary:

gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615)

(cherry picked from commit 3a88de7a0af00872d9d57e1d98bc2f035cb15a1c)

Co-authored-by: David Hewitt <1939362+davidhewitt at users.noreply.github.com>

files:
A Misc/NEWS.d/next/Windows/2023-02-07-18-22-54.gh-issue-101614.NjVP0n.rst
M Python/dynload_win.c

diff --git a/Misc/NEWS.d/next/Windows/2023-02-07-18-22-54.gh-issue-101614.NjVP0n.rst b/Misc/NEWS.d/next/Windows/2023-02-07-18-22-54.gh-issue-101614.NjVP0n.rst
new file mode 100644
index 000000000000..8ed0995d7892
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2023-02-07-18-22-54.gh-issue-101614.NjVP0n.rst
@@ -0,0 +1 @@
+Correctly handle extensions built against debug binaries that reference ``python3_d.dll``.
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index b43e9fc26f61..5dc4095237a6 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -125,14 +125,15 @@ static char *GetPythonImport (HINSTANCE hModule)
                 !strncmp(import_name,"python",6)) {
                 char *pch;
 
-#ifndef _DEBUG
-                /* In a release version, don't claim that python3.dll is
-                   a Python DLL. */
+                /* Don't claim that python3.dll is a Python DLL. */
+#ifdef _DEBUG
+                if (strcmp(import_name, "python3_d.dll") == 0) {
+#else
                 if (strcmp(import_name, "python3.dll") == 0) {
+#endif
                     import_data += 20;
                     continue;
                 }
-#endif
 
                 /* Ensure python prefix is followed only
                    by numbers to the end of the basename */



More information about the Python-checkins mailing list