For base 10, cast unsigned long to long before testing overflow.
This prevents 4294967296 from being an acceptable way to spell zero!
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 6f8e9bd..46c52b8 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -128,8 +128,14 @@
temp = result;
result = result * base + c;
#ifndef MPW
- if ((result - c) / base != temp) /* overflow */
- ovf = 1;
+ if(base == 10) {
+ if(((long)(result - c) / base != temp)) /* overflow */
+ ovf = 1;
+ }
+ else {
+ if ((result - c) / base != temp) /* overflow */
+ ovf = 1;
+ }
#endif
str++;
}