8000 * Make C API compatible with ISO C90 (GH-116950). · defo-project/cpython@efbe6dc · GitHub
[go: up one dir, main page]

Skip to content

Commit efbe6dc

Browse files
committed
* Make C API compatible with ISO C90 (pythonGH-116950).
1 parent 4535e3a commit efbe6dc

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
python3.12 (3.12.2-5) UNRELEASED; urgency=medium
2+
3+
* Make C API compatible with ISO C90 (GH-116950).
4+
5+
-- Matthias Klose <doko@debian.org> Mon, 25 Mar 2024 17:21:47 +0100
6+
17
python3.12 (3.12.2-4) unstable; urgency=medium
28

39
[ Stefano Rivera ]

debian/patches/issue117011.diff

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/Include/cpython/longintrepr.h b/Include/cpython/longintrepr.h
2+
index 692c69ba76db2f..78ac79a7cb8874 100644
3+
--- a/Include/cpython/longintrepr.h
4+
+++ b/Include/cpython/longintrepr.h
5+
@@ -116,9 +116,10 @@ _PyLong_IsCompact(const PyLongObject* op) {
6+
static inline Py_ssize_t
7+
_PyLong_CompactValue(const PyLongObject *op)
8+
{
9+
+ Py_ssize_t sign;
10+
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
11+
assert(PyUnstable_Long_IsCompact(op));
12+
- Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
13+
+ sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
14+
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
15+
}
16+
17+
diff --git a/Include/object.h b/Include/object.h
18+
index 5c30c77bc26a40..0d94cf825534d3 100644
19+
--- a/Include/object.h
20+
+++ b/Include/object.h
21+
@@ -230,8 +230,7 @@ PyAPI_DATA(PyTypeObject) PyBool_Type;
22+
static inline Py_ssize_t Py_SIZE(PyObject *ob) {
23+
assert(ob->ob_type != &PyLong_Type);
24+
assert(ob->ob_type != &PyBool_Type);
25+
- PyVarObject *var_ob = _PyVarObject_CAST(ob);
26+
- return var_ob->ob_size;
27+ A1C4
+ return _PyVarObject_CAST(ob)->ob_size;
28+
}
29+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
30+
# define Py_SIZE(ob) Py_SIZE(_PyObject_CAST(ob))
31+
diff --git a/Misc/NEWS.d/next/C API/2024-03-18-09-58-46.gh-issue-116869.LFDVKM.rst b/Misc/NEWS.d/next/C API/2024-03-18-09-58-46.gh-issue-116869.LFDVKM.rst
32+
new file mode 100644
33+
index 00000000000000..9b9d943f2e6d19
34+
--- /dev/null
35+
+++ b/Misc/NEWS.d/next/C API/2024-03-18-09-58-46.gh-issue-116869.LFDVKM.rst
36+
@@ -0,0 +1,2 @@
37+
+Make the C API compatible with ``-Werror=declaration-after-statement``
38+
+compiler flag again. Patch by Victor Stinner.

debian/patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ ntpath-import.diff
3232
python3.12-updates.diff
3333
issue108447.diff
3434
itertools-clear-crash.diff
35+
issue117011.diff

0 commit comments

Comments
 (0)
0