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 python-dev, serhiy.storchaka, skrah, vstinner
Date 2015-11-06.15:36:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446824217.13.0.320221788905.issue25558@psf.upfronthosting.co.za>
In-reply-to
Content
use_Py_BUILD_ASSERT_EXPR.patch looks good to me. But you should revert the change on decimal, as asked by Stefan, and I suggested to move an assertion inside the related function (see my comment on Rietveld).

"""
A library can follow the example in the comment.

   #define foo_to_char(foo)  \
       ((char *)(foo)        \
        + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
"""

Hum ok, I know understand the "_EXPR" suffix of the macro name. Maybe it's worth to add a new #define Py_BUILD_ASSERT(expr) (void)Py_BUILD_ASSERT_EXPR(expr)" macro?

By the way, I don't know what happens if you pass a variable to Py_BUILD_ASSERT_EXPR() rather than a constant. Maybe we could use __builtin_constant_p() on GCC? Maybe it's overcomplexicated :-)
History
Date User Action Args
2015-11-06 15:36:57vstinnersetrecipients: + vstinner, skrah, python-dev, serhiy.storchaka
2015-11-06 15:36:57vstinnersetmessageid: <1446824217.13.0.320221788905.issue25558@psf.upfronthosting.co.za>
2015-11-06 15:36:57vstinnerlinkissue25558 messages
2015-11-06 15:36:56vstinnercreate