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

_ast py3k : add lineno back to "args" node #54654

Closed
emileanclin mannequin opened this issue Nov 17, 2010 · 3 comments
Closed

_ast py3k : add lineno back to "args" node #54654

emileanclin mannequin opened this issue Nov 17, 2010 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@emileanclin
Copy link
Mannequin

emileanclin mannequin commented Nov 17, 2010

BPO 10445
Nosy @ncoghlan, @benjaminp, @PCManticore

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 2014-06-28.14:12:10.196>
created_at = <Date 2010-11-17.14:15:24.769>
labels = ['interpreter-core', 'type-bug']
title = '_ast py3k : add lineno back to "args" node'
updated_at = <Date 2014-06-28.14:12:10.194>
user = 'https://bugs.python.org/emileanclin'

bugs.python.org fields:

activity = <Date 2014-06-28.14:12:10.194>
actor = 'Claudiu.Popa'
assignee = 'none'
closed = True
closed_date = <Date 2014-06-28.14:12:10.196>
closer = 'Claudiu.Popa'
components = ['Interpreter Core']
creation = <Date 2010-11-17.14:15:24.769>
creator = 'emile.anclin'
dependencies = []
files = []
hgrepos = []
issue_num = 10445
keywords = []
message_count = 3.0
messages = ['121357', '220342', '221791']
nosy_count = 4.0
nosy_names = ['ncoghlan', 'benjamin.peterson', 'Claudiu.Popa', 'emile.anclin']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10445'
versions = ['Python 3.2', 'Python 3.3', 'Python 3.4']

@emileanclin
Copy link
Mannequin Author

emileanclin mannequin commented Nov 17, 2010

For Python3x, in the tree generated by _ast, for the "args" node (representing an argument of a function), the "lineno" (and the "col_offset") information disappeared from those nodes.

It would be nice to have them back (for instance for Pylint)

@emileanclin emileanclin mannequin added the performance Performance or resource usage label Nov 17, 2010
@ezio-melotti ezio-melotti added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Sep 11, 2012
@PCManticore
Copy link
Mannequin

PCManticore mannequin commented Jun 12, 2014

This doesn't seem to be the case for Python 3.4. Also, _ast.arguments didn't have "lineno" and "col_offset" attributes neither in Python 2. But the _arg.arg nodes have those attributes, as seen in this example.

>>> from ast import parse
>>> parse("""
... def test(a): pass
... """)
<_ast.Module object at 0x02E43330>
>>> f=_
>>> f.body[0].args
<_ast.arguments object at 0x02E43390>
>>> f.body[0].args.lineno
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'arguments' object has no attribute 'lineno'
>>> f.body[0].args.args
[<_ast.arg object at 0x02E43270>]
>>> f.body[0].args.args[0].lineno
2
>>>

@PCManticore PCManticore mannequin added type-bug An unexpected behavior, bug, or error and removed performance Performance or resource usage labels Jun 12, 2014
@PCManticore
Copy link
Mannequin

PCManticore mannequin commented Jun 28, 2014

It seems that this was actual the case for Python 3.2 and 3.3, but fixed in 3.4. Unfortunately, it's too late now to add those fields back, since 3.2 and 3.3 receives only security updates. So I guess this issue can be closed.

@PCManticore PCManticore mannequin closed this as completed Jun 28, 2014
@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
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant