Tim Peters <t...@python.org> added the comment:

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? ;-)

----------
nosy: +tim.peters

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

Reply via email to