diff --git a/Misc/NEWS.d/next/Build/2023-08-08-05-48-33.gh-issue-107585.GbieTV.rst b/Misc/NEWS.d/next/Build/2023-08-08-05-48-33.gh-issue-107585.GbieTV.rst new file mode 100644 index 00000000000000..49d826f7954122 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-08-08-05-48-33.gh-issue-107585.GbieTV.rst @@ -0,0 +1,2 @@ +Fix the libpython ``.lib`` name when targetting the stable ABI in debug +builds on MSVC. diff --git a/PC/pyconfig.h b/PC/pyconfig.h index ac20129cd30fcc..b0a38b5763b965 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -307,13 +307,19 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ /* So MSVC users need not specify the .lib file in their Makefile (other compilers are generally taken care of by distutils.) */ +# if defined(Py_LIMITED_API) +# define PINNED_VER "3" +# else +# define PINNED_VER "313" +# endif /* Py_LIMITED_API */ # if defined(_DEBUG) -# pragma comment(lib,"python313_d.lib") -# elif defined(Py_LIMITED_API) -# pragma comment(lib,"python3.lib") +# define DEBUG_SUFFIX "_d" # else -# pragma comment(lib,"python313.lib") +# define DEBUG_SUFFIX "" # endif /* _DEBUG */ +# pragma comment(lib, "python" PINNED_VER DEBUG_SUFFIX ".lib") +# undef PINNED_VER +# undef DEBUG_SUFFIX # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ #endif /* MS_COREDLL */