Skip to content

Commit f766421

Browse files
committed
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. ........
1 parent e2d37c1 commit f766421

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

Objects/complexobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,13 +767,13 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
767767

768768
/* position on first nonblank */
769769
start = s;
770-
while (*s && isspace(Py_CHARMASK(*s)))
770+
while (Py_ISSPACE(*s))
771771
s++;
772772
if (*s == '(') {
773773
/* Skip over possible bracket from repr(). */
774774
got_bracket = 1;
775775
s++;
776-
while (*s && isspace(Py_CHARMASK(*s)))
776+
while (Py_ISSPACE(*s))
777777
s++;
778778
}
779779

@@ -856,15 +856,15 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
856856
}
857857

858858
/* trailing whitespace and closing bracket */
859-
while (*s && isspace(Py_CHARMASK(*s)))
859+
while (Py_ISSPACE(*s))
860860
s++;
861861
if (got_bracket) {
862862
/* if there was an opening parenthesis, then the corresponding
863863
closing parenthesis should be right here */
864864
if (*s != ')')
865865
goto parse_error;
866866
s++;
867-
while (*s && isspace(Py_CHARMASK(*s)))
867+
while (Py_ISSPACE(*s))
868868
s++;
869869
}
870870

Objects/floatobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ PyFloat_FromString(PyObject *v)
188188
}
189189
last = s + len;
190190

191-
while (*s && isspace(Py_CHARMASK(*s)))
191+
while (Py_ISSPACE(*s))
192192
s++;
193193
/* We don't care about overflow or underflow. If the platform
194194
* supports them, infinities and signed zeroes (on underflow) are
195195
* fine. */
196196
x = PyOS_string_to_double(s, (char **)&end, NULL);
197197
if (x == -1.0 && PyErr_Occurred())
198198
goto error;
199-
while (*end && isspace(Py_CHARMASK(*end)))
199+
while (Py_ISSPACE(*end))
200200
end++;
201201
if (end == last)
202202
result = PyFloat_FromDouble(x);
@@ -1223,7 +1223,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
12231223
********************/
12241224

12251225
/* leading whitespace and optional sign */
1226-
while (isspace(Py_CHARMASK(*s)))
1226+
while (Py_ISSPACE(*s))
12271227
s++;
12281228
if (*s == '-') {
12291229
s++;
@@ -1247,7 +1247,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
12471247
s_store = s;
12481248
if (*s == '0') {
12491249
s++;
1250-
if (tolower(*s) == (int)'x')
1250+
if (*s == 'x' || *s == 'X')
12511251
s++;
12521252
else
12531253
s = s_store;
@@ -1277,7 +1277,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
12771277
goto insane_length_error;
12781278

12791279
/* [p <exponent>] */
1280-
if (tolower(*s) == (int)'p') {
1280+
if (*s == 'p' || *s == 'P') {
12811281
s++;
12821282
exp_start = s;
12831283
if (*s == '-' || *s == '+')
@@ -1293,7 +1293,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
12931293
exp = 0;
12941294

12951295
/* optional trailing whitespace leading to the end of the string */
1296-
while (isspace(Py_CHARMASK(*s)))
1296+
while (Py_ISSPACE(*s))
12971297
s++;
12981298
if (s != s_end)
12991299
goto parse_error;

0 commit comments

Comments
 (0)