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:
Benjamin Peterson 2009-05-05 22:31:58 +00:00
parent c679fd8efc
commit b173f7853e
37 changed files with 943 additions and 149 deletions

View file

@ -2809,7 +2809,7 @@ PyInit__elementtree(void)
#if defined(USE_PYEXPAT_CAPI)
/* link against pyexpat, if possible */
capi = PyCObject_Import("pyexpat", "expat_CAPI");
capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
if (capi &&
strcmp(capi->magic, PyExpat_CAPI_MAGIC) == 0 &&
capi->size <= sizeof(*expat_capi) &&