mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
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:
parent
e52c31450d
commit
78821ddf8c
7 changed files with 70 additions and 22 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue