Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set AST node fallback end_lineno & end_col_offset as well #2426

Merged
merged 1 commit into from
Jul 2, 2022

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Jun 1, 2022

When setting the fallback values for lineno & col_offset, set them
also for end_lineno & end_col_offset. This fixes a regression
in Python 3.11.0b2 where lineno without end_lineno would cause
an exception to be thrown.

Fixes #2425

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@mgorny mgorny force-pushed the routing-end-lineno branch from 4b7e6a3 to f943d79 Compare June 1, 2022 05:59
@mgorny
Copy link
Contributor Author

mgorny commented Jun 1, 2022

The py3.11 failures don't seem to be caused by my changes.

I think the mypy failure is because it doesn't include up-to-date typing data for the ast module. Since the attrs are set conditionally to node._attributes, I don't think that's a real issue. However, I don't know mypy enough to know how to solve this.

@davidism davidism added this to the 2.2.0 milestone Jul 2, 2022
@davidism davidism force-pushed the routing-end-lineno branch 2 times, most recently from 37d4cc7 to 2e5bff6 Compare July 2, 2022 11:42
When setting the fallback values for lineno & col_offset, set them
also for end_lineno & end_col_offset. This fixes a regression
in Python 3.11.0b2 where lineno without end_lineno would cause
an exception to be thrown.
@davidism davidism force-pushed the routing-end-lineno branch from 2e5bff6 to 4f2d771 Compare July 2, 2022 11:46
@davidism davidism merged commit e583ba5 into pallets:main Jul 2, 2022
@mgorny
Copy link
Contributor Author

mgorny commented Jul 2, 2022

Thanks!

@mgorny mgorny deleted the routing-end-lineno branch July 2, 2022 16:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in routing on Python 3.11.0b2: ValueError: line 1-0 is not a valid range
2 participants