From 607812a0b51fe943cf1c5ebc8baeca7e2cf12a1a Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 28 Nov 2023 10:08:14 -0600 Subject: [PATCH 01/17] Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI --- include/pybind11/detail/internals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index fa224e0326..5ad0e36ad6 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -311,11 +311,11 @@ struct type_info { #endif /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. -/// On MSVC, changes in _MSC_VER may indicate ABI incompatibility (#2898). +/// On MSVC, mixing /MT and /MD will result in crashes. See (#4779) #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) -# elif defined(_MSC_VER) +# elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mscver" PYBIND11_TOSTRING(_MSC_VER) # else # define PYBIND11_BUILD_ABI "" From 71b0e9e55679f19ac982373a1db476c44ca41e7b Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 28 Nov 2023 12:46:48 -0600 Subject: [PATCH 02/17] Update comment about which PR --- include/pybind11/detail/internals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 5ad0e36ad6..e1f1cda4ea 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -311,7 +311,7 @@ struct type_info { #endif /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. -/// On MSVC, mixing /MT and /MD will result in crashes. See (#4779) +/// On MSVC, mixing /MT and /MD will result in crashes. See (#4953) #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) From d1695f1f6124b42382eda25476e775601a7d9bad Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 30 Nov 2023 17:37:07 -0600 Subject: [PATCH 03/17] Use msvc major version --- include/pybind11/detail/internals.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index e1f1cda4ea..390af547a9 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -316,7 +316,11 @@ struct type_info { # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # elif defined(_MSC_VER) && defined(_MT) -# define PYBIND11_BUILD_ABI "_mscver" PYBIND11_TOSTRING(_MSC_VER) +# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) +# elif defined(_MSC_VER) && defined(_MD) && (_MSC_VER >= 1900) && (_MSC_VER < 2000) +# define PYBIND11_BUILD_ABI "_md_mscver14" +# elif defined(_MSC_VER) && defined(_MD) +# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(_MSC_VER) # else # define PYBIND11_BUILD_ABI "" # endif From 4c6c344641671dcb956836c4b8d958a078b1c779 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 19:53:53 -0500 Subject: [PATCH 04/17] Use _MSC_VER/100 --- include/pybind11/detail/internals.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 390af547a9..47afb9ae26 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -317,10 +317,8 @@ struct type_info { # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) -# elif defined(_MSC_VER) && defined(_MD) && (_MSC_VER >= 1900) && (_MSC_VER < 2000) -# define PYBIND11_BUILD_ABI "_md_mscver14" # elif defined(_MSC_VER) && defined(_MD) -# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(_MSC_VER) +# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(((int) (_MSC_VER) / 100)) # else # define PYBIND11_BUILD_ABI "" # endif From 543b08f4f21076714db47301f909a392119ca177 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 08:21:55 -0400 Subject: [PATCH 05/17] Fix figuring out MD vs MT --- include/pybind11/detail/internals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 47afb9ae26..d175dac85e 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -315,10 +315,10 @@ struct type_info { #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) +# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) +# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(((int) (_MSC_VER) / 100)) # elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) -# elif defined(_MSC_VER) && defined(_MD) -# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(((int) (_MSC_VER) / 100)) # else # define PYBIND11_BUILD_ABI "" # endif From e7a559d8cec0ee993cef3cff0a2350536abed239 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 08:24:40 -0400 Subject: [PATCH 06/17] Add some test runs --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4acbbf5e4..564b6a3fe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,23 @@ jobs: # Inject a couple Windows 2019 runs - runs-on: windows-2019 python: '3.9' + # Inject a few runs with different runtime libraries + - runs-on: windows-2022 + python: '3.9' + args: > + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded + - runs-on: windows-2022 + python: '3.10' + args: > + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + - runs-on: windows-2022 + python: '3.11' + args: > + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug + - runs-on: windows-2022 + python: '3.12' + args: > + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL # Extra ubuntu latest job - runs-on: ubuntu-latest python: '3.11' From 12a64787449f3d690f98d1879ba47c57965b562b Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 11:07:35 -0400 Subject: [PATCH 07/17] Skip one test --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 564b6a3fe3..45e8d8bc70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,10 +73,11 @@ jobs: python: '3.10' args: > -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL - - runs-on: windows-2022 - python: '3.11' - args: > - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug + # This needs a python built with MTd + # - runs-on: windows-2022 + # python: '3.11' + # args: > + # -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug - runs-on: windows-2022 python: '3.12' args: > From 10dd08a386103f01cdd22a8eb7cf005f833b7535 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 14:46:58 -0400 Subject: [PATCH 08/17] Fix preprocessor --- include/pybind11/detail/internals.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index d175dac85e..8bb2c98b8b 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -312,11 +312,22 @@ struct type_info { /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. /// On MSVC, mixing /MT and /MD will result in crashes. See (#4953) +/// There is no macro for major version for MSVC, so we check for major version +/// 19, 20, 21, 22 for now as major version 19 is MSVC 2015-2022 and we future +/// proof for 3 major versions in the future #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) +# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 19) +# define PYBIND11_BUILD_ABI "_md_mscver19" +# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 20) +# define PYBIND11_BUILD_ABI "_md_mscver20" +# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 21) +# define PYBIND11_BUILD_ABI "_md_mscver21" +# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 22) +# define PYBIND11_BUILD_ABI "_md_mscver22" # elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) -# define PYBIND11_BUILD_ABI "_md_mscver" PYBIND11_TOSTRING(((int) (_MSC_VER) / 100)) +# error "Unknown major version for MSC_VER" # elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else From 72b6d2aedb2a500dfc396c9bd2546564b21a8bb1 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 14:52:46 -0400 Subject: [PATCH 09/17] simplify code --- include/pybind11/detail/internals.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 8bb2c98b8b..7103e35b29 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -318,16 +318,17 @@ struct type_info { #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) -# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 19) -# define PYBIND11_BUILD_ABI "_md_mscver19" -# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 20) -# define PYBIND11_BUILD_ABI "_md_mscver20" -# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 21) -# define PYBIND11_BUILD_ABI "_md_mscver21" -# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) && ((_MSC_VER) / 100 == 22) -# define PYBIND11_BUILD_ABI "_md_mscver22" # elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) -# error "Unknown major version for MSC_VER" +# if ((_MSC_VER) / 100 == 19) +# define PYBIND11_BUILD_ABI "_md_mscver19" +# elif ((_MSC_VER) / 100 == 20) +# define PYBIND11_BUILD_ABI "_md_mscver20" +# elif ((_MSC_VER) / 100 == 21) +# define PYBIND11_BUILD_ABI "_md_mscver21" +# elif ((_MSC_VER) / 100 == 22) +# define PYBIND11_BUILD_ABI "_md_mscver22" +# else +# error "Unknown major version for MSC_VER" # elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else From 9ce2def90cb629181ead61be8fdeef7518f7d03f Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 14 Oct 2024 14:55:45 -0400 Subject: [PATCH 10/17] fix if --- include/pybind11/detail/internals.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 7103e35b29..6901a68ec2 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -329,6 +329,7 @@ struct type_info { # define PYBIND11_BUILD_ABI "_md_mscver22" # else # error "Unknown major version for MSC_VER" +# endif # elif defined(_MSC_VER) && defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else From 1d2f9527f1d619a5e1903209d318eb2f2e15a274 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 15 Oct 2024 14:45:57 -0400 Subject: [PATCH 11/17] support only msvc 19 --- include/pybind11/detail/internals.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 6901a68ec2..bc8247d965 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -312,21 +312,12 @@ struct type_info { /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. /// On MSVC, mixing /MT and /MD will result in crashes. See (#4953) -/// There is no macro for major version for MSVC, so we check for major version -/// 19, 20, 21, 22 for now as major version 19 is MSVC 2015-2022 and we future -/// proof for 3 major versions in the future #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) # if ((_MSC_VER) / 100 == 19) # define PYBIND11_BUILD_ABI "_md_mscver19" -# elif ((_MSC_VER) / 100 == 20) -# define PYBIND11_BUILD_ABI "_md_mscver20" -# elif ((_MSC_VER) / 100 == 21) -# define PYBIND11_BUILD_ABI "_md_mscver21" -# elif ((_MSC_VER) / 100 == 22) -# define PYBIND11_BUILD_ABI "_md_mscver22" # else # error "Unknown major version for MSC_VER" # endif From c3415a96b2a3fd175519138edab28f92f0a19c43 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 23 Oct 2024 14:38:54 -0700 Subject: [PATCH 12/17] Fold in changes from experimental PR #5411. Polish error messages. --- include/pybind11/detail/internals.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 5566b83c34..04ecb326b2 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -310,21 +310,25 @@ struct type_info { # endif #endif -/// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. -/// On MSVC, mixing /MT and /MD will result in crashes. See (#4953) #ifndef PYBIND11_BUILD_ABI -# if defined(__GXX_ABI_VERSION) +# if defined(__GXX_ABI_VERSION) // Linux/OSX. # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) -# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT) -# if ((_MSC_VER) / 100 == 19) -# define PYBIND11_BUILD_ABI "_md_mscver19" +# elif defined(_MSC_VER) // See PR #4953. +# if defined(_MT) && defined(_DLL) +# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) +# elif defined(_MD) +# if (_MSC_VER) / 100 == 19 +# define PYBIND11_BUILD_ABI "_md_mscver19" +# else +# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." +# endif # else -# error "Unknown major version for MSC_VER" +# error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE." # endif -# elif defined(_MSC_VER) && defined(_MT) -# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) +# elif defined(__NVCOMPILER) // NVHPC (PGI-based, outdated). +# define PYBIND11_BUILD_ABI "" // This was never properly guarded. # else -# define PYBIND11_BUILD_ABI "" +# error "Unknown platform or compiler: PLEASE REVISE THIS CODE." # endif #endif From a5b5c3bd148f77c26349f2972d926f946b75a003 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 23 Oct 2024 16:00:57 -0700 Subject: [PATCH 13/17] Remove `&& defined(_DLL)` (TBD: is it needed? but what is correct?) --- include/pybind11/detail/internals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 04ecb326b2..7da907f2d9 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -314,7 +314,7 @@ struct type_info { # if defined(__GXX_ABI_VERSION) // Linux/OSX. # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # elif defined(_MSC_VER) // See PR #4953. -# if defined(_MT) && defined(_DLL) +# if defined(_MT) # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # elif defined(_MD) # if (_MSC_VER) / 100 == 19 From a3944f3e1a2d511e6bdf7c1c261cebf15b6ac666 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 24 Oct 2024 07:16:52 -0500 Subject: [PATCH 14/17] Fix MT vs MD --- include/pybind11/detail/internals.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 7da907f2d9..9960ed4638 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -314,14 +314,14 @@ struct type_info { # if defined(__GXX_ABI_VERSION) // Linux/OSX. # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # elif defined(_MSC_VER) // See PR #4953. -# if defined(_MT) -# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) -# elif defined(_MD) +# if defined(_MT) && defined(_DLL) # if (_MSC_VER) / 100 == 19 # define PYBIND11_BUILD_ABI "_md_mscver19" # else # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif +# elif defined(_MT) +# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else # error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE." # endif From b9b54a7b0ba83161c336b47831e0c783ca21df24 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 24 Oct 2024 15:19:15 -0700 Subject: [PATCH 15/17] Add a couple comments, based on https://github.com/pybind/pybind11/pull/4953#issuecomment-2435138593 (posted by @isuruf). --- include/pybind11/detail/internals.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 9960ed4638..61b4c1f256 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -313,14 +313,14 @@ struct type_info { #ifndef PYBIND11_BUILD_ABI # if defined(__GXX_ABI_VERSION) // Linux/OSX. # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) -# elif defined(_MSC_VER) // See PR #4953. -# if defined(_MT) && defined(_DLL) +# elif defined(_MSC_VER) // See PR #4953. +# if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd. # if (_MSC_VER) / 100 == 19 # define PYBIND11_BUILD_ABI "_md_mscver19" # else # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif -# elif defined(_MT) +# elif defined(_MT) // Corresponding to CL command line options /MT or /MTd. # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else # error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE." From 713b427b740698ebeaee26819c11839a6f8ff15f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 28 Oct 2024 10:33:28 -0700 Subject: [PATCH 16/17] Replace misleading comment: NVHPC is NOT outdated. --- include/pybind11/detail/internals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 61b4c1f256..8cf41bccdd 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -325,8 +325,8 @@ struct type_info { # else # error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE." # endif -# elif defined(__NVCOMPILER) // NVHPC (PGI-based, outdated). -# define PYBIND11_BUILD_ABI "" // This was never properly guarded. +# elif defined(__NVCOMPILER) // NVHPC (PGI-based). +# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? # else # error "Unknown platform or compiler: PLEASE REVISE THIS CODE." # endif From ef6c3f020b2dbd85d39a6810ae947c7bb24bca95 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 28 Oct 2024 11:49:29 -0700 Subject: [PATCH 17/17] Update include/pybind11/detail/internals.h Co-authored-by: Robert Maynard --- include/pybind11/detail/internals.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 8cf41bccdd..e428cf7d0b 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -323,7 +323,11 @@ struct type_info { # elif defined(_MT) // Corresponding to CL command line options /MT or /MTd. # define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER) # else -# error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE." +# if (_MSC_VER) / 100 == 19 +# define PYBIND11_BUILD_ABI "_none_mscver19" +# else +# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." +# endif # endif # elif defined(__NVCOMPILER) // NVHPC (PGI-based). # define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB?