Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API #83016

Closed
vstinner opened this issue Nov 18, 2019 · 5 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 38835
Nosy @vstinner
PRs
  • bpo-38835: Exclude PyFPE macros from the stable API #17228
  • bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT #17231
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-11-20.11:19:41.795>
    created_at = <Date 2019-11-18.14:35:51.139>
    labels = ['library', '3.9']
    title = 'pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API'
    updated_at = <Date 2019-11-20.11:19:41.792>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-11-20.11:19:41.792>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-11-20.11:19:41.795>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2019-11-18.14:35:51.139>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38835
    keywords = ['patch']
    message_count = 5.0
    messages = ['356870', '356871', '357021', '357059', '357060']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['17228', '17231']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38835'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    The bpo-29137 removed the fpectl module. But two macros were kept in pyfpe.h:

    /* These macros used to do something when Python was built with --with-fpectl,

    • but support for that was dropped in 3.7. We continue to define them though,
    • to avoid breaking API users.
      */
    #define PyFPE_START_PROTECT(err_string, leave_stmt)
    #define PyFPE_END_PROTECT(v)

    I propose to exclude them from the stable API. Maybe at least exclude them from the stable API >= 3.9?

    commit 735ae8d
    Author: Nathaniel J. Smith <njs@pobox.com>
    Date: Fri Jan 5 23:15:34 2018 -0800

    bpo-29137: Remove fpectl module (bpo-4789)
    
    This module has never been enabled by default, never worked correctly
    on x86-64, and caused ABI problems that caused C extension
    compatibility. See bpo-29137 for details/discussion.
    

    @vstinner vstinner added 3.9 only security fixes stdlib Python modules in the Lib dir labels Nov 18, 2019
    @vstinner
    Copy link
    Member Author

    Python/pyfpe.c still contains two variables (PyFPE_jbuf and PyFPE_counter) and one function (PyFPE_dummy) for ABI compatibility:
    ---
    /* These variables used to be used when Python was built with --with-fpectl,

    • but support for that was dropped in 3.7. We continue to define them,
    • though, because they may be referenced by extensions using the stable ABI.
      */
    #include "setjmp.h"
    
    jmp_buf PyFPE_jbuf;
    int PyFPE_counter;
    
    double
    PyFPE_dummy(void *dummy)
    {
        return 1.0;
    }

    @vstinner
    Copy link
    Member Author

    New changeset be143ec by Victor Stinner in branch 'master':
    bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
    be143ec

    @vstinner
    Copy link
    Member Author

    New changeset 488d02a by Victor Stinner in branch 'master':
    bpo-38835: Exclude PyFPE macros from the stable API (GH-17228)
    488d02a

    @vstinner
    Copy link
    Member Author

    Pablo asked on PR 17231:

    Do you want to left the empty macro in Include/pyfpe.h?

    #17231 (review)

    I replied:

    If someone wants to remove them, I would suggest to first deprecate them, and wait at least one Python release before removing them. And do that in a separated issue: https://bugs.python.org/issue38835 title is "pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API", it's not directly related :-)

    #17231 (comment)

    In short, I'm not interested to remove it right now :-)

    The initial issue has been fixed, so I close the issue. Thanks for your review Pablo ;-)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant