PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg)
{
PyObject *args[2] = {self, arg};
-
- assert(arg != NULL);
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;
+ assert(arg != NULL);
return PyObject_VectorcallMethod(name, args, nargsf, _Py_NULL);
}
_PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg)
{
PyObject *args[2] = {self, arg};
-
- assert(arg != NULL);
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;
+ assert(arg != NULL);
return _PyObject_VectorcallMethodId(name, args, nargsf, _Py_NULL);
}
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
static inline PyObject* PyCell_GET(PyObject *op) {
+ PyCellObject *cell;
assert(PyCell_Check(op));
- PyCellObject *cell = _Py_CAST(PyCellObject*, op);
+ cell = _Py_CAST(PyCellObject*, op);
return cell->ob_ref;
}
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030c0000
#endif
static inline void PyCell_SET(PyObject *op, PyObject *value) {
+ PyCellObject *cell;
assert(PyCell_Check(op));
- PyCellObject *cell = _Py_CAST(PyCellObject*, op);
+ cell = _Py_CAST(PyCellObject*, op);
cell->ob_ref = value;
}
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030c0000
/* Get the number of items of a dictionary. */
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
+ PyDictObject *mp;
assert(PyDict_Check(op));
- PyDictObject *mp = _Py_CAST(PyDictObject*, op);
+ mp = _Py_CAST(PyDictObject*, op);
return mp->ma_used;
}
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030c0000
}
static inline void* _PyUnicode_NONCOMPACT_DATA(PyObject *op) {
+ void *data;
assert(!PyUnicode_IS_COMPACT(op));
- void *data = _PyUnicodeObject_CAST(op)->data.any;
+ data = _PyUnicodeObject_CAST(op)->data.any;
assert(data != NULL);
return data;
}
than iterating over the string. */
static inline Py_UCS4 PyUnicode_MAX_CHAR_VALUE(PyObject *op)
{
+ int kind;
+
if (PyUnicode_IS_ASCII(op)) {
return 0x7fU;
}
- int kind = PyUnicode_KIND(op);
+ kind = PyUnicode_KIND(op);
if (kind == PyUnicode_1BYTE_KIND) {
return 0xffU;
}
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj) {
+ PyWeakReference *ref;
+ PyObject *obj;
assert(PyWeakref_Check(ref_obj));
- PyWeakReference *ref = _Py_CAST(PyWeakReference*, ref_obj);
- PyObject *obj = ref->wr_object;
+ ref = _Py_CAST(PyWeakReference*, ref_obj);
+ obj = ref->wr_object;
// Explanation for the Py_REFCNT() check: when a weakref's target is part
// of a long chain of deallocations which triggers the trashcan mechanism,
// clearing the weakrefs can be delayed long after the target's refcount
--- /dev/null
+Avoid mixing declarations and code in the C API to fix the compiler warning:
+"ISO C90 forbids mixed declarations and code"
+[-Werror=declaration-after-statement]. Patch by Victor Stinner.