bpo-35091: Objects/listobject.c: Don't rely on signed int overflow in… by izbyshev · Pull Request #10175 · python/cpython

Conversation

… gallop functions

Signed integer overflow is undefined behavior.

@serhiy-storchaka

Other option is using unsigned integers. In this case additional checks could be removed. The check in the while condition would be enough.

@izbyshev

@serhiy-storchaka If it's OK to change types of several variables in affected functions (because if only ofs is changed, we'd need to add casts all over the place to avoid signed/unsigned comparison warnings), I'll update the patch.

@serhiy-storchaka

Added @tim-one, the author of this code.

@izbyshev

@csabella

Labels