Author tim.peters
Recipients Greg Price, Ma Lin, aeros, mark.dickinson, rhettinger, sir-sigurd, tim.peters, vstinner
Date 2019-09-20.06:48:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568962082.83.0.725659771372.issue37812@roundup.psfhosted.org>
In-reply-to
Content
Sorry, but there was nothing wrong with the CHECK_SMALL_INT macro, to my eyes, to begin with - except that it was burdened with an over-elaborate "do ... while(0)" wrapper.

Not all macros are _intended_ to be "cheap functions".  Like this one, some are intended to be merely textual replacement, to minimize tedious and error-prone redundant typing, in a specific file.  Even "bulletproofing them" with tricks like "do ... while(0)" cruft is counterproductive in such cases.  They're not _intended_ to capture abstractions, neither for general use.  This one was intended to check its argument and possibly return, exactly what its expansion did (after mentally tossing out the distracting "do while" noise).

Nobody competent to address logic errors in longobject.c was confused about that in the slightest.  Knowing the details of how small integers may be cached is part of what "competent" means in this context, and what the macro does is so simple it's no burden to learn or to use.

Is there an "aesthetic code cleanup" patch that's ever turned out well? ;-)
History
Date User Action Args
2019-09-20 06:48:02tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, vstinner, Ma Lin, Greg Price, sir-sigurd, aeros
2019-09-20 06:48:02tim.peterssetmessageid: <1568962082.83.0.725659771372.issue37812@roundup.psfhosted.org>
2019-09-20 06:48:02tim.peterslinkissue37812 messages
2019-09-20 06:48:02tim.peterscreate