Title: `python -m pegen python` is broken · Issue #96424 · python/cpython · GitHub
Open Graph Title: `python -m pegen python` is broken · Issue #96424 · python/cpython
X Title: `python -m pegen python` is broken · Issue #96424 · python/cpython
Description: If I run PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram on main branch, the result file is broken. There are lots of invalid syntax construct that come from C directly. Some examples: @memoize def interac...
Open Graph Description: If I run PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram on main branch, the result file is broken. There are lots of invalid syntax construct that come from C direc...
X Description: If I run PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram on main branch, the result file is broken. There are lots of invalid syntax construct that come from C direc...
Opengraph URL: https://github.com/python/cpython/issues/96424
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`python -m pegen python` is broken","articleBody":"If I run `PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram` on `main` branch, the result file is broken.\r\n\r\nThere are lots of invalid syntax construct that come from `C` directly.\r\n\r\nSome examples:\r\n\r\n```python\r\n @memoize\r\n def interactive(self) -> Optional[mod_ty]:\r\n # interactive: statement_newline\r\n mark = self._mark()\r\n if (\r\n (a := self.statement_newline())\r\n ):\r\n return _PyAST_Interactive ( a , p -> arena )\r\n self._reset(mark)\r\n return None\r\n```\r\n\r\nIt also has this at the bottom:\r\n\r\n```\r\n return children\r\n\r\n KEYWORDS = ('return', 'import', 'from', 'raise', 'pass', 'del', 'yield', 'assert', 'break', 'continue', 'global', 'nonlocal', 'def', 'if', 'class', 'with', 'for', 'try', 'while', 'as', 'elif', 'else', 'in', 'except', 'finally', 'None', 'True', 'False', 'or', 'and', 'not', 'is', 'lambda')\r\n SOFT_KEYWORDS = ('match', 'case', '_')\r\n\r\n\r\nvoid *\r\n_PyPegen_parse(Parser *p)\r\n{\r\n // Initialize keywords\r\n p->keywords = reserved_keywords;\r\n p->n_keyword_lists = n_keyword_lists;\r\n p->soft_keywords = soft_keywords;\r\n\r\n // Run parser\r\n void *result = NULL;\r\n if (p->start_rule == Py_file_input) {\r\n result = file_rule(p);\r\n } else if (p->start_rule == Py_single_input) {\r\n result = interactive_rule(p);\r\n } else if (p->start_rule == Py_eval_input) {\r\n result = eval_rule(p);\r\n } else if (p->start_rule == Py_func_type_input) {\r\n result = func_type_rule(p);\r\n } else if (p->start_rule == Py_fstring_input) {\r\n result = fstring_rule(p);\r\n }\r\n\r\n return result;\r\n}\r\n```\r\n\r\nI am attaching full file to this issue: https://gist.github.com/sobolevn/37cfd12ad9d2c157e72e7589747f4ed2\r\n\r\nPinging @isidentical and @pablogsal ","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2022-08-30T11:45:24Z","url":"https://github.com/python/cpython/issues/96424"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:f4734d8b-03a0-6b40-48eb-357302a56ed0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8ADA:2454CC:3C84958:4CBDC93:6B020AD6 |
| html-safe-nonce | d6b8ed7ba25067b3561087a30ecfb22d86594093c812e8312c8daa363ef59a46 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QURBOjI0NTRDQzozQzg0OTU4OjRDQkRDOTM6NkIwMjBBRDYiLCJ2aXNpdG9yX2lkIjoiMjMxNjk2Mjc1ODY0Nzc0NTIzOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7f4ab033ff941d4fb0ea5d05641ee5e29c0596c75b4cfcc23f4f672eeda34701 |
| hovercard-subject-tag | issue:1355636906 |
| 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/96424/issue_layout |
| twitter:image | https://opengraph.githubassets.com/55bcc702bd90ead6cf991508163bfc02dc9bbe818d1c626e2dd17bfec06826d8/python/cpython/issues/96424 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/55bcc702bd90ead6cf991508163bfc02dc9bbe818d1c626e2dd17bfec06826d8/python/cpython/issues/96424 |
| og:image:alt | If I run PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram on main branch, the result file is broken. There are lots of invalid syntax construct that come from C direc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width