Message 170977 - Python tracker
Victor, the danger of this approach is that we can't verify that a particular compiler with certain options on a specific platform compiles the source code with undefined behavior in a certain way. If such a test were possible, if this aspect was guaranteed by the compiler manufacturer, or could be checked in the ./configure script, then such an approach would have some meaning. Regardless of _PyLong_IS_SMALL_INT, the rest of patch looks a little cumbersome.