Skip to content

Deprecate deleting with PyObject_SetAttr, PyObject_SetAttrString and PySequence_SetItem #69959

Closed

Description

@serhiy-storchaka
BPO 25773
Nosy @gvanrossum, @ncoghlan, @vadmium, @serhiy-storchaka
Files
  • PyObject_SetAttr_deleting.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-12-18.16:54:41.854>
    created_at = <Date 2015-12-01.15:44:28.237>
    labels = ['interpreter-core', 'type-feature']
    title = 'Deprecate deleting with PyObject_SetAttr, PyObject_SetAttrString and PySequence_SetItem'
    updated_at = <Date 2015-12-18.16:54:41.853>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-12-18.16:54:41.853>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-12-18.16:54:41.854>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2015-12-01.15:44:28.237>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['41200']
    hgrepos = []
    issue_num = 25773
    keywords = ['patch']
    message_count = 2.0
    messages = ['255655', '256696']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'ncoghlan', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue25773'
    versions = ['Python 3.6']

    Activity

    1. serhiy-storchaka commented on Dec 1, 2015

      @serhiy-storchaka
      MemberAuthor

      If the third argument of PyObject_SetAttr(), PyObject_SetAttrString() or PySequence_SetItem() is NULL, these functions delete an attribute or an item. This is rather undocumented implementation detail. There are special counterparts for deleting: PyObject_DelAttr(), PyObject_DelAttrString() and PySequence_DelItem(). May be worth to depre

      Proposed patch deprecates using these Set* functions for deleting and replaces them with appropriate Del* functions if needed.

      Discussion on Python-Dev: http://comments.gmane.org/gmane.comp.python.devel/155474

      Issue that documents deleting with Set* APIs: bpo-25701.

    2. serhiy-storchaka commented on Dec 18, 2015

      @serhiy-storchaka
      MemberAuthor

      The conclusion of the discussion is to not deprecate this behavior in the code, but just warn in the documentation. That has done in bpo-25701.

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions