Bug 1969663
| Summary: | Wcast-qual reported for /usr/include/python3.10/object.h | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Lukas Slebodnik <lslebodn> |
| Component: | python3.10 | Assignee: | Python Maintainers <python-maint> |
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | cstratak, mhroncok, python-maint, python-sig, thrnciar, torsava, vstinner |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-06-11 09:55:09 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Possible solution
sh-5.1$ diff -u /usr/include/python3.10/object.h.orig /usr/include/python3.10/object.h
--- /usr/include/python3.10/object.h.orig 2021-06-08 21:18:10.875000000 +0000
+++ /usr/include/python3.10/object.h 2021-06-08 21:23:20.477000000 +0000
@@ -135,13 +135,14 @@
// bpo-39573: The Py_SET_TYPE() function must be used to set an object type.
#define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type)
+#define Py_TYPE_CONST(ob) (_PyObject_CAST_CONST(ob)->ob_type)
// bpo-39573: The Py_SET_SIZE() function must be used to set an object size.
#define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size)
static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
- return Py_TYPE(ob) == type;
+ return Py_TYPE_CONST(ob) == type;
}
#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
Bump ^^ You've reported this 2 days ago. We have hundreds of Python 3.10 build failures to got rough and this is a warning. I don't think it requires a bump and a needinfo. If you need to move this forward fast, open an upstream issue and a pull request. s/got rough/go trough/ Alright, I reproduced the issue. I created https://bugs.python.org/issue44378 and https://github.com/python/cpython/pull/26644 to fix the compiler warning. (In reply to Victor Stinner from comment #5) > Alright, I reproduced the issue. I created > https://bugs.python.org/issue44378 and > https://github.com/python/cpython/pull/26644 to fix the compiler warning. Thank you very much for PR. I am glad you were able to reproduce it and prepare fix It is now fixed in the 3.10 branch: https://github.com/python/cpython/commit/e6d28a1a6ad22125fc3a6df2d611d79aa8d6f67e The fix will be part of the next Python 3.10.0 beta3 release, scheduled at: "3.10.0 beta 3: Thursday, 2021-06-17". https://www.python.org/dev/peps/pep-0619/ Is it worth it to keep this issue open to track it? Lukas Slebodnik's use case is: "I try to build projects with as many warnings enabled as possible." We'll update to beta 3 as soon as it is out. Thanks fro the fix! |
Description of problem: I try to build projects with as many warnings enabled as possible. But the recent update of python broke it Version-Release number of selected component (if applicable): sh-5.1# rpm -q python3-devel pkgconf-pkg-config gcc python3-devel-3.10.0~b2-3.fc35.x86_64 pkgconf-pkg-config-1.7.3-6.fc34.x86_64 gcc-11.1.1-3.fc35.x86_64 How reproducible: Deterministic 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 Expected results: sh-5.1# gcc -Wcast-qual -Werror -c test.c `pkg-config --cflags --libs python-3.10` sh-5.1# echo $? 0 Additional info: