New submission from STINNER Victor <vstin...@python.org>: The following change introduced a compiler warning:
commit c5cb077ab3c88394b7ac8ed4e746bd31b53e39f1 Author: Victor Stinner <vstin...@python.org> Date: Tue Sep 22 12:42:28 2020 +0200 Py_IS_TYPE() macro uses Py_TYPE() (GH-22341) Steps to Reproduce: 1. dnf install -y python3-devel pkgconf-pkg-config gcc 2. printf '#include <Python.h>' > test.c 3. gcc -Wcast-qual -Werror -c test.c `pkg-config --cflags --libs python-3.10` Actual results: sh-5.1# gcc -Wcast-qual -Werror -c test.c `pkg-config --cflags --libs python-3.10` In file included from /usr/include/python3.10/Python.h:78, from test.c:1: /usr/include/python3.10/object.h: In function ‘_Py_IS_TYPE’: /usr/include/python3.10/object.h:112:29: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 112 | #define _PyObject_CAST(op) ((PyObject*)(op)) | ^ /usr/include/python3.10/object.h:137:34: note: in expansion of macro ‘_PyObject_CAST’ 137 | #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) | ^~~~~~~~~~~~~~ /usr/include/python3.10/object.h:144:12: note: in expansion of macro ‘Py_TYPE’ 144 | return Py_TYPE(ob) == type; | ^~~~~~~ cc1: all warnings being treated as errors Attached PR fix the compiler warning. Issue reported on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1969663 ---------- components: C API messages: 395534 nosy: vstinner priority: normal severity: normal status: open title: Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type versions: Python 3.10, Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44378> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com