summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2010-03-25 00:54:54 (GMT)
committerLarry Hastings <larry@hastings.org>2010-03-25 00:54:54 (GMT)
commit402b73fb8d54ec2b24b52fdd77d389d903fa6c44 (patch)
treeced928b7f7dce754142742e485ed8e836fbc9486 /Objects/unicodeobject.c
parent53ff86ea5f0ed27f5eb5b966faf59dac298d6672 (diff)
downloadcpython-402b73fb8d54ec2b24b52fdd77d389d903fa6c44.zip
cpython-402b73fb8d54ec2b24b52fdd77d389d903fa6c44.tar.gz
cpython-402b73fb8d54ec2b24b52fdd77d389d903fa6c44.tar.bz2
Backported PyCapsule from 3.1, and converted most uses of
CObject to PyCapsule.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 82af3a2..4943413 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2889,16 +2889,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
message = "malformed \\N character escape";
if (ucnhash_CAPI == NULL) {
/* load the unicode data module */
- PyObject *m, *api;
- m = PyImport_ImportModuleNoBlock("unicodedata");
- if (m == NULL)
- goto ucnhashError;
- api = PyObject_GetAttrString(m, "ucnhash_CAPI");
- Py_DECREF(m);
- if (api == NULL)
- goto ucnhashError;
- ucnhash_CAPI = (_PyUnicode_Name_CAPI *)PyCObject_AsVoidPtr(api);
- Py_DECREF(api);
+ ucnhash_CAPI = (_PyUnicode_Name_CAPI *)PyCapsule_Import(PyUnicodeData_CAPSULE_NAME, 1);
if (ucnhash_CAPI == NULL)
goto ucnhashError;
}