[Python-checkins] r43667 - in python/trunk: Include/pyport.h Objects/longobject.c

martin.v.loewis python-checkins at python.org
Wed Apr 5 20:21:19 CEST 2006


Author: martin.v.loewis
Date: Wed Apr  5 20:21:17 2006
New Revision: 43667

Modified:
   python/trunk/Include/pyport.h
   python/trunk/Objects/longobject.c
Log:
Add PY_SSIZE_T_MIN, as suggested by Ralf W. Grosse-Kunstleve.


Modified: python/trunk/Include/pyport.h
==============================================================================
--- python/trunk/Include/pyport.h	(original)
+++ python/trunk/Include/pyport.h	Wed Apr  5 20:21:17 2006
@@ -99,6 +99,8 @@
 
 /* Largest positive value of type Py_ssize_t. */
 #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))
+/* Smallest positive value of type Py_ssize_t. */
+#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
 
 /* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
  * format to convert an argument with the width of a size_t or Py_ssize_t.

Modified: python/trunk/Objects/longobject.c
==============================================================================
--- python/trunk/Objects/longobject.c	(original)
+++ python/trunk/Objects/longobject.c	Wed Apr  5 20:21:17 2006
@@ -281,7 +281,7 @@
 	if (sign > 0) 
 		return PY_SSIZE_T_MAX;
 	else 
-		return -PY_SSIZE_T_MAX-1;
+		return PY_SSIZE_T_MIN;
 }
 
 /* Get a Py_ssize_t from a long int object.


More information about the Python-checkins mailing list