Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 53816:911df82bc25d
add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.
Patch by Larry Hastings
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 05 May 2009 22:31:58 +0000 |
| parents | 33bbdd3eea43 |
| children | 7c29bfbfd352 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Tue May 05 22:14:50 2009 +0000 +++ b/Objects/unicodeobject.c Tue May 05 22:31:58 2009 +0000 @@ -3381,16 +3381,7 @@ 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; }
