This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients docs@python, methane, serhiy.storchaka
Date 2017-02-21.09:59:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487671165.01.0.676776346187.issue29165@psf.upfronthosting.co.za>
In-reply-to
Content
> but the code with PyObject_HEAD_INIT() doesn't look incompatible with Python 3.

It's incompatible actually.

https://github.com/python/cpython/blob/2.7/Include/object.h

/* PyObject_HEAD defines the initial segment of every PyObject. */

#define PyObject_HEAD_INIT(type)        \
    _PyObject_EXTRA_INIT                \
    1, type,


https://github.com/python/cpython/blob/3.5/Include/object.h

#define PyObject_HEAD_INIT(type)        \
    { _PyObject_EXTRA_INIT              \
    1, type },


I noticed PyVarObject_HEAD_INIT is compatible, and simplified an extension I maintain.
https://github.com/PyMySQL/mysqlclient-python/commit/2feb5ed6850a3905edf0333e0cd11ea6218f0f4f


This small doc change helps people who writing Python 2's extension module now, and port it to Python 3 later.
History
Date User Action Args
2017-02-21 09:59:25methanesetrecipients: + methane, docs@python, serhiy.storchaka
2017-02-21 09:59:25methanesetmessageid: <1487671165.01.0.676776346187.issue29165@psf.upfronthosting.co.za>
2017-02-21 09:59:24methanelinkissue29165 messages
2017-02-21 09:59:24methanecreate