[Python-checkins] r72255 - in python/branches/py3k: Objects/complexobject.c Objects/floatobject.c

mark.dickinson python-checkins at python.org
Sun May 3 23:07:14 CEST 2009


Author: mark.dickinson
Date: Sun May  3 23:07:13 2009
New Revision: 72255

Log:
Merged revisions 72253 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72253 | mark.dickinson | 2009-05-03 21:59:48 +0100 (Sun, 03 May 2009) | 2 lines
  
  Eliminate some locale-dependent calls to isspace and tolower.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Objects/complexobject.c
   python/branches/py3k/Objects/floatobject.c

Modified: python/branches/py3k/Objects/complexobject.c
==============================================================================
--- python/branches/py3k/Objects/complexobject.c	(original)
+++ python/branches/py3k/Objects/complexobject.c	Sun May  3 23:07:13 2009
@@ -767,13 +767,13 @@
 
 	/* position on first nonblank */
 	start = s;
-	while (*s && isspace(Py_CHARMASK(*s)))
+	while (Py_ISSPACE(*s))
 		s++;
 	if (*s == '(') {
 		/* Skip over possible bracket from repr(). */
 		got_bracket = 1;
 		s++;
-		while (*s && isspace(Py_CHARMASK(*s)))
+		while (Py_ISSPACE(*s))
 			s++;
 	}
 
@@ -856,7 +856,7 @@
 	}
 
 	/* trailing whitespace and closing bracket */
-	while (*s && isspace(Py_CHARMASK(*s)))
+	while (Py_ISSPACE(*s))
 		s++;
 	if (got_bracket) {
 		/* if there was an opening parenthesis, then the corresponding
@@ -864,7 +864,7 @@
 		if (*s != ')')
 			goto parse_error;
 		s++;
-		while (*s && isspace(Py_CHARMASK(*s)))
+		while (Py_ISSPACE(*s))
 			s++;
 	}
 

Modified: python/branches/py3k/Objects/floatobject.c
==============================================================================
--- python/branches/py3k/Objects/floatobject.c	(original)
+++ python/branches/py3k/Objects/floatobject.c	Sun May  3 23:07:13 2009
@@ -188,7 +188,7 @@
 	}
 	last = s + len;
 
-	while (*s && isspace(Py_CHARMASK(*s)))
+	while (Py_ISSPACE(*s))
 		s++;
 	/* We don't care about overflow or underflow.  If the platform
 	 * supports them, infinities and signed zeroes (on underflow) are
@@ -196,7 +196,7 @@
 	x = PyOS_string_to_double(s, (char **)&end, NULL);
 	if (x == -1.0 && PyErr_Occurred())
 		goto error;
-	while (*end && isspace(Py_CHARMASK(*end)))
+	while (Py_ISSPACE(*end))
 		end++;
 	if (end == last)
 		result = PyFloat_FromDouble(x);
@@ -1223,7 +1223,7 @@
 	 ********************/
 
 	/* leading whitespace and optional sign */
-	while (isspace(Py_CHARMASK(*s)))
+	while (Py_ISSPACE(*s))
 		s++;
 	if (*s == '-') {
 		s++;
@@ -1247,7 +1247,7 @@
 	s_store = s;
 	if (*s == '0') {
 		s++;
-		if (tolower(*s) == (int)'x')
+		if (*s == 'x' || *s == 'X')
 			s++;
 		else
 			s = s_store;
@@ -1277,7 +1277,7 @@
 		goto insane_length_error;
 
 	/* [p <exponent>] */
-	if (tolower(*s) == (int)'p') {
+	if (*s == 'p' || *s == 'P') {
 		s++;
 		exp_start = s;
 		if (*s == '-' || *s == '+')
@@ -1293,7 +1293,7 @@
 		exp = 0;
 
 	/* optional trailing whitespace leading to the end of the string */
-	while (isspace(Py_CHARMASK(*s)))
+	while (Py_ISSPACE(*s))
 		s++;
 	if (s != s_end)
 		goto parse_error;


More information about the Python-checkins mailing list