Title: upgrade_pythoncapi.py: Wrong transformations for Py_Is · Issue #86 · python/pythoncapi-compat · GitHub
Open Graph Title: upgrade_pythoncapi.py: Wrong transformations for Py_Is · Issue #86 · python/pythoncapi-compat
X Title: upgrade_pythoncapi.py: Wrong transformations for Py_Is · Issue #86 · python/pythoncapi-compat
Description: Consider an example: if (((PyObject*)obj)->data == Py_None) { 111; } if (Py_None == ((PyObject*)obj)->data) { 111; } After upgrade_pythoncapi.py I got: #include "pythoncapi_compat.h" if (((PyObject*)obj)->Py_IsNone(data)) { 111; } if (Py...
Open Graph Description: Consider an example: if (((PyObject*)obj)->data == Py_None) { 111; } if (Py_None == ((PyObject*)obj)->data) { 111; } After upgrade_pythoncapi.py I got: #include "pythoncapi_compat.h" if (((PyObject...
X Description: Consider an example: if (((PyObject*)obj)->data == Py_None) { 111; } if (Py_None == ((PyObject*)obj)->data) { 111; } After upgrade_pythoncapi.py I got: #include "pythoncapi_compat.h"...
Opengraph URL: https://github.com/python/pythoncapi-compat/issues/86
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"upgrade_pythoncapi.py: Wrong transformations for Py_Is","articleBody":"Consider an example:\r\n```c\r\nif (((PyObject*)obj)-\u003edata == Py_None) {\r\n 111;\r\n}\r\nif (Py_None == ((PyObject*)obj)-\u003edata) {\r\n 111;\r\n}\r\n```\r\nAfter ``upgrade_pythoncapi.py`` I got:\r\n```c\r\n#include \"pythoncapi_compat.h\"\r\n\r\nif (((PyObject*)obj)-\u003ePy_IsNone(data)) {\r\n 111;\r\n}\r\nif (Py_None == ((PyObject*)obj)-\u003edata) {\r\n 111;\r\n}\r\n```\r\nReal world example:\r\nhttps://github.com/aleaxit/gmpy/blob/eb8dfcbd84abcfcb36b4adcb0d5c6d050731dd75/src/gmpy2_xmpz_misc.c#L237\r\n\r\nI'm not sure if this is a bug. This kind of issues is not easy to avoid, using regexps for code transformations. Have you considered to use something like the [pycparser](https://github.com/eliben/pycparser)?\r\n\r\nThanks for the project.","author":{"url":"https://github.com/skirpichev","@type":"Person","name":"skirpichev"},"datePublished":"2024-03-10T01:33:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/86/pythoncapi-compat/issues/86"}
| 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:113822d6-1be1-99c9-bc6c-aaaf3dea0578 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9308:34B6FA:1F03F93:2ABFE7E:696ABAFF |
| html-safe-nonce | 5644c8bdf60456c6dab0a72d42ad41ac1fc192cc7bbda7190e20fc5590d4f96e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzA4OjM0QjZGQToxRjAzRjkzOjJBQkZFN0U6Njk2QUJBRkYiLCJ2aXNpdG9yX2lkIjoiODU2NTg3MDk2MTQ1NTk3MTA3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f483cd5afb681bdfab24042f3a6b2348a817a9ffe5c05519375b29143910ece9 |
| hovercard-subject-tag | issue:2177477446 |
| 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/pythoncapi-compat/86/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3e246938ea019a2b24470107e0364e8ff2ff717ddb83094afc3921bb80c906f0/python/pythoncapi-compat/issues/86 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3e246938ea019a2b24470107e0364e8ff2ff717ddb83094afc3921bb80c906f0/python/pythoncapi-compat/issues/86 |
| og:image:alt | Consider an example: if (((PyObject*)obj)->data == Py_None) { 111; } if (Py_None == ((PyObject*)obj)->data) { 111; } After upgrade_pythoncapi.py I got: #include "pythoncapi_compat.h" if (((PyObject... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skirpichev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/pythoncapi-compat git https://github.com/python/pythoncapi-compat.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 269418584 |
| octolytics-dimension-repository_nwo | python/pythoncapi-compat |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 269418584 |
| octolytics-dimension-repository_network_root_nwo | python/pythoncapi-compat |
| 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 | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width