Issue 22039: PyObject_SetAttr doesn't mention value = NULL
Created on 2014-07-22 17:56 by pitrou, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 30639 | merged | iritkatriel, 2022-01-17 14:53 | |
| PR 30684 | merged | miss-islington, 2022-01-19 12:04 | |
| PR 30685 | merged | miss-islington, 2022-01-19 12:04 | |
| Messages (9) | |||
|---|---|---|---|
| msg223678 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2014-07-22 17:56 | |
PyObject_SetAttr, when called with value == NULL, actually deletes the attribute, but the documentation doesn't say it. It mentions PyObject_DelAttr, but it is only a macro and can therefore not be looked up using e.g. ctypes. |
|||
| msg255704 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2015-12-02 10:53 | |
See two alternative issues: issue25701 for documenting existing behavior, and issue25773 for deprecating it (and converting PyObject_DelAttr to a function). |
|||
| msg282074 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2016-11-30 10:55 | |
As of Issue 25701, the null-to-delete feature is documented as being deprecated in favour of calling the related Del functions or macros. There was a python-dev thread at <https://marc.info/?i=n32kch$eie$1@ger.gmane.org>. I’m not sure if that is good enough, or do we need to e.g. clarify that the deprecation is only at the API (C header) level, and not the ABI level? |
|||
| msg398808 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2021-08-02 22:55 | |
This behaviour is documented as deprecated all the way back to 2.7. Should we repurpose the issue to removing it? Otherwise it can be closed. https://docs.python.org/2.7/c-api/object.html#c.PyObject_SetAttr |
|||
| msg410755 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2022-01-17 10:39 | |
I read the python-dev thread now and I see it was decided that it’s not worth removing it. In recent versions of the doc it is mentioned that the function is in the stable ABI. Should we clarify exactly what is meant by ‘deprecated’? |
|||
| msg410788 - (view) | Author: Petr Viktorin (petr.viktorin) * ![]() |
Date: 2022-01-17 14:16 | |
This cannot be changed in 3.x, since the PyObject_DelAttr macro calls PyObject_SetAttr(..., NULL), and the macro is expanded in all extensions that use the stable ABI. (Technically, it would be possible to add a PyObject_SetAttr *macro* that would warn/fail, while keeping the PyObject_SetAttr *function* untouched, but that would be a pain to test/maintain.) The wording could be clarified to something like: "This behaviour is deprecated in favour of using PyObject_DelAttr(), but there are currently no plans to remove it." |
|||
| msg410937 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2022-01-19 12:03 | |
New changeset 3bf6315c4cabf72d64e65e6f85bf72c65137255a by Irit Katriel in branch 'main': bpo-22039: [doc] clarify that there are no plans to disable deleting an attribute via PyObject_SetAttr (GH-30639) https://github.com/python/cpython/commit/3bf6315c4cabf72d64e65e6f85bf72c65137255a |
|||
| msg410938 - (view) | Author: miss-islington (miss-islington) | Date: 2022-01-19 12:30 | |
New changeset 7b694b816f30c463ffcab0952d3319320d23e154 by Miss Islington (bot) in branch '3.9': [3.9] bpo-22039: [doc] clarify that there are no plans to disable deleting an attribute via PyObject_SetAttr (GH-30639) (GH-30685) https://github.com/python/cpython/commit/7b694b816f30c463ffcab0952d3319320d23e154 |
|||
| msg410939 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2022-01-19 12:34 | |
New changeset 0861a50bd434d1f3e12fe7122e37356f1fce93dc by Miss Islington (bot) in branch '3.10': bpo-22039: [doc] clarify that there are no plans to disable deleting an attribute via PyObject_SetAttr (GH-30639) (GH-30684) https://github.com/python/cpython/commit/0861a50bd434d1f3e12fe7122e37356f1fce93dc |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:06 | admin | set | github: 66238 |
| 2022-01-19 12:34:36 | iritkatriel | set | messages: + msg410939 |
| 2022-01-19 12:30:09 | miss-islington | set | messages: + msg410938 |
| 2022-01-19 12:07:27 | iritkatriel | set | status: open -> closed resolution: duplicate -> fixed stage: patch review -> resolved |
| 2022-01-19 12:04:06 | miss-islington | set | pull_requests: + pull_request28884 |
| 2022-01-19 12:04:01 | miss-islington | set | nosy:
+ miss-islington pull_requests: + pull_request28883 |
| 2022-01-19 12:03:59 | iritkatriel | set | messages: + msg410937 |
| 2022-01-17 15:08:58 | iritkatriel | set | versions: + Python 3.9, Python 3.10, Python 3.11, - Python 2.7, Python 3.4, Python 3.5 |
| 2022-01-17 14:53:27 | iritkatriel | set | keywords:
+ patch stage: patch review pull_requests: + pull_request28842 |
| 2022-01-17 14:16:19 | petr.viktorin | set | messages: + msg410788 |
| 2022-01-17 13:58:21 | iritkatriel | set | nosy:
+ petr.viktorin |
| 2022-01-17 10:39:54 | iritkatriel | set | status: pending -> open messages: + msg410755 |
| 2021-08-02 22:55:13 | iritkatriel | set | status: open -> pending nosy:
+ iritkatriel superseder: Document that tp_setattro and tp_setattr are used for deleting attributes |
| 2016-11-30 10:55:40 | martin.panter | set | messages: + msg282074 |
| 2016-11-29 19:34:51 | serhiy.storchaka | set | nosy:
+ martin.panter |
| 2015-12-02 10:53:25 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg255704 |
| 2014-07-22 17:56:30 | pitrou | create | |
