Re: [LAU] Python3 PyAlsa Build fails

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Wednesday, March 20, 2013 - 8:59 am

On Wed, March 20, 2013 7:31 pm, Christoph Kuhr wrote:

Probably not. The struct is defined at line 54.

http://python3porting.com/cextensions.html

++++
Another change in the object header is that the PyObject_HEAD macro has
changed so that ob_type is now in a nested structure. This means you no
longer can pick the ob_type directly from the struct, so code like
ob->ob_type stops working. You should replace this with Py_TYPE(ob). The
Py_TYPE macro doesn’t appear until Python 2.6, so to support earlier
versions we make another #ifndef:

#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif

In both cases the definitions above are taken directly from the Python 2.6
headers, where they are defined for forward compatibility purposes with
Python 3. They work well in earlier Python versions as well, so this is a
trick you can use as a general rule; if you need to use a macro that is
defined in Python 3 and Python 2.6, just steal the Python 2.6 or Python
2.7 definition and put it inside an #ifndef.
++++

You should be able to add the following above line 54 and it will compile.

#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif

--
Patrick Shirkey
Boost Hardware Ltd
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] Python3 PyAlsa Build fails, Christoph Kuhr, (Wed Mar 20, 8:31 am)
Re: [LAU] Python3 PyAlsa Build fails, Patrick Shirkey, (Wed Mar 20, 8:59 am)