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

OrderedDict can set an exception in tp_clear #77893

Closed
serhiy-storchaka opened this issue May 31, 2018 · 5 comments
Closed

OrderedDict can set an exception in tp_clear #77893

serhiy-storchaka opened this issue May 31, 2018 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@serhiy-storchaka
Copy link
Member

BPO 33712
Nosy @vstinner, @methane, @ericsnowcurrently, @serhiy-storchaka
PRs
  • bpo-33712: Create the od_fast_nodes cache in OrderedDict only if needed. #7349
  • [3.7] bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). #10000
  • [3.6] bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). #10001
  • 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 2018-10-20.09:10:11.327>
    created_at = <Date 2018-05-31.12:08:48.809>
    labels = ['interpreter-core', '3.7', '3.8', 'type-crash']
    title = 'OrderedDict can set an exception in tp_clear'
    updated_at = <Date 2018-10-20.09:10:11.327>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-10-20.09:10:11.327>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-20.09:10:11.327>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2018-05-31.12:08:48.809>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33712
    keywords = ['patch']
    message_count = 5.0
    messages = ['318287', '318317', '328082', '328132', '328135']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'methane', 'eric.snow', 'serhiy.storchaka']
    pr_nums = ['7349', '10000', '10001']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue33712'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    The tp_clear handler of OrderedDict can set an exception when fail to allocate a nodes cache for an empty dict. An exception in tp_clear is not expected and caused a crash in the garbage collector. In the master branch it will cause just writing a traceback to stderr (see bpo-33622), but in any case it would be better to handle the failure locally in OrderedDict. Perhaps the cache for an empty dict is not needed.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels May 31, 2018
    @vstinner
    Copy link
    Member

    The tp_clear handler of OrderedDict can set an exception when fail to allocate a nodes cache for an empty dict. An exception in tp_clear is not expected and caused a crash in the garbage collector.

    If it's a cache, it would be better to cancel the caching, and just destroy the dictionary, no?

    @vstinner
    Copy link
    Member

    New changeset 6f17e51 by Victor Stinner (Serhiy Storchaka) in branch 'master':
    bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349)
    6f17e51

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 861d34e by Serhiy Storchaka in branch '3.7':
    bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). (GH-10000)
    861d34e

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset f1b90e3 by Serhiy Storchaka in branch '3.6':
    bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). (GH-10001)
    f1b90e3

    @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.7 (EOL) end of life 3.8 only security fixes 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

    2 participants