fix building the core with --disable-unicode

I changed some bytearray methods to use strings instead of unicode like bytes_repr
Also, bytearray.fromhex() can take strings as well as unicode
This commit is contained in:
Benjamin Peterson 2009-01-25 17:15:10 +00:00
parent e52c31450d
commit 78821ddf8c
7 changed files with 70 additions and 22 deletions

View file

@ -3418,9 +3418,13 @@ object_format(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
return NULL;
#ifdef Py_USING_UNICODE
if (PyUnicode_Check(format_spec)) {
self_as_str = PyObject_Unicode(self);
} else if (PyString_Check(format_spec)) {
#else
if (PyString_Check(format_spec)) {
#endif
self_as_str = PyObject_Str(self);
} else {
PyErr_SetString(PyExc_TypeError, "argument to __format__ must be unicode or str");