[Python-checkins] r45644 - in python/trunk: Modules/_codecsmodule.c Modules/_hotshot.c Objects/classobject.c Python/ast.c Python/ceval.c Python/codecs.c

martin.v.loewis python-checkins at python.org
Sat Apr 22 13:40:05 CEST 2006


Author: martin.v.loewis
Date: Sat Apr 22 13:40:03 2006
New Revision: 45644

Modified:
   python/trunk/Modules/_codecsmodule.c
   python/trunk/Modules/_hotshot.c
   python/trunk/Objects/classobject.c
   python/trunk/Python/ast.c
   python/trunk/Python/ceval.c
   python/trunk/Python/codecs.c
Log:
Fix more ssize_t issues.

Modified: python/trunk/Modules/_codecsmodule.c
==============================================================================
--- python/trunk/Modules/_codecsmodule.c	(original)
+++ python/trunk/Modules/_codecsmodule.c	Sat Apr 22 13:40:03 2006
@@ -169,7 +169,7 @@
 
 static
 PyObject *codec_tuple(PyObject *unicode,
-		      int len)
+		      Py_ssize_t len)
 {
     PyObject *v,*w;
 
@@ -181,7 +181,7 @@
 	return NULL;
     }
     PyTuple_SET_ITEM(v,0,unicode);
-    w = PyInt_FromLong(len);
+    w = PyInt_FromSsize_t(len);
     if (w == NULL) {
 	Py_DECREF(v);
 	return NULL;
@@ -213,7 +213,7 @@
 	PyObject *str;
 	const char *errors = NULL;
 	char *buf;
-	int len;
+	Py_ssize_t len;
 
 	if (!PyArg_ParseTuple(args, "O!|z:escape_encode",
 			      &PyString_Type, &str, &errors))

Modified: python/trunk/Modules/_hotshot.c
==============================================================================
--- python/trunk/Modules/_hotshot.c	(original)
+++ python/trunk/Modules/_hotshot.c	Sat Apr 22 13:40:03 2006
@@ -1420,7 +1420,7 @@
     char *buffer;
     char cwdbuffer[PATH_MAX];
     PyObject *temp;
-    int i, len;
+    Py_ssize_t i, len;
 
     buffer = get_version_string();
     if (buffer == NULL) {

Modified: python/trunk/Objects/classobject.c
==============================================================================
--- python/trunk/Objects/classobject.c	(original)
+++ python/trunk/Objects/classobject.c	Sat Apr 22 13:40:03 2006
@@ -320,7 +320,7 @@
 	}
 	sname = PyString_AsString(name);
 	if (sname[0] == '_' && sname[1] == '_') {
-		int n = PyString_Size(name);
+		Py_ssize_t n = PyString_Size(name);
 		if (sname[n-1] == '_' && sname[n-2] == '_') {
 			char *err = NULL;
 			if (strcmp(sname, "__dict__") == 0)
@@ -380,7 +380,7 @@
 	PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__");
 	PyObject *name = op->cl_name;
 	PyObject *res;
-	int m, n;
+	Py_ssize_t m, n;
 
 	if (name == NULL || !PyString_Check(name))
 		return class_repr(op);
@@ -638,7 +638,7 @@
 		PyObject_GC_Del(inst);
 	}
 	else {
-		int refcnt = inst->ob_refcnt;
+		Py_ssize_t refcnt = inst->ob_refcnt;
 		/* __del__ resurrected it!  Make it look like the original
 		 * Py_DECREF never happened.
 		 */
@@ -778,7 +778,7 @@
 	PyObject *func, *args, *res, *tmp;
 	char *sname = PyString_AsString(name);
 	if (sname[0] == '_' && sname[1] == '_') {
-		int n = PyString_Size(name);
+		Py_ssize_t n = PyString_Size(name);
 		if (sname[n-1] == '_' && sname[n-2] == '_') {
 			if (strcmp(sname, "__dict__") == 0) {
 				if (PyEval_GetRestricted()) {
@@ -1263,7 +1263,7 @@
 		 */
 		PyErr_Clear();
 		return _PySequence_IterSearch((PyObject *)inst, member,
-					      PY_ITERSEARCH_CONTAINS);
+					      PY_ITERSEARCH_CONTAINS) > 0;
 	}
 	else
 		return -1;

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Sat Apr 22 13:40:03 2006
@@ -3034,7 +3034,7 @@
 			if (*s & 0x80) { /* XXX inefficient */
 				PyObject *w;
 				char *r;
-				int rn, i;
+				Py_ssize_t rn, i;
 				w = decode_utf8(&s, end, "utf-16-be");
 				if (w == NULL) {
 					Py_DECREF(u);

Modified: python/trunk/Python/ceval.c
==============================================================================
--- python/trunk/Python/ceval.c	(original)
+++ python/trunk/Python/ceval.c	Sat Apr 22 13:40:03 2006
@@ -1560,7 +1560,7 @@
 			    /* XXX move into writeobject() ? */
 			    if (PyString_Check(v)) {
 				char *s = PyString_AS_STRING(v);
-				int len = PyString_GET_SIZE(v);
+				Py_ssize_t len = PyString_GET_SIZE(v);
 				if (len == 0 ||
 				    !isspace(Py_CHARMASK(s[len-1])) ||
 				    s[len-1] == ' ')
@@ -1569,7 +1569,7 @@
 #ifdef Py_USING_UNICODE
 			    else if (PyUnicode_Check(v)) {
 				Py_UNICODE *s = PyUnicode_AS_UNICODE(v);
-				int len = PyUnicode_GET_SIZE(v);
+				Py_ssize_t len = PyUnicode_GET_SIZE(v);
 				if (len == 0 ||
 				    !Py_UNICODE_ISSPACE(s[len-1]) ||
 				    s[len-1] == ' ')

Modified: python/trunk/Python/codecs.c
==============================================================================
--- python/trunk/Python/codecs.c	(original)
+++ python/trunk/Python/codecs.c	Sat Apr 22 13:40:03 2006
@@ -95,7 +95,7 @@
 {
     PyInterpreterState *interp;
     PyObject *result, *args = NULL, *v;
-    int i, len;
+    Py_ssize_t i, len;
 
     if (encoding == NULL) {
 	PyErr_BadArgument();


More information about the Python-checkins mailing list