This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Officially add Py_SETREF and Py_XSETREF
Type: enhancement Stage: resolved
Components: Documentation, Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, rhettinger, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2017-11-08 16:24 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg305878 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-08 16:24
Private macros Py_SETREF and Py_XSETREF were introduced in 3.6 and backported to all maintained versions for fixing bugs (see issue20440 and issue26200). They are helpful and used not only for the primary purpose, but also for simplifying the code. Their names don't start from underscore because I planned to make them public and didn't want massive renaming and backporting conflicts. Now I think it is a time to add them officially to the stable C API.
msg305888 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2017-11-08 18:06
Just adding +1.
msg305889 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-08 18:48
Does anyone want to propose a patch? This is mainly a documentation issue. Needed documenting Py_SETREF and Py_XSETREF in Doc/c-api/refcounting.rst, adding entries in Doc/whatsnew/3.7.rst, and "Misc/NEWS.d/next/C API/", and updating a guard in Include/object.h.
msg306284 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-11-15 16:37
Adding my -1.   My experience was that these macros impaired my ability to maintain the code and interfered with useful patterns like delaying all decrefs until an object was in a consistent state.

While I know that name was bikeshedded quite a bit, the outcome is rather unintuitive:  https://twitter.com/raymondh/status/930535938459025408
msg309033 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-25 09:30
Since there are objections, it is too early to make this a public C API.
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76164
2017-12-25 09:30:41serhiy.storchakasetstatus: open -> closed
resolution: rejected
messages: + msg309033

stage: needs patch -> resolved
2017-11-15 16:37:11rhettingersetnosy: + rhettinger
messages: + msg306284
2017-11-15 09:18:03skrahsetnosy: - skrah
2017-11-08 18:48:02serhiy.storchakasetmessages: + msg305889
stage: needs patch
2017-11-08 18:06:31skrahsetnosy: + skrah
messages: + msg305888
2017-11-08 16:25:17vstinnersetnosy: + vstinner
2017-11-08 16:24:41serhiy.storchakacreate