Title: "Consistent AST position" crashes pytest: "ValueError: line 22-0 is not a valid range" · Issue #93387 · python/cpython · GitHub
Open Graph Title: "Consistent AST position" crashes pytest: "ValueError: line 22-0 is not a valid range" · Issue #93387 · python/cpython
X Title: "Consistent AST position" crashes pytest: "ValueError: line 22-0 is not a valid range" · Issue #93387 · python/cpython
Description: Bug report The coverage.py test suite fails to even start on 3.11.0b2, because of a crash inside pytest related to code positions. This is the error from a nightly build: py311 run-test: commands[3] | python igor.py test_with_tracer c -r...
Open Graph Description: Bug report The coverage.py test suite fails to even start on 3.11.0b2, because of a crash inside pytest related to code positions. This is the error from a nightly build: py311 run-test: commands[3...
X Description: Bug report The coverage.py test suite fails to even start on 3.11.0b2, because of a crash inside pytest related to code positions. This is the error from a nightly build: py311 run-test: commands[3...
Opengraph URL: https://github.com/python/cpython/issues/93387
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Consistent AST position\" crashes pytest: \"ValueError: line 22-0 is not a valid range\"","articleBody":"**Bug report**\r\n\r\nThe coverage.py test suite fails to even start on 3.11.0b2, because of a crash inside pytest related to code positions. This is the error from a [nightly build](https://github.com/nedbat/coveragepy/runs/6675064815?check_suite_focus=true#step:7:84):\r\n```\r\npy311 run-test: commands[3] | python igor.py test_with_tracer c -rfsEX\r\n === CPython 3.11.0b1+ with C tracer (.tox/py311/bin/python) ===\r\n Traceback (most recent call last):\r\n File \"/home/runner/work/coveragepy/coveragepy/igor.py\", line 474, in \u003cmodule\u003e\r\n sys.exit(main(sys.argv[1:]))\r\n ^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/igor.py\", line 466, in main\r\n ret = handler(*handler_args)\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/igor.py\", line 239, in do_test_with_tracer\r\n return run_tests(tracer, *runner_args)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/igor.py\", line 152, in run_tests\r\n return pytest.main(list(runner_args))\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py\", line 145, in main\r\n config = _prepareconfig(args, plugins)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py\", line 324, in _prepareconfig\r\n config = pluginmanager.hook.pytest_cmdline_parse(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py\", line 265, in __call__\r\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py\", line 80, in _hookexec\r\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py\", line 55, in _multicall\r\n gen.send(outcome)\r\n ^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/helpconfig.py\", line 102, in pytest_cmdline_parse\r\n config: Config = outcome.get_result()\r\n ^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py\", line 60, in get_result\r\n raise ex[1].with_traceback(ex[2])\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py\", line 39, in _multicall\r\n res = hook_impl.function(*args)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py\", line 1016, in pytest_cmdline_parse\r\n self.parse(args)\r\n ^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py\", line 1304, in parse\r\n self._preparse(args, addopts=addopts)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py\", line 1187, in _preparse\r\n self.pluginmanager.load_setuptools_entrypoints(\"pytest11\")\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py\", line 287, in load_setuptools_entrypoints\r\n plugin = ep.load()\r\n ^^^^^^^^^\r\n File \"/usr/lib/python3.11/importlib/metadata/__init__.py\", line 198, in load\r\n module = import_module(match.group('module'))\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/usr/lib/python3.11/importlib/__init__.py\", line 126, in import_module\r\n return _bootstrap._gcd_import(name[level:], package, level)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1206, in _gcd_import\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1178, in _find_and_load\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1149, in _find_and_load_unlocked\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 690, in _load_unlocked\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/assertion/rewrite.py\", line 159, in exec_module\r\n source_stat, co = _rewrite_test(fn, self.config)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/home/runner/work/coveragepy/coveragepy/.tox/py311/lib/python3.11/site-packages/_pytest/assertion/rewrite.py\", line 361, in _rewrite_test\r\n co = compile(tree, strfn, \"exec\", dont_inherit=True)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n ValueError: line 22-0 is not a valid range\r\n```\r\nWhen I run the test suite locally with 3.11.0b2, I get the same traceback, but the message is \"line 1-0 is not a valid range\".\r\n\r\nRunning pytest directly, rather than through my helper doesn't fail.\r\n\r\nI git bisected: the first bad commit was:\r\n```\r\n7f6e6abdc43d9b61d81eb26b9fb2073dccf6a3cb is the first bad commit\r\ncommit 7f6e6abdc43d9b61d81eb26b9fb2073dccf6a3cb\r\nAuthor: Miss Islington (bot) \u003c31488909+miss-islington@users.noreply.github.com\u003e\r\nDate: Mon May 30 11:52:36 2022 -0700\r\n\r\n gh-93351: Ensure the position information in AST nodes created by the parser is always consistent (GH-93352)\r\n\r\n (cherry picked from commit 5893b5db98b38b17750c0572c7209774a5034898)\r\n\r\n Co-authored-by: Pablo Galindo Salgado \u003cPablogsal@gmail.com\u003e\r\n\r\n Lib/test/test_ast.py | 27 +++++++++++++++++++++++++++\r\n Python/ast.c | 26 ++++++++++++++++++++++++++\r\n 2 files changed, 53 insertions(+)\r\n```\r\n\r\n**Your environment**\r\n\r\n- CPython versions tested on: 3.11.0b1 works, 3.11.0b2 fails.\r\n- Operating system and architecture: Mac OS 10.15.7\r\n\r\n**To reproduce**\r\n\r\n```\r\n$ mktmpenv -p python3.10 # or some other way to create an environment\r\n$ git clone https://github.com/nedbat/coveragepy\r\n$ cd coveragepy\r\n$ pip install tox\r\n$ tox -e py311\r\n```","author":{"url":"https://github.com/nedbat","@type":"Person","name":"nedbat"},"datePublished":"2022-05-31T18:37:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/93387/cpython/issues/93387"}
| 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:39ab972c-036c-c887-687e-6d3e7b775679 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9416:24A0FE:F95A0:14E11B:6969C810 |
| html-safe-nonce | b08d074b7c4cc2c16ab72b74fd810173fff70f2e64b211128d1f24e95b1e7814 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDE2OjI0QTBGRTpGOTVBMDoxNEUxMUI6Njk2OUM4MTAiLCJ2aXNpdG9yX2lkIjoiMTA5NDMzMDE2ODExMzc0Mzg4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7c0084a9ca6d81430b639d6b4a269fa756831782c895c98dbef0efea490cf6f1 |
| hovercard-subject-tag | issue:1254267909 |
| 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/93387/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1909beac28681b46a58d39c7382397d6701b7d21df5220eaee8ea24e64eb83d6/python/cpython/issues/93387 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1909beac28681b46a58d39c7382397d6701b7d21df5220eaee8ea24e64eb83d6/python/cpython/issues/93387 |
| og:image:alt | Bug report The coverage.py test suite fails to even start on 3.11.0b2, because of a crash inside pytest related to code positions. This is the error from a nightly build: py311 run-test: commands[3... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nedbat |
| 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