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

_PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails #84229

Closed
vstinner opened this issue Mar 23, 2020 · 6 comments
Labels
3.8 only security fixes 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@vstinner
Copy link
Member

BPO 40048
Nosy @vstinner, @methane, @corona10, @pablogsal
PRs
  • bpo-40048: Fix _PyCode_InitOpcache() error path #19691
  • [3.8] bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691) #19698
  • 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-04-24.01:07:43.675>
    created_at = <Date 2020-03-23.14:36:53.529>
    labels = ['interpreter-core', '3.8', '3.9']
    title = "_PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails"
    updated_at = <Date 2020-04-24.01:07:43.674>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-04-24.01:07:43.674>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-24.01:07:43.675>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2020-03-23.14:36:53.529>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40048
    keywords = ['patch']
    message_count = 6.0
    messages = ['364850', '364865', '365502', '367164', '367167', '367168']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'methane', 'corona10', 'pablogsal']
    pr_nums = ['19691', '19698']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40048'
    versions = ['Python 3.8', 'Python 3.9']

    @vstinner
    Copy link
    Member Author

    tstate->frame is a borrowed references to the current frame object. It's set tp the frame at _PyEval_EvalFrameDefault() and resets to frame->f_back at _PyEval_EvalFrameDefault() exit.

    Problem: when _PyCode_InitOpcache() fails, tstate->frame is not reset to frame->f_back.

    @vstinner vstinner added 3.8 only security fixes 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Mar 23, 2020
    @vstinner
    Copy link
    Member Author

    Note: I found this issue with Pablo Galindo Galgado while investigating bpo-20526.

    @pablogsal
    Copy link
    Member

    Will prepare a pr soon

    @vstinner
    Copy link
    Member Author

    New changeset 2510494 by Victor Stinner in branch 'master':
    bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691)
    2510494

    @vstinner
    Copy link
    Member Author

    New changeset d9df63d by Victor Stinner in branch '3.8':
    bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691) (GH-19698)
    d9df63d

    @vstinner
    Copy link
    Member Author

    Thanks for the 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.8 only security fixes 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants