Title: Macro Py_CLEAR references argument two times. · Issue #98724 · python/cpython · GitHub
Open Graph Title: Macro Py_CLEAR references argument two times. · Issue #98724 · python/cpython
X Title: Macro Py_CLEAR references argument two times. · Issue #98724 · python/cpython
Description: Bug report The macro Py_CLEAR(op) references the argument op two times. If the macro is called with an expression it will be evaluated two times, for example Py_CLEAR(p++). Your environment x86_64 CPython versions tested on: Python 3.7m ...
Open Graph Description: Bug report The macro Py_CLEAR(op) references the argument op two times. If the macro is called with an expression it will be evaluated two times, for example Py_CLEAR(p++). Your environment x86_64 ...
X Description: Bug report The macro Py_CLEAR(op) references the argument op two times. If the macro is called with an expression it will be evaluated two times, for example Py_CLEAR(p++). Your environment x86_64 ...
Opengraph URL: https://github.com/python/cpython/issues/98724
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Macro Py_CLEAR references argument two times.","articleBody":"# Bug report\r\n\r\nThe macro `Py_CLEAR(op)` references the argument `op` two times. If the macro is called with an expression it will be evaluated two times, for example `Py_CLEAR(p++)`.\r\n\r\n# Your environment\r\n\r\nx86_64\r\n\r\n- CPython versions tested on:\r\nPython 3.7m\r\n- Operating system and architecture:\r\nDebian Stable\r\n\r\nI suggest a fix similar to this (old version commented out with #if 0):\r\n\r\n```\r\n#if 0\r\n#define Py_CLEAR(op) \\\r\n do { \\\r\n PyObject *_py_tmp = (PyObject *)(op); \\\r\n if (_py_tmp != NULL) { \\\r\n (op) = NULL; \\\r\n Py_DECREF(_py_tmp); \\\r\n } \\\r\n } while (0)\r\n#else\r\n#define Py_CLEAR(op) \\\r\n do { \\\r\n PyObject **_py_tmp = (PyObject **)\u0026(op); \\\r\n if (*_py_tmp != NULL) { \\\r\n PyObject *_py_tmp2 = *_py_tmp; \\\r\n (*_py_tmp) = NULL; \\\r\n Py_DECREF(_py_tmp2); \\\r\n } \\\r\n } while (0)\r\n#endif\r\n```\r\n\r\nI am not sure if this has happened anywhere, but I see a possible problem here. I think the compiler will optimize out the additional temporary variable in most cases.\n\n\u003c!-- gh-pr-number: gh-99100 --\u003e\n* PR: gh-99100\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99288 --\u003e\n* PR: gh-99288\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99292 --\u003e\n* PR: gh-99292\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99573 --\u003e\n* PR: gh-99573\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99737 --\u003e\n* PR: gh-99737\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99739 --\u003e\n* PR: gh-99739\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-99781 --\u003e\n* PR: gh-99781\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-100070 --\u003e\n* PR: gh-100070\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-100121 --\u003e\n* PR: gh-100121\n\u003c!-- /gh-pr-number --\u003e\n","author":{"url":"https://github.com/hochl","@type":"Person","name":"hochl"},"datePublished":"2022-10-26T14:59:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":36},"url":"https://github.com/98724/cpython/issues/98724"}
| 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:ca125cf0-9ade-756c-c6b6-e353e69bd3dc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7AA:1DECF9:F7BA01:1437648:696B0AAB |
| html-safe-nonce | 562ef6bb95ae74a542e705765766149dd1ad4b8de462a20cc7dbb957653af2dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0FBOjFERUNGOTpGN0JBMDE6MTQzNzY0ODo2OTZCMEFBQiIsInZpc2l0b3JfaWQiOiI3NTc4NTE1MzM1MDk4ODYyMjUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3e53d231396b0e40084da79a31a6dd6d4df60e9547b6bbd6cdae2f8d6f46a3d4 |
| hovercard-subject-tag | issue:1424207362 |
| 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/98724/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1fc3e832aa10e2bbe1b33d2c7d1bef339abbc819363bc5d9471e62bc80555a50/python/cpython/issues/98724 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1fc3e832aa10e2bbe1b33d2c7d1bef339abbc819363bc5d9471e62bc80555a50/python/cpython/issues/98724 |
| og:image:alt | Bug report The macro Py_CLEAR(op) references the argument op two times. If the macro is called with an expression it will be evaluated two times, for example Py_CLEAR(p++). Your environment x86_64 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hochl |
| 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