Message284709
https://docs.python.org/2.7/extending/newtypes.html#the-basics uses PyObject_HEAD_INIT for type object header.
static PyTypeObject noddy_NoddyType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
This code isn't compatible with Python 3. In Python 3, PyVarObject_HEAD_INIT is used instead.
https://docs.python.org/3.6/extending/newtypes.html#the-basics
static PyTypeObject noddy_NoddyType = {
PyVarObject_HEAD_INIT(NULL, 0)
This code is compatible with Python 2.
This example code can be copy and pasted when creating new extension.
If people start writing Python 2 extension, and forward port it to Python 3,
this small incompatibility cause compile error.
Let's use more forward compatible and short code for example. |
|
Date |
User |
Action |
Args |
2017-01-05 06:47:59 | methane | set | recipients:
+ methane, docs@python |
2017-01-05 06:47:59 | methane | set | messageid: <1483598879.57.0.52341008423.issue29165@psf.upfronthosting.co.za> |
2017-01-05 06:47:59 | methane | link | issue29165 messages |
2017-01-05 06:47:59 | methane | create | |
|