Skip to content

Commit 327858e

Browse files
committed
Eliminate outdated usages of PyInt_GetMax.
1 parent d1a1d1e commit 327858e

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

‎Doc/c-api/utilities.rst‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,10 @@ return true, otherwise they return false and raise an appropriate exception.
901901
Convert a C :ctype:`unsigned short int` to a Python integer object.
902902

903903
``I`` (integer/long) [unsigned int]
904-
Convert a C :ctype:`unsigned int` to a Python integer object or a Python long
905-
integer object, if it is larger than ``sys.maxint``.
904+
Convert a C :ctype:`unsigned int` to a Python long integer object.
906905

907906
``k`` (integer/long) [unsigned long]
908-
Convert a C :ctype:`unsigned long` to a Python integer object or a Python long
909-
integer object, if it is larger than ``sys.maxint``.
907+
Convert a C :ctype:`unsigned long` to a Python long integer object.
910908

911909
``L`` (long) [PY_LONG_LONG]
912910
Convert a C :ctype:`long long` to a Python integer object. Only available

‎Python/modsupport.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
316316
{
317317
unsigned int n;
318318
n = va_arg(*p_va, unsigned int);
319-
if (n > (unsigned long)PyInt_GetMax())
320-
return PyLong_FromUnsignedLong((unsigned long)n);
321-
else
322-
return PyLong_FromLong(n);
319+
return PyLong_FromUnsignedLong(n);
323320
}
324321

325322
case 'n':
@@ -334,10 +331,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
334331
{
335332
unsigned long n;
336333
n = va_arg(*p_va, unsigned long);
337-
if (n > (unsigned long)PyInt_GetMax())
338-
return PyLong_FromUnsignedLong(n);
339-
else
340-
return PyLong_FromLong(n);
334+
return PyLong_FromUnsignedLong(n);
341335
}
342336

343337
#ifdef HAVE_LONG_LONG

0 commit comments

Comments
 (0)