Title: In C++, Python 3.11 C API introduces new compiler warnings/errors · Issue #92135 · python/cpython · GitHub
Open Graph Title: In C++, Python 3.11 C API introduces new compiler warnings/errors · Issue #92135 · python/cpython
X Title: In C++, Python 3.11 C API introduces new compiler warnings/errors · Issue #92135 · python/cpython
Description: To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959 Previously, "old-style cast" like (PyObject*)expr didn't emit a compiler warning if expr w...
Open Graph Description: To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959 Previously, "old-style cast" like (PyObject*)expr ...
X Description: To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959 Previously, "old-style ...
Opengraph URL: https://github.com/python/cpython/issues/92135
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In C++, Python 3.11 C API introduces new compiler warnings/errors","articleBody":"To fix C++ compiler warnings about \"old-style casts\", I recently modified the Python C API to use C++ ``reinterpret_cast\u003c\u003e`` and ``static_cast\u003c\u003e``: https://github.com/python/cpython/pull/91959\r\n\r\nPreviously, \"old-style cast\" like ``(PyObject*)expr`` didn't emit a compiler warning if ``expr`` was ``const``. Now with the new cast, C++ compilers emit warnings: see https://github.com/python/cpython/pull/91959#issuecomment-1113674438\r\n\r\n``const_cast\u003c\u003e`` can be used to fix this issue.\r\n\r\nNote: [PEP 670](https://peps.python.org/pep-0670/) was accepted with the condition: converting macros to functions must not introduce new compiler warnings (so no new compile errors neither). But most functions modified in Python 3.11 (to use C++ casts) were already static inline functions in Python 3.10.","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2022-05-02T09:21:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/92135/cpython/issues/92135"}
| 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:53e700ee-5606-9c08-b110-23c89e0fed75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C094:3A6082:9CA20B:CAB681:696AF739 |
| html-safe-nonce | 4e908f77f0a5738fb77501666d1c7f8751fb69ca49b4e26c8bef2f72a01e5923 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDk0OjNBNjA4Mjo5Q0EyMEI6Q0FCNjgxOjY5NkFGNzM5IiwidmlzaXRvcl9pZCI6Ijc1NzEyNTQ3MjcyNDQ3MDc2NDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7f12a75f1c501dfb60c22306e83efb083b7d7c1724ff442ccb65ca99a2d570f9 |
| hovercard-subject-tag | issue:1222668509 |
| 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/92135/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b203d551dd79f9f7deb1e90d75ec33e64360628a030de86d9b89f8e58ec44aaf/python/cpython/issues/92135 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b203d551dd79f9f7deb1e90d75ec33e64360628a030de86d9b89f8e58ec44aaf/python/cpython/issues/92135 |
| og:image:alt | To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959 Previously, "old-style cast" like (PyObject*)expr ... |
| 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 | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width