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 Mark.Shannon, mark.dickinson, pablogsal, rhettinger, shihai1991, tim.peters, vstinner
Date 2021-04-07.10:33:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> For any sane design of tagged pointers, `x == y` (in C) will work fine.

I wrote a proof-of-concept for using tagged pointners in CPython:

"The PR is large because of the first changes which add Py_IS_NONE(), Py_IS_TRUE() and Py_IS_FALSE() macros."

For backward compatibility, I added a function to get a concrete Python object from a tagged pointer: the True as a tagged pointer becomes (PyObject *)&_Py_TrueStruct concrete object. Py_IS_TRUE() has to check for both values: tagged pointer or &_Py_TrueStruct (don't look at my exact implementation, it's wrong ;-)).

In a perfect world, there would be no backward compatibility and you would never have to create Python objects from a tagged pointer.

The other problem is that the stable ABI exposes "Py_True" as "&_Py_TrueStruct" and so C extensions built with the stable ABI uses "&_Py_TrueStruct", not the tagged pointer.

See also bpo-39511 which discuss solutions for these problems.
Date User Action Args
2021-04-07 10:33:31vstinnersetrecipients: + vstinner, tim.peters, rhettinger, mark.dickinson, Mark.Shannon, pablogsal, shihai1991
2021-04-07 10:33:31vstinnersetmessageid: <>
2021-04-07 10:33:31vstinnerlinkissue43753 messages
2021-04-07 10:33:28vstinnercreate