Where is PyMethod_GET_CLASS in Python 3?
solipsis at pitrou.net
Thu Dec 17 17:11:00 CET 2009
Le Tue, 15 Dec 2009 08:08:01 -0800, Infinity77 a écrit :
> When building C extensions In Python 2.X, there was a magical
> PyMethod_GET_CLASS implemented like this:
> #define PyMethod_GET_CLASS(meth) \
> (((PyMethodObject *)meth) -> im_class)
> It looks like Python 3 has wiped out the "im_class" attribute. Which is
> the alternative was to handle this case in Python 3?
First, is it a bound method? Unbound methods are just function objects in
py3k. Check that PyMethod_Check() returns true.
Second, have you tried Py_TYPE(PyMethod_GET_SELF(meth))?
> BTW, it's very, very,
> *very* hard to find any possible reference to help migrating existing C
> extensions from Python 2.X to Python 3.
You are encouraged to post any suggestions or corrections on the bug
Finally, there's also a dedicated mailing-list for porting to py3k:
While it hasn't seen a lot of activity lately, I'm sure there are people
there willing to answer any questions you have!
More information about the Python-list