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

Don't rely on borrowed _PyType_Lookup() reference in PyObject_GenericSetAttr() #58419

Closed
vstinner opened this issue Mar 6, 2012 · 3 comments
Closed
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@vstinner
Copy link
Member

vstinner commented Mar 6, 2012

BPO 14211
Nosy @vstinner
Files
  • type_lookup_ref.patch
  • 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 2012-03-09.00:06:11.842>
    created_at = <Date 2012-03-06.17:19:05.380>
    labels = ['interpreter-core', 'type-crash']
    title = "Don't rely on borrowed _PyType_Lookup() reference in PyObject_GenericSetAttr()"
    updated_at = <Date 2012-03-09.00:06:11.841>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2012-03-09.00:06:11.841>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-03-09.00:06:11.842>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2012-03-06.17:19:05.380>
    creator = 'vstinner'
    dependencies = []
    files = ['24746']
    hgrepos = []
    issue_num = 14211
    keywords = ['patch']
    message_count = 3.0
    messages = ['155025', '155187', '155189']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue14211'
    versions = ['Python 3.3']

    @vstinner
    Copy link
    Member Author

    vstinner commented Mar 6, 2012

    PyObject_GenericSetAttr() doesn't keep a reference to the descriptor: Python does crash if the descriptor is destroyed while the attribute is set. Attached patch keeps a reference to the desriptor to avoid the crash.

    A smililar was done in PyObject_GenericGetAttr() 8 years with the changelog "fix obscure crash in descriptor handling", see the changeset 941d49a65f06.

    The patch fixes Lib/test/crashers/borrowed_ref_2.py and so removes it.

    @vstinner vstinner added type-crash A hard crash of the interpreter, possibly with a core dump interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Mar 6, 2012
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 8, 2012

    New changeset 579f845ac396 by Victor Stinner in branch 'default':
    Issue bpo-14211: _PyObject_GenericSetAttrWithDict() keeps a strong reference to
    http://hg.python.org/cpython/rev/579f845ac396

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 8, 2012

    New changeset 2cc44cd8098e by Victor Stinner in branch 'default':
    Issue bpo-14211: Oops, I removed the wrong file :-)
    http://hg.python.org/cpython/rev/2cc44cd8098e

    @vstinner vstinner closed this as completed Mar 9, 2012
    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant