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

Python3.9 changes col_offset for some ast nodes #84529

Closed
hauntsaninja opened this issue Apr 21, 2020 · 2 comments
Closed

Python3.9 changes col_offset for some ast nodes #84529

hauntsaninja opened this issue Apr 21, 2020 · 2 comments

Comments

@hauntsaninja
Copy link
Contributor

BPO 40349
Nosy @serhiy-storchaka, @pablogsal, @isidentical, @hauntsaninja

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2020-04-21.06:43:12.775>
created_at = <Date 2020-04-21.03:58:08.777>
labels = ['invalid']
title = 'Python3.9 changes col_offset for some ast nodes'
updated_at = <Date 2020-04-21.06:43:12.772>
user = 'https://github.com/hauntsaninja'

bugs.python.org fields:

activity = <Date 2020-04-21.06:43:12.772>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2020-04-21.06:43:12.775>
closer = 'serhiy.storchaka'
components = []
creation = <Date 2020-04-21.03:58:08.777>
creator = 'hauntsaninja'
dependencies = []
files = []
hgrepos = []
issue_num = 40349
keywords = []
message_count = 2.0
messages = ['366909', '366910']
nosy_count = 4.0
nosy_names = ['serhiy.storchaka', 'pablogsal', 'BTaskaya', 'hauntsaninja']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue40349'
versions = []

@hauntsaninja
Copy link
Contributor Author

With Python 3.8:

Python 3.8.1 (default, Jan 23 2020, 23:36:06) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse("(a).x").body[0].value.col_offset
1

With Python 3.9:

Python 3.9.0a5+ (heads/master:799d7d6, Apr  6 2020, 16:05:37) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse("(a).x").body[0].value.col_offset
0

Maybe related to the new parser? I couldn't find what the environment variable to turn it off was.

For context, I'm trying to get mypy tests to pass with 3.9, but the tests make use of specific col_offsets for error reporting. It would be nice if these continued to match with 3.9

@serhiy-storchaka
Copy link
Member

col_offset = 0 is the correct value. There was a bug which is fixed now (see issue39474).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants