summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-04 00:41:39 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-04 00:41:39 (GMT)
commitf15a29f975bbdef6de0aa19a19b176d1baf8f5ab (patch)
tree60f4f72289129eaa808e05f2b7c7fb7bde077371 /Objects/moduleobject.c
parentbae5cedb8d41edc20bea54b8bff0c7f835de8043 (diff)
downloadcpython-f15a29f975bbdef6de0aa19a19b176d1baf8f5ab.zip
cpython-f15a29f975bbdef6de0aa19a19b176d1baf8f5ab.tar.gz
cpython-f15a29f975bbdef6de0aa19a19b176d1baf8f5ab.tar.bz2
More coding by random modification.
Encoding now return bytes instead of str8. eval(), exec(), compile() now accept unicode or bytes.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 18914d8..82eabf1 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -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);
}