GeezerVison is showing github.com — We should fail to compile if _Py_TAIL_CALL_INTERP is set but `preserve_none` and `musttail` do not exist. · Issue #140513 · python/cpython
We should fail to compile if _Py_TAIL_CALL_INTERP is set but preserve_none and musttail do not exist. #140513Labels 3.15bugs and security fixesbugs and security fixesbuildThe build process and cross-buildThe build process and cross-buildeasyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug report
Bug description:
The code should look something like this:
#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
CPython versions tested on:
CPython main branch, 3.15, 3.14
Operating systems tested on:
No response
Linked PRs
ActivityXChaitanyaX commented on Oct 24, 2025 Can I have a pr for this?
!!_Py__has_attribute(musttail)
double exclamation !! mark?? Shouldn't it be single? chris-eibl commented on Oct 24, 2025 Maybe we can already handle that "earlier" in configure? Fidget-Spinner commented on Oct 24, 2025
Maybe we can already handle that "earlier" in configure?
This works too but I'd rather bloat up our C code rather than the configure code. The configure script is already pretty complex so I don't like adding more to it. chris-eibl commented on Oct 24, 2025 Yeah, and we could handle MSVC (#139962) here then in a similar way, too.
E.g. include a check for _MSC_VER like #if defined(_MSC_VER) && (_MSC_VER < 1950)? added a commit that references this issue on Nov 1, 2025gh-140513: Fail to compile if `_Py_TAIL_CALL_INTERP` is set but `pres… Fidget-Spinner commented on Nov 1, 2025 We missed the train for 3.14. Backporting now would break GCC 15. Fidget-Spinner commented on Nov 2, 2025 We need to backport this to 3.14 as well. The macro name has changed there. Can someone take care of the manual backport please? chris-eibl commented on Nov 2, 2025 Yeah, #139120 did not get backported.
I think it would be best to start fresh over against 3.14, cherry picker would be no help?
Also because the MSVC part shouldn't be part of it or needs extra care, too?
We missed the train for 3.14. Backporting now would break GCC 15.
which has musttail but no preserve_none
How to handle that? Something like
// GCC 15 has support for musttail, but not for preserve_none.
// Because we previously have allowed this, let's continue to do so.
# if defined(__clang__) || defined(__GNUC__)
# if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail)
# if (__GNUC__ != 15)
# error "This compiler does not have support for efficient tail calling."
# endif
# endif
# elif defined(_MSC_VER)
# error "tail calling is not supported for MSVC."
# endif
https://godbolt.org/z/d74ozM1oE chris-eibl commented on Nov 2, 2025 Or better break for GCC 15 like on main? Fidget-Spinner commented on Nov 2, 2025 chris-eibl commented on Nov 2, 2025 Ok, I'll take care about the manual backport. added a commit that references this issue on Apr 12, 2026GH-148047: Check early whether tail-calling is possible for MSVC buil…
MetadataMetadata3.15bugs and security fixesbugs and security fixesbuildThe build process and cross-buildThe build process and cross-buildeasyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DevelopmentNo branches or pull requestsIssue actions
|