[Python-checkins] r63498 - in python/trunk: Doc/library/sys.rst Misc/NEWS Python/sysmodule.c

martin.v.loewis python-checkins at python.org
Tue May 20 10:11:19 CEST 2008


Author: martin.v.loewis
Date: Tue May 20 10:11:19 2008
New Revision: 63498

Log:
Patch #2488: Add sys.maxsize.


Modified:
   python/trunk/Doc/library/sys.rst
   python/trunk/Misc/NEWS
   python/trunk/Python/sysmodule.c

Modified: python/trunk/Doc/library/sys.rst
==============================================================================
--- python/trunk/Doc/library/sys.rst	(original)
+++ python/trunk/Doc/library/sys.rst	Tue May 20 10:11:19 2008
@@ -521,6 +521,11 @@
    is at least 2\*\*31-1.  The largest negative integer is ``-maxint-1`` --- the
    asymmetry results from the use of 2's complement binary arithmetic.
 
+.. data:: maxsize
+
+   The largest positive integer supported by the platform's Py_ssize_t type,
+   and thus the maximum size lists, strings, dicts, and many other containers
+   can have.
 
 .. data:: maxunicode
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue May 20 10:11:19 2008
@@ -12,6 +12,8 @@
 Core and Builtins
 -----------------
 
+- Patch #2488: Add sys.maxsize.
+
 - Issue #2353: file.xreadlines() now emits a Py3k warning.
 
 - Issue #2863: generators now have a ``gen.__name__`` attribute that

Modified: python/trunk/Python/sysmodule.c
==============================================================================
--- python/trunk/Python/sysmodule.c	(original)
+++ python/trunk/Python/sysmodule.c	Tue May 20 10:11:19 2008
@@ -992,6 +992,7 @@
 Static objects:\n\
 \n\
 maxint -- the largest supported integer (the smallest is -maxint-1)\n\
+maxsize -- the largest supported length of containers.\n\
 maxunicode -- the largest supported character\n\
 builtin_module_names -- tuple of module names built into this interpreter\n\
 version -- the version of this interpreter as a string\n\
@@ -1345,6 +1346,8 @@
 			    PyString_FromString(Py_GetPrefix()));
 	SET_SYS_FROM_STRING("exec_prefix",
 		   	    PyString_FromString(Py_GetExecPrefix()));
+	SET_SYS_FROM_STRING("maxsize",
+			    PyInt_FromSsize_t(PY_SSIZE_T_MAX));
 	SET_SYS_FROM_STRING("maxint",
 			    PyInt_FromLong(PyInt_GetMax()));
 	SET_SYS_FROM_STRING("py3kwarning",


More information about the Python-checkins mailing list