Title: changes to PyObject casting macros causing build failures with python-greenlet · Issue #92898 · python/cpython · GitHub
Open Graph Title: changes to PyObject casting macros causing build failures with python-greenlet · Issue #92898 · python/cpython
X Title: changes to PyObject casting macros causing build failures with python-greenlet · Issue #92898 · python/cpython
Description: Bug report There have been changes to how the macros for casting PyObject pointers per #91959 (comment) by @vstinner any new compiler warnings are a regression. There were two types of errors in greenlet, one related to const correctness...
Open Graph Description: Bug report There have been changes to how the macros for casting PyObject pointers per #91959 (comment) by @vstinner any new compiler warnings are a regression. There were two types of errors in gr...
X Description: Bug report There have been changes to how the macros for casting PyObject pointers per #91959 (comment) by @vstinner any new compiler warnings are a regression. There were two types of errors in gr...
Opengraph URL: https://github.com/python/cpython/issues/92898
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"changes to PyObject casting macros causing build failures with python-greenlet","articleBody":"\u003c!--\r\n If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n**Bug report**\r\n\r\nThere have been changes to how the macros for casting PyObject pointers per https://github.com/python/cpython/pull/91959#issuecomment-1114651243 by @vstinner any new compiler warnings are a regression. \r\n\r\nThere were two types of errors in greenlet, one related to const correctness which has been fixed via https://github.com/python/cpython/pull/92138) and one related to casting wrapper classes (that has not been fixed).\r\n\r\nPer @serge-sans-paille in https://github.com/python/cpython/pull/92138#issuecomment-1116983125\r\n\r\n\u003e That's an interesting situation: greenlets are written in C++, and the object that raises issues is of type greenlet::refs::OwnedErrPiece that has a conversion operator to PyObject* (namely: https://github.com/python-greenlet/greenlet/blob/be41e1a24925326b72a02ef5cb6d1ed9643eb062/src/greenlet/greenlet_refs.hpp#L924 ) Using C-style cast or static_cast directly uses that operator so that's fine. But a reinterpret_cast won't work.\r\n\r\nand suggests a patch to CPython.\r\n\r\nhttps://github.com/python-greenlet/greenlet/pull/302 is a fix on the greenlet side.\r\n\r\nThe key line of the error is\r\n\r\n```\r\nsrc/greenlet/greenlet_refs.hpp: In member function ‘void greenlet::refs::PyErrPieces::normalize()’:\r\n/home/tcaswell/.pybuild/bleeding/include/python3.12/pyport.h:30:25: error: invalid cast from type ‘greenlet::refs::OwnedErrPiece’ to type ‘const PyObject*’ {aka ‘const _object*’}\r\n 30 | const_cast\u003ctype\u003e(reinterpret_cast\u003cconst type\u003e(expr))\r\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n```\r\n\r\nThis is also affecting https://github.com/python/pyperformance/issues/198\r\n\r\nA bunch of links: https://github.com/python/cpython/issues/92800#issuecomment-1126809930\r\n\r\n\r\n**Your environment**\r\n\r\n\u003c!-- Include as many relevant details as possible about the environment you experienced the bug in --\u003e\r\n\r\n- CPython versions tested on: main branch\r\n- Operating system and architecture: linux and x86_64 \r\n","author":{"url":"https://github.com/tacaswell","@type":"Person","name":"tacaswell"},"datePublished":"2022-05-17T20:33:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/92898/cpython/issues/92898"}
| 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:6a9b149d-2dbd-0177-40e2-849707cb7e07 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5CE:6114D:11402F5:17D8723:6969FDF3 |
| html-safe-nonce | f61f1f0b804a410780d70a3365257c99a783a29cacdf18a0d0bf4a36f1b87bdf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUNFOjYxMTREOjExNDAyRjU6MTdEODcyMzo2OTY5RkRGMyIsInZpc2l0b3JfaWQiOiIyNDA1MDI2NTY5MjI2ODA4MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9094140985d196b9a3c9a87ad583ee59b3c8429c23ae2440a3b109e50b615bc0 |
| hovercard-subject-tag | issue:1239128865 |
| 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/92898/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cab1f9838bf11c7077132b1d1e627788277f01055162169bde1953fe030ab6cb/python/cpython/issues/92898 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cab1f9838bf11c7077132b1d1e627788277f01055162169bde1953fe030ab6cb/python/cpython/issues/92898 |
| og:image:alt | Bug report There have been changes to how the macros for casting PyObject pointers per #91959 (comment) by @vstinner any new compiler warnings are a regression. There were two types of errors in gr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tacaswell |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width