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 vstinner
Recipients Aaron Hall, benjamin.peterson, eric.snow, mark.dickinson, miss-islington, pablogsal, serhiy.storchaka, thatiparthy, vstinner
Date 2018-11-23.15:14:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542986089.51.0.788709270274.issue35059@psf.upfronthosting.co.za>
In-reply-to
Content
> Drawbacks: Require a specific type can introduce compiler warnings if the caller doesn't pass the proper type (PyObject* or PyVarObject*). _Py_NewReference() and _Py_ForgetReference() seem to be properly used, but not PyObject_INIT() and PyObject_INIT_VAR().

I worked around this issue by adding a macro to cast the argument and declare the static inline function with a different name. Example:

static inline void _Py_INCREF(PyObject *op)
{
    _Py_INC_REFTOTAL;
    op->ob_refcnt++;
}

#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
History
Date User Action Args
2018-11-23 15:14:49vstinnersetrecipients: + vstinner, mark.dickinson, benjamin.peterson, eric.snow, serhiy.storchaka, thatiparthy, Aaron Hall, pablogsal, miss-islington
2018-11-23 15:14:49vstinnersetmessageid: <1542986089.51.0.788709270274.issue35059@psf.upfronthosting.co.za>
2018-11-23 15:14:49vstinnerlinkissue35059 messages
2018-11-23 15:14:49vstinnercreate