Title: Python 3.11 C API is not compatible with ISO C90: ISO C90 forbids mixed declarations and code · Issue #92781 · python/cpython · GitHub
Open Graph Title: Python 3.11 C API is not compatible with ISO C90: ISO C90 forbids mixed declarations and code · Issue #92781 · python/cpython
X Title: Python 3.11 C API is not compatible with ISO C90: ISO C90 forbids mixed declarations and code · Issue #92781 · python/cpython
Description: On Fedora, building the xen package with Python 3.11 fails with C compiler errors like: In file included from /usr/include/python3.11/unicodeobject.h:1042, from /usr/include/python3.11/Python.h:51, from xen/lowlevel/xc/xc.c:7: /usr/inclu...
Open Graph Description: On Fedora, building the xen package with Python 3.11 fails with C compiler errors like: In file included from /usr/include/python3.11/unicodeobject.h:1042, from /usr/include/python3.11/Python.h:51,...
X Description: On Fedora, building the xen package with Python 3.11 fails with C compiler errors like: In file included from /usr/include/python3.11/unicodeobject.h:1042, from /usr/include/python3.11/Python.h:51,...
Opengraph URL: https://github.com/python/cpython/issues/92781
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python 3.11 C API is not compatible with ISO C90: ISO C90 forbids mixed declarations and code","articleBody":"On Fedora, building the xen package with Python 3.11 fails with C compiler errors like:\r\n\r\n```\r\n\r\nIn file included from /usr/include/python3.11/unicodeobject.h:1042,\r\n from /usr/include/python3.11/Python.h:51,\r\n from xen/lowlevel/xc/xc.c:7:\r\n/usr/include/python3.11/cpython/unicodeobject.h: In function ‘_PyUnicode_NONCOMPACT_DATA’:\r\n/usr/include/python3.11/cpython/unicodeobject.h:330:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 330 | void *data = _PyUnicodeObject_CAST(op)->data.any;\r\n | ^~~~\r\n/usr/include/python3.11/cpython/unicodeobject.h: In function ‘PyUnicode_READ_CHAR’:\r\n/usr/include/python3.11/cpython/unicodeobject.h:414:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 414 | unsigned int kind = PyUnicode_KIND(unicode);\r\n | ^~~~~~~~\r\n/usr/include/python3.11/cpython/unicodeobject.h: In function ‘PyUnicode_MAX_CHAR_VALUE’:\r\n/usr/include/python3.11/cpython/unicodeobject.h:439:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 439 | unsigned int kind = PyUnicode_KIND(op);\r\n | ^~~~~~~~\r\nIn file included from /usr/include/python3.11/weakrefobject.h:35,\r\n from /usr/include/python3.11/Python.h:83:\r\n/usr/include/python3.11/cpython/weakrefobject.h: In function ‘PyWeakref_GET_OBJECT’:\r\n/usr/include/python3.11/cpython/weakrefobject.h:41:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 41 | PyWeakReference *ref = _Py_CAST(PyWeakReference*, ref_obj);\r\n | ^~~~~~~~~~~~~~~\r\nIn file included from /usr/include/python3.11/abstract.h:866,\r\n from /usr/include/python3.11/Python.h:100:\r\n/usr/include/python3.11/cpython/abstract.h: In function ‘PyObject_CallMethodOneArg’:\r\n/usr/include/python3.11/cpython/abstract.h:116:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 116 | size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;\r\n | ^~~~~~\r\n/usr/include/python3.11/cpython/abstract.h: In function ‘_PyObject_CallMethodIdOneArg’:\r\n/usr/include/python3.11/cpython/abstract.h:165:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]\r\n 165 | size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;\r\n | ^~~~~~\r\ncc1: all warnings being treated as errors\r\n```\r\n\r\nSee: https://bugzilla.redhat.com/show_bug.cgi?id=2084008#c0\r\n\r\nIn Python 3.11, PEP 670 converts multiple macros to static inline functions. A C11 compiler (without optional features) is now required to build Python 3.11.\r\n\r\nIn 2022, most C compilers support C99 which supports mixed declarations and code, so I don't understand why people insist on using ``-Werror=declaration-after-statement``. Maybe it's more a coding style, than a technical requirement. Or maybe it prevented compiler errors on old C compilers a few years ago, and nobody considered removing the compiler flag since that old time.\r\n\r\nWe can try to stay somehow compatible with ISO C90 in Python 3.11. Avoid \"mixed declarations and code\" in static inline functions requires minimum changes and so IMO is acceptable.","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2022-05-13T16:10:05Z","url":"https://github.com/python/cpython/issues/92781"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6a573025-07e1-8869-4d36-3cecbd9e4d8c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80BE:299992:1926F87:21318BC:6B020F81 |
| html-safe-nonce | b1809309f2a18b5172795c92f570d12008e7df0e356cdd1a8c45d3724c89f6b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEJFOjI5OTk5MjoxOTI2Rjg3OjIxMzE4QkM6NkIwMjBGODEiLCJ2aXNpdG9yX2lkIjoiODIzMjU3MzE3OTk2MTQxMzUwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0190901df38d28845271d000ad1a72c1657f65c17a76cb71cbf7d255628eac43 |
| hovercard-subject-tag | issue:1235434562 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/92781/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bade0e2807d9572f363b8b5779697d318cb53a9266a91420acd104be1471dcb1/python/cpython/issues/92781 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bade0e2807d9572f363b8b5779697d318cb53a9266a91420acd104be1471dcb1/python/cpython/issues/92781 |
| og:image:alt | On Fedora, building the xen package with Python 3.11 fails with C compiler errors like: In file included from /usr/include/python3.11/unicodeobject.h:1042, from /usr/include/python3.11/Python.h:51,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width