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

Crash on deleting Element attribute #69877

Closed
serhiy-storchaka opened this issue Nov 21, 2015 · 5 comments
Closed

Crash on deleting Element attribute #69877

serhiy-storchaka opened this issue Nov 21, 2015 · 5 comments
Labels
extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@serhiy-storchaka
Copy link
Member

BPO 25691
Nosy @scoder, @larryhastings, @vadmium, @serhiy-storchaka
Files
  • etree_del_attributes.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 2015-11-23.07:01:10.423>
    created_at = <Date 2015-11-21.17:04:39.640>
    labels = ['extension-modules', 'type-crash']
    title = 'Crash on deleting Element attribute'
    updated_at = <Date 2015-11-23.07:28:15.898>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-11-23.07:28:15.898>
    actor = 'larry'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-11-23.07:01:10.423>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2015-11-21.17:04:39.640>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['41114']
    hgrepos = []
    issue_num = 25691
    keywords = ['patch']
    message_count = 5.0
    messages = ['255063', '255125', '255129', '255132', '255134']
    nosy_count = 6.0
    nosy_names = ['scoder', 'larry', 'eli.bendersky', 'python-dev', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue25691'
    versions = ['Python 3.3', 'Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    >>> import xml.etree.ElementTree as ET
    >>> e = ET.Element('tag')
    >>> del e.tag
    Segmentation fault (core dumped)

    Proposed patch fixes the crash.

    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 21, 2015
    @vadmium
    Copy link
    Member

    vadmium commented Nov 23, 2015

    The patch looks good to me.

    This may be a side effect of poor documentation. I guess the documentation at <https://docs.python.org/dev/c-api/typeobj.html#c.PyTypeObject.tp_setattro\> and/or the referenced functions should mention that the they also delete attributes when the name argument is null.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 23, 2015

    New changeset 852c9ed9115c by Serhiy Storchaka in branch '3.4':
    Issue bpo-25691: Fixed crash on deleting ElementTree.Element attributes.
    https://hg.python.org/cpython/rev/852c9ed9115c

    New changeset 3a44f06907f1 by Serhiy Storchaka in branch '3.5':
    Issue bpo-25691: Fixed crash on deleting ElementTree.Element attributes.
    https://hg.python.org/cpython/rev/3a44f06907f1

    New changeset 936fcd0ba6b1 by Serhiy Storchaka in branch 'default':
    Issue bpo-25691: Fixed crash on deleting ElementTree.Element attributes.
    https://hg.python.org/cpython/rev/936fcd0ba6b1

    New changeset e3dea2e4f93d by Serhiy Storchaka in branch '2.7':
    Issue bpo-25691: Added tests on deleting cElementTree.Element attributes.
    https://hg.python.org/cpython/rev/e3dea2e4f93d

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you for your review Martin. Opened bpo-25701 for documenting.

    Interestingly, 2.7 is free from this bug. It has a check for NULL.

    @larryhastings
    Copy link
    Contributor

    This change didn't make it into 3.5.1. It will be released with 3.5.2. I've already updated the Misc/NEWS entry.

    @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
    extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants