◐ Shell
clean mode source ↗

bpo-45476: Disallow using PyFloat_AS_DOUBLE() as l-value by vstinner · Pull Request #28976 · python/cpython

gareth-rees

rhettinger

@vstinner vstinner changed the title bpo-45476: Add _Py_RVALUE() macro bpo-45476: Disallow using PyFloat_AS_DOUBLE() as l-value

Nov 30, 2021

@vstinner vstinner marked this pull request as ready for review

November 30, 2021 13:07
The following "GET" and "AS" functions can no longer be used as
l-value (to modify a Python object):

* PyByteArray_GET_SIZE()
* PyBytes_GET_SIZE()
* PyCFunction_GET_CLASS()
* PyCFunction_GET_FLAGS()
* PyCFunction_GET_FUNCTION()
* PyCFunction_GET_SELF()
* PyDict_GET_SIZE()
* PyFloat_AS_DOUBLE()
* PyFunction_GET_ANNOTATIONS()
* PyFunction_GET_CLOSURE()
* PyFunction_GET_CODE()
* PyFunction_GET_DEFAULTS()
* PyFunction_GET_GLOBALS()
* PyFunction_GET_KW_DEFAULTS()
* PyFunction_GET_MODULE()
* PyHeapType_GET_MEMBERS()
* PyInstanceMethod_GET_FUNCTION()
* PyList_GET_SIZE()
* PyMemoryView_GET_BASE()
* PyMemoryView_GET_BUFFER()
* PyMethod_GET_FUNCTION()
* PyMethod_GET_SELF()
* PySet_GET_SIZE()
* PyTuple_GET_SIZE()
* PyWeakref_GET_OBJECT()

These macros are modified to use the _Py_RVALUE() macro.