Comment 39 for bug 893091

Revision history for this message
In , Steven Johnson (sjohnson) wrote :

(In reply to comment #31)
> (In reply to comment #30)

> After some research I came to learn PyCObject is deprecated in 2.7 and removed
> in 3.2 in favour of PyCapsule (as its C code it can probably be fixed with
> #if's, but its getting messy). I am just trying to learn what the changes
> actually entail now.

I tried the following in module.c:

#if (PY_MAJOR_VERSION > 3) || ((PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION >= 2))
    c_api = PyCapsule_New((void *)dbus_bindings_API, "dbus._C_API", NULL);
#else
    c_api = PyCObject_FromVoidPtr ((void *)dbus_bindings_API, NULL);
#endif

it gets me further:

>>> import dbus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/Python-3.2a3/lib/python3.2/site-packages/dbus/__init__.py", line 78, in <module>
    import dbus.exceptions as exceptions
AttributeError: 'module' object has no attribute 'exceptions'

After several hours I haven't been able to work this one out, so at this stage getting d-bus python to work on 3.2a3 has defeated me :( Im happy to recut my patch using the construct given above instead of as, but without solving this issue it seems a moot point. Unless the line is drawn as 3.1? Personally as python "language" is stable between 3.1 and 3.2 I think there will be an expectation that stuff that works on 3.1 should also work on 3.2, even though the C api's have changed.