diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-05 22:31:58 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-05 22:31:58 (GMT) |
commit | b173f7853e4e3a4215a661d98174291e379cf6fb (patch) | |
tree | 02735987f20fc27277a82c14c5da5e043cc134aa /Objects/unicodeobject.c | |
parent | c679fd8efcae2b5d1117fc09380d74f0000086b0 (diff) | |
download | cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.zip cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.tar.gz cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.tar.bz2 |
add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.
Patch by Larry Hastings
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fc5c1c5..3740892 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3381,16 +3381,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; } |