[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

Greg Price report at bugs.python.org
Wed Sep 18 01:06:47 EDT 2019


Greg Price <gnprice at gmail.com> added the comment:

> if using a static inline function is causing issues

Separately from whether there was or wasn't such an issue here, I think it's interesting to note that the build failure bpo-38205 is an example of exactly the opposite!  It was caused by a combination of
(a) using a macro *instead* of a plain old C function;
(b) using avoidable preprocessor conditionals.

And both of them led to that build failure in classic ways.

Specifically, the build failure happened because

(a) this `Py_UNREACHABLE` call was in an unusual syntactic context, squished into an expression, in order to use it in a macro.

(b) the call was behind an `#ifdef`/`#else`; and the configuration that included it wasn't one that got test-built by the authors of 3ab61473b (which modified `Py_UNREACHABLE`), nor by CI.

When conditional preprocessing is kept to a minimum -- here, if the `#if NSMALLNEGINTS + NSMALLPOSINTS > 0` conditional enclosed just the `small_ints` array that it needs to -- then this kind of build regression on non-default configurations can't so easily happen.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37812>
_______________________________________


More information about the Python-bugs-list mailing list