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 numberZero
Recipients numberZero
Date 2021-02-09.22:05:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612908350.59.0.954965139249.issue43181@roundup.psfhosted.org>
In-reply-to
Content
There is a lot of macros like:
    #define PyObject_TypeCheck(ob, tp) \
    (Py_IS_TYPE(ob, tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
These work fine until an argument happen to contain a comma. That’s possible as a result of other macro’s expansion. E.g. if U(x) is defined as x,
    PyObject_TypeCheck(ob, U(f<a,b>(c)))
expands to
    (Py_IS_TYPE(ob, f<a,b>(c)) || ...)
but < and > aren’t treated as brackets by the preprocessor so Py_IS_TYPE is now invoked with 3 arguments instead of just 2, breaking module compilation.

As arguments are expected to be values, surrounding each with parentheses solves the problem. But there are many such macros so that’s not an one-line fix.

Note: the example is from PyGLM (simplified), it doesn’t compile on 3.9 due to this issue.
History
Date User Action Args
2021-02-09 22:05:50numberZerosetrecipients: + numberZero
2021-02-09 22:05:50numberZerosetmessageid: <1612908350.59.0.954965139249.issue43181@roundup.psfhosted.org>
2021-02-09 22:05:50numberZerolinkissue43181 messages
2021-02-09 22:05:50numberZerocreate