GNOME Bugzilla – Bug 789972
python module fails to load with python 3.6
Last modified: 2017-11-06 15:40:33 UTC
$ python3.6 Python 3.6.3 (default, Oct 27 2017, 17:16:29) [GCC 5.4.0] on netbsd8 Type "help", "copyright", "credits" or "license" for more information. >>> import libxml2 Traceback (most recent call last):
+ Trace 238145
import libxml2mod
>>> Not surprising that PyCObject_Check isn't found. It is introduced in libxml2/python/libxml_wrap.h: #ifndef PyCapsule_New #define PyCapsule_New PyCObject_FromVoidPtrAndDesc #define PyCapsule_CheckExact PyCObject_Check #define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o)) #endif In Python-3.6.3/Include/pycapsule.h: PyAPI_FUNC(PyObject *) PyCapsule_New( void *pointer, const char *name, PyCapsule_Destructor destructor); so as far as I can tell, PyCapsule_New is a real function, and not a macro, so #ifndef PyCapsule_New will fire. Also: #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) so PyCapsule_CheckExact, which exists, then gets redefined by libxml_wrap.h to PyCapsule_Check which doesn't, which results in that symbol not being find when trying to load libxml2.
The source for libxml2 git master I was using wasn't pristine.
I now hit bug #776815 with python 3.6.3 and libxml2-2.9.7