Comment 44 for bug 893091

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

(In reply to comment #34)
> (In reply to comment #33)
> > (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
>
> This is sort of correct. See my patch for PyCairo -
> https://bugs.freedesktop.org/show_bug.cgi?id=30289
>
> BTW you can apply PyCapsule to 3.0 and above since 3.0 will never be supported,
> and 3.1 introduced the API.

Wouldn't it be better therefore to just make this change for >= 3.1. Even though 3.0 isn't supported is it really necessary to break it knowingly?

>
> > 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'
> >
[...]
>
> It needs to work on 3.2 since that is what we will ship in Fedora 15 in approx
> 6-8 months.
Nice.

> Thanks for the extra work on this. Is there an exceptions.py in
> /opt/Python-3.2a3/lib/python3.2/site-packages/dbus/? Sounds like a path issue
> to me.

ls /opt/Python-3.2a3/lib/python3.2/site-packages/dbus/exceptions.p*

/opt/Python-3.2a3/lib/python3.2/site-packages/dbus/exceptions.py
/opt/Python-3.2a3/lib/python3.2/site-packages/dbus/exceptions.pyo
/opt/Python-3.2a3/lib/python3.2/site-packages/dbus/exceptions.pyc

The error was making me think I needed to tell the module about exceptions in the c api somehow, but as I said I couldn't find anything on it or even a good reference for the error.

> Do you have commit access? Can you commit your patches (with the "as"
> issue fixed) to the py3k branch?

No, i don't have commit access as far as I know. I can post a revised patch later today however.