summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-04-18 20:17:52 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-04-18 20:17:52 (GMT)
commit7abf8d4066e9b4dd21f9a498427ac1ec8914c0ab (patch)
tree354e670eb1de034ee884818039a97f0141544961 /Objects
parent153c70f6d770f69314cc3f95ab240e2d9bcaf959 (diff)
downloadcpython-7abf8d4066e9b4dd21f9a498427ac1ec8914c0ab.zip
cpython-7abf8d4066e9b4dd21f9a498427ac1ec8914c0ab.tar.gz
cpython-7abf8d4066e9b4dd21f9a498427ac1ec8914c0ab.tar.bz2
The SSE2 detection and enabling could potentially cause
problems for binary distributions of Python in situations where the build machine has SSE2 but the target machine does not. Therefore, don't enable SSE2 instructions automatically on x86.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/floatobject.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index b7b5220..f78f7df 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -15,6 +15,11 @@
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
+/* ascii character tests (as opposed to locale tests) */
+#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
+ (c) == '\r' || (c) == '\t' || (c) == '\v')
+#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
+
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
@@ -188,7 +193,7 @@ PyFloat_FromString(PyObject *v)
}
last = s + len;
- while (*s && isspace(Py_CHARMASK(*s)))
+ while (*s && ISSPACE(Py_CHARMASK(*s)))
s++;
if (*s == '\0') {
PyErr_SetString(PyExc_ValueError, "empty string for float()");
@@ -245,7 +250,7 @@ PyFloat_FromString(PyObject *v)
}
/* Since end != s, the platform made *some* kind of sense out
of the input. Trust it. */
- while (*end && isspace(Py_CHARMASK(*end)))
+ while (*end && ISSPACE(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
PyOS_snprintf(buffer, sizeof(buffer),
@@ -1275,7 +1280,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
********************/
/* leading whitespace and optional sign */
- while (isspace(Py_CHARMASK(*s)))
+ while (ISSPACE(Py_CHARMASK(*s)))
s++;
if (*s == '-') {
s++;
@@ -1299,6 +1304,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
s_store = s;
if (*s == '0') {
s++;
+ if (*s == 'x' || *s == 'X')
if (tolower(*s) == (int)'x')
s++;
else
@@ -1345,7 +1351,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
exp = 0;
/* optional trailing whitespace leading to the end of the string */
- while (isspace(Py_CHARMASK(*s)))
+ while (ISSPACE(Py_CHARMASK(*s)))
s++;
if (s != s_end)
goto parse_error;