Title: Pegen improperly memoizes loop rules · Issue #102416 · python/cpython · GitHub
Open Graph Title: Pegen improperly memoizes loop rules · Issue #102416 · python/cpython
X Title: Pegen improperly memoizes loop rules · Issue #102416 · python/cpython
Description: Bug report In the following part of pegen, the memoized result is only used if self._should_memoize(node) is true. Since loop rules are autogenerated, they are not marked with (memo), so this is always false. Despite that, in the end the...
Open Graph Description: Bug report In the following part of pegen, the memoized result is only used if self._should_memoize(node) is true. Since loop rules are autogenerated, they are not marked with (memo), so this is al...
X Description: Bug report In the following part of pegen, the memoized result is only used if self._should_memoize(node) is true. Since loop rules are autogenerated, they are not marked with (memo), so this is al...
Opengraph URL: https://github.com/python/cpython/issues/102416
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pegen improperly memoizes loop rules","articleBody":"# Bug report\r\n\r\nIn the following part of pegen, the memoized result is only used if `self._should_memoize(node)` is true. Since loop rules are autogenerated, they are not marked with `(memo)`, so this is always false. Despite that, in the end the result is memoized based on the different condition `if node.name`. Because of that, in the generated parser loop rules' results are always stored in the cache, but never accessed later.\r\n\r\nhttps://github.com/python/cpython/blob/8de59c1bb9fdcea69ff6e6357972ef1b75b71721/Tools/peg_generator/pegen/c_generator.py#L608-L647\r\n\r\n# Your environment\r\n\r\nDoes not matter - discovered through manual code analysis\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102467\n* gh-102473\n* gh-102474\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/abel1502","@type":"Person","name":"abel1502"},"datePublished":"2023-03-04T09:40:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/102416/cpython/issues/102416"}
| 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:10618be0-0f52-829b-43f6-f50d361b98cd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C494:1851F5:40815E:575F1D:6969D607 |
| html-safe-nonce | 5688b5125f9972682656a5f0e7e77a4f7479df3699889f440a618de0c040a028 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDk0OjE4NTFGNTo0MDgxNUU6NTc1RjFEOjY5NjlENjA3IiwidmlzaXRvcl9pZCI6IjYxNjEyMzQ3Nzk0OTIxNzc0MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 809aaf98dadfcb228855b0394ce00fd5e1b7035782be3ca4de25a05c9ca4efa7 |
| hovercard-subject-tag | issue:1609697582 |
| 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/102416/issue_layout |
| twitter:image | https://opengraph.githubassets.com/40f8e3c916a387be3bb323ee63a1453edf7cdf2a84e5ec58eba85e954c803688/python/cpython/issues/102416 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/40f8e3c916a387be3bb323ee63a1453edf7cdf2a84e5ec58eba85e954c803688/python/cpython/issues/102416 |
| og:image:alt | Bug report In the following part of pegen, the memoized result is only used if self._should_memoize(node) is true. Since loop rules are autogenerated, they are not marked with (memo), so this is al... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abel1502 |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width