mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
More coding by random modification.
Encoding now return bytes instead of str8. eval(), exec(), compile() now accept unicode or bytes.
This commit is contained in:
parent
bae5cedb8d
commit
f15a29f975
12 changed files with 185 additions and 155 deletions
|
@ -3181,9 +3181,9 @@ string_encode(PyStringObject *self, PyObject *args)
|
|||
v = PyString_AsEncodedObject((PyObject *)self, encoding, errors);
|
||||
if (v == NULL)
|
||||
goto onError;
|
||||
if (!PyString_Check(v) && !PyUnicode_Check(v)) {
|
||||
if (!PyBytes_Check(v)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"encoder did not return a string/unicode object "
|
||||
"[str8] encoder did not return a bytes object "
|
||||
"(type=%.400s)",
|
||||
v->ob_type->tp_name);
|
||||
Py_DECREF(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue