mirror of
https://github.com/python/cpython.git
synced 2025-07-15 07:15:18 +00:00
add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this. Patch by Larry Hastings
This commit is contained in:
parent
c679fd8efc
commit
b173f7853e
37 changed files with 943 additions and 149 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue