GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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. #140513

New issue
Copy link
New issue
Copy link
Closed
Closed
We should fail to compile if _Py_TAIL_CALL_INTERP is set but preserve_none and musttail do not exist.#140513
Copy link
Labels
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

Description

@Fidget-Spinner
Fidget-Spinner
opened on Oct 23, 2025
Issue body actions

Bug 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

  • gh-140513: Fail to compile if _Py_TAIL_CALL_INTERP is set but preserve_none and musttail do not exist. #140548
  • [3.14] gh-140513: Fail to compile if _Py_TAIL_CALL_INTERP is set but preserve_none and musttail do not exist (GH-140548) #140923
Reacted by Chris Eibl

Activity

  1. Fidget-Spinner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 23, 2025
  2. StanFromIreland
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    buildThe build process and cross-buildThe build process and cross-build
    on Oct 23, 2025
  3. efimov-mikhail
    added
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    on Oct 23, 2025
  4. Fidget-Spinner
    added
    easy
    on Oct 23, 2025
  5. XChaitanyaX commented on Oct 24, 2025

    @XChaitanyaX
    XChaitanyaX
    on Oct 24, 2025
    Contributor
    More actions

    Can I have a pr for this?

    !!_Py__has_attribute(musttail)

    double exclamation !! mark?? Shouldn't it be single?

  6. chris-eibl commented on Oct 24, 2025

    @chris-eibl
    chris-eibl
    on Oct 24, 2025
    Member
    More actions

    Maybe we can already handle that "earlier" in configure?

  7. Fidget-Spinner commented on Oct 24, 2025

    @Fidget-Spinner
    Fidget-Spinner
    on Oct 24, 2025
    MemberAuthor
    More actions

    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.

    Reacted by Chris Eibl
  8. chris-eibl commented on Oct 24, 2025

    @chris-eibl
    chris-eibl
    on Oct 24, 2025
    Member
    More actions

    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)?

    Reacted by Ken Jin
  9. Fidget-Spinner
    added a commit that references this issue on Nov 1, 2025

    gh-140513: Fail to compile if `_Py_TAIL_CALL_INTERP` is set but `pres…

    2f60b8f
  10. Fidget-Spinner
    removed
    3.14bugs and security fixesbugs and security fixes
    on Nov 1, 2025
  11. Fidget-Spinner commented on Nov 1, 2025

    @Fidget-Spinner
    Fidget-Spinner
    on Nov 1, 2025
    MemberAuthor
    More actions

    We missed the train for 3.14. Backporting now would break GCC 15.

  12. Fidget-Spinner
    closed this as completedon Nov 1, 2025
  13. Fidget-Spinner
    reopened this on Nov 2, 2025
  14. Fidget-Spinner commented on Nov 2, 2025

    @Fidget-Spinner
    Fidget-Spinner
    on Nov 2, 2025
    MemberAuthor
    More actions

    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?

  15. chris-eibl commented on Nov 2, 2025

    @chris-eibl
    chris-eibl
    on Nov 2, 2025
    Member
    More actions

    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

  16. chris-eibl commented on Nov 2, 2025

    @chris-eibl
    chris-eibl
    on Nov 2, 2025
    Member
    More actions

    Or better break for GCC 15 like on main?

  17. Fidget-Spinner commented on Nov 2, 2025

    @Fidget-Spinner
    Fidget-Spinner
    on Nov 2, 2025
    MemberAuthor
    More actions

    Yes just break GCC 15.

    Reacted by Chris Eibl
  18. chris-eibl commented on Nov 2, 2025

    @chris-eibl
    chris-eibl
    on Nov 2, 2025
    Member
    More actions

    Ok, I'll take care about the manual backport.

    Reacted by Ken Jin
  19. chris-eibl
    added a commit that references this issue on Nov 2, 2025

    pythongh-140513: Fail to compile if `_Py_TAIL_CALL_INTERP` is set but…

    a6d52fe
  20. Fidget-Spinner
    added a commit that references this issue on Nov 4, 2025

    [3.14] gh-140513: Fail to compile if _Py_TAIL_CALL_INTERP is set but …

    f0eb7d4
  21. Fidget-Spinner
    closed this as completedon Nov 4, 2025
  22. StanFromIreland
    added a commit that references this issue on Dec 6, 2025

    pythongh-140513: Fail to compile if `_Py_TAIL_CALL_INTERP` is set but…

    c211943
  23. itamaro
    added a commit that references this issue on Apr 12, 2026

    GH-148047: Check early whether tail-calling is possible for MSVC buil…

    cbd81d5
  24. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythonGH-148047: Check early whether tail-calling is possible for MSV…

    ad923b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.