Mercurial > cpython-lru_cache-weakref
diff Objects/complexobject.c @ 42855:d5b52d56beba
Use unicode and remove support for some uses of str8.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 26 Aug 2007 04:51:10 +0000 |
| parents | e7fd327e0c19 |
| children | 0ff41b163f5b |
line wrap: on
line diff
--- a/Objects/complexobject.c Sun Aug 26 04:19:43 2007 +0000 +++ b/Objects/complexobject.c Sun Aug 26 04:51:10 2007 +0000 @@ -649,11 +649,7 @@ char s_buffer[256]; Py_ssize_t len; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); - } - else if (PyUnicode_Check(v)) { + if (PyUnicode_Check(v)) { if (PyUnicode_GET_SIZE(v) >= (Py_ssize_t)sizeof(s_buffer)) { PyErr_SetString(PyExc_ValueError, "complex() literal too large to convert"); @@ -833,7 +829,7 @@ Py_INCREF(r); return r; } - if (PyString_Check(r) || PyUnicode_Check(r)) { + if (PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -842,7 +838,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && PyUnicode_Check(i)) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL;
