[Python-Dev] Add Py_SETREF and Py_XSETREF to the stable C API

Serhiy Storchaka storchaka at gmail.com
Wed Nov 8 11:47:52 EST 2017


08.11.17 18:37, Victor Stinner пише:
> I like these macros!
> 
> Technically, would it be possible to use an inline function instead of
> a macro for Python 3.7?

No, unless there is a way to pass arguments by reference in C99. 
Py_SETREF(x, y) is the safe equivalent of

     x = y;
     Py_DECREF(x, y);



More information about the Python-Dev mailing list