8000 [3.12] gh-116869: Make C API compatible with ISO C90 (GH-116950) (#11… · python/cpython@5da6e30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5da6e30

Browse files
[3.12] gh-116869: Make C API compatible with ISO C90 (GH-116950) (#117011)
gh-116869: Make C API compatible with ISO C90 (GH-116950) Make the C API compatible with -Werror=declaration-after-statement compiler flag again. (cherry picked from commit a9c304c) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 1627c1e commit 5da6e30

File tree

3 files changed

+5
-3
lines changed
10000

3 files changed

+5
-3
lines changed

Include/cpython/longintrepr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ _PyLong_IsCompact(const PyLongObject* op) {
116116
static inline Py_ssize_t
117117
_PyLong_CompactValue(const PyLongObject *op)
118118
{
119+
Py_ssize_t sign;
119120
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
120121
assert(PyUnstable_Long_IsCompact(op));
121-
Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
122+
sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
122123
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
123124
}
124125

Include/object.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ PyAPI_DATA(PyTypeObject) PyBool_Type;
230230
static inline Py_ssize_t Py_SIZE(PyObject *ob) {
231231
assert(ob->ob_type != &PyLong_Type);
232232
assert(ob->ob_type != &PyBool_Type);
233-
PyVarObject *var_ob = _PyVarObject_CAST(ob);
234-
return var_ob->ob_size;
233+
return _PyVarObject_CAST(ob)->ob_size;
235234
}
236235
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
237236
# define Py_SIZE(ob) Py_SIZE(_PyObject_CAST(ob))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Make the C API compatible with ``-Werror=declaration-after-statement``
2+
compiler flag again. Patch by Victor Stinner.

0 commit comments

Comments
 (0)

Footer

© 2025 GitHub, Inc.
0