summaryrefslogtreecommitdiff
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-10 18:11:24 +0000
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-10 18:11:24 +0000
commitfc55789cae2db09fe190989943b112fbdc0f5423 (patch)
treec62a7461222a10fbde2c5abc552b8dcafd995b30 /Objects/moduleobject.c
parent070ec70cbe8cb118f85789a0fb3d4737c50a54e5 (diff)
downloadcpython-git-fc55789cae2db09fe190989943b112fbdc0f5423.tar.gz
Updated UCD version and unicode.org links to Unicode 6.0.0
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 2c095a0968..8b22b7dc95 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -168,8 +168,8 @@ PyModule_GetDict(PyObject *m)
return d;
}
-const char *
-PyModule_GetName(PyObject *m)
+PyObject *
+PyModule_GetNameObject(PyObject *m)
{
PyObject *d;
PyObject *nameobj;
@@ -185,7 +185,21 @@ PyModule_GetName(PyObject *m)
PyErr_SetString(PyExc_SystemError, "nameless module");
return NULL;
}
- return _PyUnicode_AsString(nameobj);
+ Py_INCREF(nameobj);
+ return nameobj;
+}
+
+const char *
+PyModule_GetName(PyObject *m)
+{
+ PyObject *nameobj;
+ char *utf8;
+ nameobj = PyModule_GetNameObject(m);
+ if (nameobj == NULL)
+ return NULL;
+ utf8 = _PyUnicode_AsString(nameobj);
+ Py_DECREF(nameobj);
+ return utf8;
}
PyObject*