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

[C API] PyThreadState_GetFrame() and PyFrame_GetCode() should return a strong refrence #84609

Closed
vstinner opened this issue Apr 28, 2020 · 5 comments
Labels
3.9 only security fixes topic-C-API

Comments

@vstinner
Copy link
Member

BPO 40429
Nosy @vstinner
PRs
  • bpo-40429: PyFrame_GetCode() result cannot be NULL #19772
  • bpo-40429: PyFrame_GetCode() now returns a strong reference #19773
  • bpo-40429: Refactor super_init() #19776
  • bpo-40429: PyThreadState_GetFrame() returns a strong ref #19781
  • 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 2020-05-14.01:19:36.786>
    created_at = <Date 2020-04-28.21:55:17.533>
    labels = ['expert-C-API', '3.9']
    title = '[C API] PyThreadState_GetFrame() and PyFrame_GetCode() should return a strong refrence'
    updated_at = <Date 2020-05-14.01:19:36.785>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-05-14.01:19:36.785>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-14.01:19:36.786>
    closer = 'vstinner'
    components = ['C API']
    creation = <Date 2020-04-28.21:55:17.533>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40429
    keywords = ['patch']
    message_count = 5.0
    messages = ['367570', '367572', '367574', '367594', '367601']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['19772', '19773', '19776', '19781']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40429'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    I recently added PyThreadState_GetFrame() and PyFrame_GetCode() functions to the C API of Python 3.9.

    Currently, these functions return borrowed references.

    I asked on capi-sig and Brett confirms that borrowed refrences should be avoided:
    https://mail.python.org/archives/list/capi-sig@python.org/thread/LHESBBB3IYTXMBUKQ3WZI5CWB4WUH5YZ/

    Borrowed references should be avoidedd!
    https://github.com/vstinner/misc/blob/master/cpython/pep-opaque-c-api.rst#borrowed-references

    I will work on a PR to modify these functions to return a strong reference instead.

    @vstinner vstinner added 3.9 only security fixes topic-C-API labels Apr 28, 2020
    @vstinner
    Copy link
    Member Author

    New changeset 6d86a23 by Victor Stinner in branch 'master':
    bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)
    6d86a23

    @vstinner
    Copy link
    Member Author

    New changeset 8852ad4 by Victor Stinner in branch 'master':
    bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)
    8852ad4

    @vstinner
    Copy link
    Member Author

    New changeset cc0dc7e by Victor Stinner in branch 'master':
    bpo-40429: Refactor super_init() (GH-19776)
    cc0dc7e

    @vstinner
    Copy link
    Member Author

    New changeset 4386b90 by Victor Stinner in branch 'master':
    bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
    4386b90

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes topic-C-API
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant