Segfault in Python application with custom GLib.Source
When I run application I sometimes get the following unexpected behaviors:
- Come across with SEGFAULT of application.
- See on console error "AttributeError: 'socket' object has no attribute 'check'"
- See on console error "AttributeError: 'socket' object has no attribute 'prepare'"
My analysis showed that the problem probably lies into pygobject library itself.
I think the problem is in gi/pygi-source.c in functions pyg_source_prepare and pyg_source_check.
When is called
PyObject_CallMethod(pysource->obj, "check", NULL); pysource->obj is expected to be object. But it turns out it's a "socket" which doesn't have these attributes.