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.

Author vstinner
Recipients Aaron Hall, benjamin.peterson, mark.dickinson, serhiy.storchaka, thatiparthy, vstinner
Date 2018-10-25.10:37:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540463854.58.0.788709270274.issue35059@psf.upfronthosting.co.za>
In-reply-to
Content
> Is it guarantied that static inline functions will be inlined and will be not called as external functions from the Python library? The latter would break binary compatibility of extensions compiled with newer Python headers with older binary Python libraries.

First, I'm not sure that the "stable ABI" really works in practice, there are many issues:
https://pythoncapi.readthedocs.io/

Converting the macro to a static inline function is a minor step in the direction of a more stable API and ABI.

To come back to your question: depending on the compiler and compiler options, Py_INCREF/DECREF() can generate a *function call*. I tuned Py_STATIC_INLINE() to always inline Py_INCREF/DECREF() for GCC, clang and MSVC which are the major compilers used by Python on Windows, Linux, macOS and FreeBSD.

"static inline" is still something new to me. Maybe someone will come with a compiler with which it doesn't work as expected. IMHO we have to go through these issues, and it's only be testing for real that we will see these issues.

I mean, we *have to* get ride of these ugly macros used in Python header files. They are causing subtle bugs and are hard to maintain. See my first message for advantages of static inline functions.
History
Date User Action Args
2018-10-25 10:37:34vstinnersetrecipients: + vstinner, mark.dickinson, benjamin.peterson, serhiy.storchaka, thatiparthy, Aaron Hall
2018-10-25 10:37:34vstinnersetmessageid: <1540463854.58.0.788709270274.issue35059@psf.upfronthosting.co.za>
2018-10-25 10:37:34vstinnerlinkissue35059 messages
2018-10-25 10:37:34vstinnercreate