Eliminate outdated usages of PyInt_GetMax.

This commit is contained in:
Martin v. Löwis 2007-12-04 22:18:27 +00:00
parent d1a1d1ed80
commit 327858ef2c
2 changed files with 4 additions and 12 deletions

View File

@ -901,12 +901,10 @@ return true, otherwise they return false and raise an appropriate exception.
Convert a C :ctype:`unsigned short int` to a Python integer object. Convert a C :ctype:`unsigned short int` to a Python integer object.
``I`` (integer/long) [unsigned int] ``I`` (integer/long) [unsigned int]
Convert a C :ctype:`unsigned int` to a Python integer object or a Python long Convert a C :ctype:`unsigned int` to a Python long integer object.
integer object, if it is larger than ``sys.maxint``.
``k`` (integer/long) [unsigned long] ``k`` (integer/long) [unsigned long]
Convert a C :ctype:`unsigned long` to a Python integer object or a Python long Convert a C :ctype:`unsigned long` to a Python long integer object.
integer object, if it is larger than ``sys.maxint``.
``L`` (long) [PY_LONG_LONG] ``L`` (long) [PY_LONG_LONG]
Convert a C :ctype:`long long` to a Python integer object. Only available Convert a C :ctype:`long long` to a Python integer object. Only available

View File

@ -316,10 +316,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
{ {
unsigned int n; unsigned int n;
n = va_arg(*p_va, unsigned int); n = va_arg(*p_va, unsigned int);
if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong(n);
return PyLong_FromUnsignedLong((unsigned long)n);
else
return PyLong_FromLong(n);
} }
case 'n': case 'n':
@ -334,10 +331,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
{ {
unsigned long n; unsigned long n;
n = va_arg(*p_va, unsigned long); n = va_arg(*p_va, unsigned long);
if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong(n);
return PyLong_FromUnsignedLong(n);
else
return PyLong_FromLong(n);
} }
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG