mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +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
|
@ -72,8 +72,11 @@ PyModule_GetName(PyObject *m)
|
|||
PyErr_SetString(PyExc_SystemError, "nameless module");
|
||||
return NULL;
|
||||
}
|
||||
if (PyUnicode_Check(nameobj))
|
||||
nameobj = _PyUnicode_AsDefaultEncodedString(nameobj, "replace");
|
||||
if (PyUnicode_Check(nameobj)) {
|
||||
nameobj = _PyUnicode_AsDefaultEncodedString(nameobj, NULL);
|
||||
if (nameobj == NULL)
|
||||
return NULL;
|
||||
}
|
||||
return PyString_AsString(nameobj);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue