Title: test/upcast.cpp does not compile since python 3.10 · Issue #479 · boostorg/python · GitHub
Open Graph Title: test/upcast.cpp does not compile since python 3.10 · Issue #479 · boostorg/python
X Title: test/upcast.cpp does not compile since python 3.10 · Issue #479 · boostorg/python
Description: revision: 3e7be69 Since Python 3.10, compilation of test/upcast.cpp fails. python/test/upcast.cpp Lines 16 to 17 in 3e7be69 BOOST_TEST(&Py_REFCNT(boost::python::upcast
Open Graph Description: revision: 3e7be69 Since Python 3.10, compilation of test/upcast.cpp fails. python/test/upcast.cpp Lines 16 to 17 in 3e7be69 BOOST_TEST(&Py_REFCNT(boost::python::upcast
X Description: revision: 3e7be69 Since Python 3.10, compilation of test/upcast.cpp fails. python/test/upcast.cpp Lines 16 to 17 in 3e7be69 BOOST_TEST(&Py_REFCNT(boost::python::upcast<PyObject>(&o)) ...
Opengraph URL: https://github.com/boostorg/python/issues/479
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test/upcast.cpp does not compile since python 3.10","articleBody":"revision: 3e7be69e1e405e1d5ddd232c69c024ee441592c5\n\nSince Python 3.10, compilation of test/upcast.cpp fails.\n\nhttps://github.com/boostorg/python/blob/3e7be69e1e405e1d5ddd232c69c024ee441592c5/test/upcast.cpp#L16-L17\n\n```console\n$ g++ -Iinclude -I/opt/miniconda3/envs/py310/include/python3.10 test/upcast.cpp\nIn file included from /usr/include/boost/detail/lightweight_test.hpp:15,\n from ./test/upcast.cpp:7:\n./test/upcast.cpp: In function 'int main()':\n/opt/miniconda3/envs/py310/include/python3.10/object.h:133:33: error: lvalue required as unary '\u0026' operand\n 133 | #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~\n./test/upcast.cpp:16:17: note: in expansion of macro 'Py_REFCNT'\n 16 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026o)) == \u0026Py_REFCNT(\u0026o));\n | ^~~~~~~~~\n/opt/miniconda3/envs/py310/include/python3.10/object.h:133:33: error: lvalue required as unary '\u0026' operand\n 133 | #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~\n./test/upcast.cpp:16:68: note: in expansion of macro 'Py_REFCNT'\n 16 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026o)) == \u0026Py_REFCNT(\u0026o));\n | ^~~~~~~~~\n/opt/miniconda3/envs/py310/include/python3.10/object.h:133:33: error: lvalue required as unary '\u0026' operand\n 133 | #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~\n./test/upcast.cpp:17:17: note: in expansion of macro 'Py_REFCNT'\n 17 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026y)) == \u0026Py_REFCNT(\u0026y));\n | ^~~~~~~~~\n/opt/miniconda3/envs/py310/include/python3.10/object.h:133:33: error: lvalue required as unary '\u0026' operand\n 133 | #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~\n./test/upcast.cpp:17:68: note: in expansion of macro 'Py_REFCNT'\n 17 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026y)) == \u0026Py_REFCNT(\u0026y));\n | ^~~~~~~~~\n```\n\n```console\n$ g++ -Iinclude -I/usr/include/python3.13 test/upcast.cpp\nIn file included from /usr/include/boost/detail/lightweight_test.hpp:15,\n from test/upcast.cpp:7:\ntest/upcast.cpp: In function 'int main()':\n/usr/include/python3.13/object.h:330:34: error: lvalue required as unary '\u0026' operand\n 330 | # define Py_REFCNT(ob) Py_REFCNT(_PyObject_CAST(ob))\n | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~\ntest/upcast.cpp:16:17: note: in expansion of macro 'Py_REFCNT'\n 16 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026o)) == \u0026Py_REFCNT(\u0026o));\n | ^~~~~~~~~\n/usr/include/python3.13/object.h:330:34: error: lvalue required as unary '\u0026' operand\n 330 | # define Py_REFCNT(ob) Py_REFCNT(_PyObject_CAST(ob))\n | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~\ntest/upcast.cpp:16:68: note: in expansion of macro 'Py_REFCNT'\n 16 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026o)) == \u0026Py_REFCNT(\u0026o));\n | ^~~~~~~~~\n/usr/include/python3.13/object.h:330:34: error: lvalue required as unary '\u0026' operand\n 330 | # define Py_REFCNT(ob) Py_REFCNT(_PyObject_CAST(ob))\n | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~\ntest/upcast.cpp:17:17: note: in expansion of macro 'Py_REFCNT'\n 17 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026y)) == \u0026Py_REFCNT(\u0026y));\n | ^~~~~~~~~\n/usr/include/python3.13/object.h:330:34: error: lvalue required as unary '\u0026' operand\n 330 | # define Py_REFCNT(ob) Py_REFCNT(_PyObject_CAST(ob))\n | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~\ntest/upcast.cpp:17:68: note: in expansion of macro 'Py_REFCNT'\n 17 | BOOST_TEST(\u0026Py_REFCNT(boost::python::upcast\u003cPyObject\u003e(\u0026y)) == \u0026Py_REFCNT(\u0026y));\n | ^~~~~~~~~\n```\n\nThis is because [`Py_REFCNT()` is changed to the inline static function](https://docs.python.org/3.10/c-api/structures.html#c.Py_REFCNT).\n\nUnfortunately, the CI images use python upto 3.8, so the issue has not been found.","author":{"url":"https://github.com/e-kwsm","@type":"Person","name":"e-kwsm"},"datePublished":"2025-03-28T19:38:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/479/python/issues/479"}
| 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:65a7844a-70ff-da86-af62-6b3ebfb25793 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5F6:3B25A:161F701:1DE880E:6964A71A |
| html-safe-nonce | 1caf642f7fd4c1a476d1e4bee5e4238415dc66539ee5fb86cba06df173da8abf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUY2OjNCMjVBOjE2MUY3MDE6MURFODgwRTo2OTY0QTcxQSIsInZpc2l0b3JfaWQiOiIxNjYzMjUzODYyNjk3NzA3MjkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6ed3709f8aa45813bee604edaad97a489e7d5e0cf56e4db488263edeab6a8575 |
| hovercard-subject-tag | issue:2957029510 |
| 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/boostorg/python/479/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9ae6709cc176de09b7e75995f1d58a4c79cd8a90b117da703d7527af7fa0eb3/boostorg/python/issues/479 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9ae6709cc176de09b7e75995f1d58a4c79cd8a90b117da703d7527af7fa0eb3/boostorg/python/issues/479 |
| og:image:alt | revision: 3e7be69 Since Python 3.10, compilation of test/upcast.cpp fails. python/test/upcast.cpp Lines 16 to 17 in 3e7be69 BOOST_TEST(&Py_REFCNT(boost::python::upcast |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | e-kwsm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 15579c46431b7fd25941c3b09010f74fd1890c7a35226839bbbf40ce70fb3057 |
| turbo-cache-control | no-preview |
| go-import | github.com/boostorg/python git https://github.com/boostorg/python.git |
| octolytics-dimension-user_id | 3170529 |
| octolytics-dimension-user_login | boostorg |
| octolytics-dimension-repository_id | 7589968 |
| octolytics-dimension-repository_nwo | boostorg/python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7589968 |
| octolytics-dimension-repository_network_root_nwo | boostorg/python |
| 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 | 499abb347cb197601d399c346cfeb4b3fa135d5c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width