Title: Possible regression in Python3.12 tokenizer · Issue #105013 · python/cpython · GitHub
Open Graph Title: Possible regression in Python3.12 tokenizer · Issue #105013 · python/cpython
X Title: Possible regression in Python3.12 tokenizer · Issue #105013 · python/cpython
Description: Bug report I have encountered a possible regression while I was testing pyrsistent with python3.12_beta1, see tobgu/pyrsistent#275. Tests fail with following error: /usr/lib/python3.12/site-packages/_pytest/python.py:617: in _importtestm...
Open Graph Description: Bug report I have encountered a possible regression while I was testing pyrsistent with python3.12_beta1, see tobgu/pyrsistent#275. Tests fail with following error: /usr/lib/python3.12/site-package...
X Description: Bug report I have encountered a possible regression while I was testing pyrsistent with python3.12_beta1, see tobgu/pyrsistent#275. Tests fail with following error: /usr/lib/python3.12/site-package...
Opengraph URL: https://github.com/python/cpython/issues/105013
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible regression in Python3.12 tokenizer","articleBody":"# Bug report\r\n\r\nI have encountered a possible regression while I was testing pyrsistent with python3.12_beta1, see https://github.com/tobgu/pyrsistent/issues/275. Tests fail with following error:\r\n```\r\n/usr/lib/python3.12/site-packages/_pytest/python.py:617: in _importtestmodule\r\n mod = import_path(self.path, mode=importmode, root=self.config.rootpath)\r\n/usr/lib/python3.12/site-packages/_pytest/pathlib.py:564: in import_path\r\n importlib.import_module(module_name)\r\n/usr/lib/python3.12/importlib/__init__.py:90: in import_module\r\n return _bootstrap._gcd_import(name[level:], package, level)\r\n\u003cfrozen importlib._bootstrap\u003e:1293: in _gcd_import\r\n ???\r\n\u003cfrozen importlib._bootstrap\u003e:1266: in _find_and_load\r\n ???\r\n\u003cfrozen importlib._bootstrap\u003e:1237: in _find_and_load_unlocked\r\n ???\r\n\u003cfrozen importlib._bootstrap\u003e:841: in _load_unlocked\r\n ???\r\n/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module\r\n exec(co, module.__dict__)\r\ntests/hypothesis_vector_test.py:48: in \u003cmodule\u003e\r\n PVectorAndLists = st.lists(st.builds(RefCountTracker)).map(\r\n/usr/lib/python3.12/site-packages/hypothesis/strategies/_internal/strategies.py:347: in map\r\n if is_identity_function(pack):\r\n/usr/lib/python3.12/site-packages/hypothesis/internal/reflection.py:638: in is_identity_function\r\n return bool(re.fullmatch(r\"lambda (\\w+): \\1\", get_pretty_function_description(f)))\r\n/usr/lib/python3.12/site-packages/hypothesis/internal/reflection.py:432: in get_pretty_function_description\r\n return extract_lambda_source(f)\r\n/usr/lib/python3.12/site-packages/hypothesis/internal/reflection.py:312: in extract_lambda_source\r\n source = inspect.getsource(f)\r\n/usr/lib/python3.12/inspect.py:1274: in getsource\r\n lines, lnum = getsourcelines(object)\r\n/usr/lib/python3.12/inspect.py:1266: in getsourcelines\r\n return getblock(lines[lnum:]), lnum + 1\r\n/usr/lib/python3.12/inspect.py:1241: in getblock\r\n for _token in tokens:\r\n/usr/lib/python3.12/tokenize.py:451: in _tokenize\r\n for token in _generate_tokens_from_c_tokenizer(source, extra_tokens=True):\r\n/usr/lib/python3.12/tokenize.py:542: in _generate_tokens_from_c_tokenizer\r\n for info in c_tokenizer.TokenizerIter(source, extra_tokens=extra_tokens):\r\nE File \"\u003cstring\u003e\", line 1\r\nE lambda l: (l, pvector(l)))\r\nE ^\r\nE SyntaxError: unmatched ')'\r\n```\r\n\r\nIt is triggered for this code (see https://github.com/tobgu/pyrsistent/blob/cc90f3e2b339653fde0df422aaf3ccdb3fc1225d/tests/hypothesis_vector_test.py#L48-L49 )\r\n```python\r\nPVectorAndLists = st.lists(st.builds(RefCountTracker)).map(\r\n lambda l: (l, pvector(l)))\r\n```\r\nif I concatenate it to one line, everything works. I also tried to backport fix for https://github.com/python/cpython/issues/104866 as it sounds relevant, but it didn't solved the issue.\r\n\r\n# Your environment\r\n\r\n- Gentoo `~amd64`\r\n- Python 3.12.0b1\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-105021\n* gh-105032\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/arkamar","@type":"Person","name":"arkamar"},"datePublished":"2023-05-27T09:09:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/105013/cpython/issues/105013"}
| 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:48422788-d92c-575e-6575-ae6d44f35fa4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A680:1F92AF:215034:2C572F:6969BF63 |
| html-safe-nonce | 8ec85564925122e59c0acc871d78f766dfbcb26d57f8545b723cd448542c12b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjgwOjFGOTJBRjoyMTUwMzQ6MkM1NzJGOjY5NjlCRjYzIiwidmlzaXRvcl9pZCI6IjgyMTQ5NjM1NjA2MTc5ODM4NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cd7ec80d3a7905650675ae378d2bf2f5be718b8e52e867b13ace9b1da1a7aaaf |
| hovercard-subject-tag | issue:1728575908 |
| 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/105013/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d99c428bbb7b02399eee666c6cd3cf6a18bdd9e569fd0da7e433165b5f88732/python/cpython/issues/105013 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d99c428bbb7b02399eee666c6cd3cf6a18bdd9e569fd0da7e433165b5f88732/python/cpython/issues/105013 |
| og:image:alt | Bug report I have encountered a possible regression while I was testing pyrsistent with python3.12_beta1, see tobgu/pyrsistent#275. Tests fail with following error: /usr/lib/python3.12/site-package... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | arkamar |
| 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