Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 19343:7257e87e0720 legacy-trunk
Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Fri, 17 Aug 2001 18:39:25 +0000 |
| parents | f20727cc3d0f |
| children | 6c2b7b624ef2 |
line wrap: on
line diff
--- a/Objects/floatobject.c Fri Aug 17 17:36:00 2001 +0000 +++ b/Objects/floatobject.c Fri Aug 17 18:39:25 2001 +0000 @@ -109,7 +109,9 @@ const char *s, *last, *end; double x; char buffer[256]; /* for errors */ +#ifdef Py_USING_UNICODE char s_buffer[256]; /* for objects convertible to a char buffer */ +#endif int len; if (pend) @@ -118,6 +120,7 @@ s = PyString_AS_STRING(v); len = PyString_GET_SIZE(v); } +#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) { PyErr_SetString(PyExc_ValueError, @@ -132,6 +135,7 @@ s = s_buffer; len = (int)strlen(s); } +#endif else if (PyObject_AsCharBuffer(v, &s, &len)) { PyErr_SetString(PyExc_TypeError, "float() needs a string argument");
