From 6812a5f03353dfe666636bbce7836624342f51b9 Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Fri, 24 Oct 2025 19:22:34 +0530 Subject: [PATCH 1/9] fix --- Python/ceval_macros.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 4ed03b7fb01bdf..d81a923b43d093 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -78,7 +78,11 @@ # define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, instruction_funcptr_table, oparg #endif -#if _Py_TAIL_CALL_INTERP +#if _Py_TAIL_CALL_INTERP && (defined(__clang__) || defined(__GNUC__)) +# if !_Py__has_attribute(preserve_none) || !!_Py__has_attribute(musttail) +# error "This compiler does not have support for efficient tail calling." +# endif +#endif // Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment. # define Py_MUSTTAIL [[clang::musttail]] # define Py_PRESERVE_NONE_CC __attribute__((preserve_none)) From d8901b1eb1b0fa15f2f97a001b371367de3507ec Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Fri, 24 Oct 2025 19:25:39 +0530 Subject: [PATCH 2/9] add space after #endif --- Python/ceval_macros.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index d81a923b43d093..946be722b192da 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -83,6 +83,7 @@ # error "This compiler does not have support for efficient tail calling." # endif #endif + // Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment. # define Py_MUSTTAIL [[clang::musttail]] # define Py_PRESERVE_NONE_CC __attribute__((preserve_none)) From 95e9b6f16423086777c7db81e0fe1ca14fff2783 Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Fri, 24 Oct 2025 19:30:52 +0530 Subject: [PATCH 3/9] unnecessary `!` mark --- Python/ceval_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 946be722b192da..61fdcc9152a99b 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -79,7 +79,7 @@ #endif #if _Py_TAIL_CALL_INTERP && (defined(__clang__) || defined(__GNUC__)) -# if !_Py__has_attribute(preserve_none) || !!_Py__has_attribute(musttail) +# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) # error "This compiler does not have support for efficient tail calling." # endif #endif From d4fa2e418ffa65ae48467ceb7928becd20f6e8eb Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Fri, 24 Oct 2025 22:38:58 +0530 Subject: [PATCH 4/9] commit --- Python/ceval_macros.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 61fdcc9152a99b..875ed424b19f8d 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -78,10 +78,14 @@ # define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, instruction_funcptr_table, oparg #endif -#if _Py_TAIL_CALL_INTERP && (defined(__clang__) || defined(__GNUC__)) -# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) -# error "This compiler does not have support for efficient tail calling." +#if _Py_TAIL_CALL_INTERP +# if defined(__clang__) || defined(__GNUC__) +# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) +# error "This compiler does not have support for efficient tail calling." +# endif # endif +#elif defined(_MSC_VER) && (_MSC_VER < 1950) +# error "You need atleast VS 2026 / PlatformToolset v145 for tail calling." #endif // Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment. From 96ff7b83cc3a14d8b1c685dcbcb37633017114aa Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Fri, 24 Oct 2025 22:46:27 +0530 Subject: [PATCH 5/9] commit --- Python/ceval_macros.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 875ed424b19f8d..d1c38b5bce4820 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -83,10 +83,9 @@ # if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) # error "This compiler does not have support for efficient tail calling." # endif +# elif defined(_MSC_VER) && (_MSC_VER < 1950) +# error "You need atleast VS 2026 / PlatformToolset v145 for tail calling." # endif -#elif defined(_MSC_VER) && (_MSC_VER < 1950) -# error "You need atleast VS 2026 / PlatformToolset v145 for tail calling." -#endif // Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment. # define Py_MUSTTAIL [[clang::musttail]] From e3893ac1e60896d2dd6349d1ecb859f1a754097c Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Sat, 25 Oct 2025 08:10:26 +0530 Subject: [PATCH 6/9] blurb --- .../next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst diff --git a/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst b/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst new file mode 100644 index 00000000000000..07cd6b2d442e16 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst @@ -0,0 +1,2 @@ +Ensure that the build fails if ``_Py_TAIL_CALL_INTERP`` is enabled but either +``preserve_none`` or ``musttail`` is not supported. From 2c36f5d2b1103f3dc152cdae16c0939d56857199 Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com> Date: Sat, 25 Oct 2025 14:07:08 +0530 Subject: [PATCH 7/9] fix indent Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> --- Python/ceval_macros.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index d1c38b5bce4820..892319ff9e41c6 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -79,13 +79,13 @@ #endif #if _Py_TAIL_CALL_INTERP -# if defined(__clang__) || defined(__GNUC__) -# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) -# error "This compiler does not have support for efficient tail calling." -# endif -# elif defined(_MSC_VER) && (_MSC_VER < 1950) -# error "You need atleast VS 2026 / PlatformToolset v145 for tail calling." -# endif +# if defined(__clang__) || defined(__GNUC__) +# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) +# error "This compiler does not have support for efficient tail calling." +# endif +# elif defined(_MSC_VER) && (_MSC_VER < 1950) +# error "You need at least VS 2026 / PlatformToolset v145 for tail calling." +# endif // Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment. # define Py_MUSTTAIL [[clang::musttail]] From db8f35cd47ed04d71dc6b2869b8e5c6542bd1561 Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:30:15 +0530 Subject: [PATCH 8/9] indent Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> --- Python/ceval_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 892319ff9e41c6..227885797513a0 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -82,7 +82,7 @@ # if defined(__clang__) || defined(__GNUC__) # if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) # error "This compiler does not have support for efficient tail calling." -# endif +# endif # elif defined(_MSC_VER) && (_MSC_VER < 1950) # error "You need at least VS 2026 / PlatformToolset v145 for tail calling." # endif From 5fb8be89226dfcacc6fd7e0f842dec806816c081 Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Tue, 28 Oct 2025 14:37:58 +0530 Subject: [PATCH 9/9] modify news entry --- .../next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst b/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst index 07cd6b2d442e16..1035ebf8d781cf 100644 --- a/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst +++ b/Misc/NEWS.d/next/Build/2025-10-25-08-07-06.gh-issue-140513.6OhLTs.rst @@ -1,2 +1,2 @@ -Ensure that the build fails if ``_Py_TAIL_CALL_INTERP`` is enabled but either -``preserve_none`` or ``musttail`` is not supported. +Generate a clear compilation error when ``_Py_TAIL_CALL_INTERP`` is enabled but +either ``preserve_none`` or ``musttail`` is not supported.