Index: Modules/_struct.c =================================================================== --- Modules/_struct.c (revision 67702) +++ Modules/_struct.c (working copy) @@ -645,7 +645,7 @@ return -1; #if (SIZEOF_LONG > SIZEOF_INT) if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX))) - return _range_error(f, 0); + RANGE_ERROR(x, f, 0, -1); #endif y = (int)x; memcpy(p, (char *)&y, sizeof y); @@ -657,12 +657,12 @@ { unsigned long x; unsigned int y; - if (get_ulong(v, &x) < 0) - return _range_error(f, 1); + if (get_wrapped_ulong(v, &x) < 0) + return -1; y = (unsigned int)x; #if (SIZEOF_LONG > SIZEOF_INT) if (x > ((unsigned long)UINT_MAX)) - return _range_error(f, 1); + RANGE_ERROR(y, f, 1, -1); #endif memcpy(p, (char *)&y, sizeof y); return 0; @@ -682,8 +682,8 @@ np_ulong(char *p, PyObject *v, const formatdef *f) { unsigned long x; - if (get_ulong(v, &x) < 0) - return _range_error(f, 1); + if (get_wrapped_ulong(v, &x) < 0) + return -1; memcpy(p, (char *)&x, sizeof x); return 0; }