[Python-Dev] Py_DECREF causes spurious gcc warning
Skip Montanaro
skip at pobox.com
Wed Dec 17 19:34:55 EST 2003
Tim> [Skip Montanaro]
>> Then you also agree we should bracify the Py_*REF macros, right?
>> <wink>
Tim> That can't work, alas -- the macro has no idea whether curly braces
Tim> are syntactically legal in the context it's invoked in.
I meant the Py_*REF macros which expand to "if" statements and you'd bracify
the clauses, e.g., Py_DECREF would become:
#define Py_DECREF(op) \
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
--(op)->ob_refcnt != 0) { \
_Py_CHECK_REFCNT(op) \
} else { \
_Py_Dealloc((PyObject *)(op)) \
}
Py_INCREF would be left alone, and the X variants would become
#define Py_XINCREF(op) if ((op) == NULL) {;} else { Py_INCREF(op) }
#define Py_XDECREF(op) if ((op) == NULL) {;} else {Py_DECREF(op) }
Skip
More information about the Python-Dev
mailing list