summaryrefslogtreecommitdiffstats
path: root/Modules/_lsprof.c
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-10 18:11:24 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-10 18:11:24 (GMT)
commitfc55789cae2db09fe190989943b112fbdc0f5423 (patch)
treec62a7461222a10fbde2c5abc552b8dcafd995b30 /Modules/_lsprof.c
parent070ec70cbe8cb118f85789a0fb3d4737c50a54e5 (diff)
downloadcpython-fc55789cae2db09fe190989943b112fbdc0f5423.zip
cpython-fc55789cae2db09fe190989943b112fbdc0f5423.tar.gz
cpython-fc55789cae2db09fe190989943b112fbdc0f5423.tar.bz2
Updated UCD version and unicode.org links to Unicode 6.0.0
Diffstat (limited to 'Modules/_lsprof.c')
-rw-r--r--Modules/_lsprof.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index cc412bf..199c42b 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -176,31 +176,21 @@ normalizeUserObj(PyObject *obj)
if (fn->m_self == NULL) {
/* built-in function: look up the module name */
PyObject *mod = fn->m_module;
- const char *modname;
- if (mod && PyUnicode_Check(mod)) {
- /* XXX: The following will truncate module names with embedded
- * null-characters. It is unlikely that this can happen in
- * practice and the concequences are not serious enough to
- * introduce extra checks here.
- */
- modname = _PyUnicode_AsString(mod);
- if (modname == NULL) {
- modname = "<encoding error>";
- PyErr_Clear();
+ PyObject *modname;
+ if (mod != NULL) {
+ if (PyUnicode_Check(mod)) {
+ modname = mod;
+ Py_INCREF(modname);
}
- }
- else if (mod && PyModule_Check(mod)) {
- modname = PyModule_GetName(mod);
- if (modname == NULL) {
- PyErr_Clear();
- modname = "builtins";
+ else if (PyModule_Check(mod)) {
+ modname = PyModule_GetNameObject(mod);
+ if (modname == NULL)
+ PyErr_Clear();
}
}
- else {
- modname = "builtins";
- }
- if (strcmp(modname, "builtins") != 0)
- return PyUnicode_FromFormat("<%s.%s>",
+ if (modname != NULL &&
+ PyUnicode_CompareWithASCIIString(modname, "builtins") != 0)
+ return PyUnicode_FromFormat("<%U.%s>",
modname,
fn->m_ml->ml_name);
else