diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-15 09:19:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 09:19:52 (GMT) |
commit | 90e72300730189c4a48529baaad9b0005d40731c (patch) | |
tree | 9a4313d1b3fca0a17e4349bff1750497a89baec0 /Include/cpython/cellobject.h | |
parent | db0b455ff482df68f331411bf22b3e5829398280 (diff) | |
download | cpython-90e72300730189c4a48529baaad9b0005d40731c.zip cpython-90e72300730189c4a48529baaad9b0005d40731c.tar.gz cpython-90e72300730189c4a48529baaad9b0005d40731c.tar.bz2 |
gh-92781: Avoid mixing declarations and code in C API (#92783)
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].
Diffstat (limited to 'Include/cpython/cellobject.h')
-rw-r--r-- | Include/cpython/cellobject.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Include/cpython/cellobject.h b/Include/cpython/cellobject.h index f778f86..344238a 100644 --- a/Include/cpython/cellobject.h +++ b/Include/cpython/cellobject.h @@ -22,8 +22,9 @@ PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); 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 @@ -31,8 +32,9 @@ static inline PyObject* PyCell_GET(PyObject *op) { #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 |