STINNER Victor <vstin...@redhat.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35059>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

  • ... STINNER Victor
  • ... STINNER Victor
  • ... Aaron Hall
  • ... Benjamin Peterson
  • ... STINNER Victor
  • ... శ్రీనివాస్ రెడ్డి తాటిపర్తి
  • ... STINNER Victor
  • ... STINNER Victor
  • ... STINNER Victor
  • ... Serhiy Storchaka
  • ... STINNER Victor
  • ... STINNER Victor
  • ... STINNER Victor
  • ... STINNER Victor
  • ... STINNER Victor
  • ... STINNER Victor
  • ... Benjamin Peterson
  • ... STINNER Victor
    • ... Benjamin Peterson
  • ... STINNER Victor
  • ... STINNER Victor

Reply via email to