This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年11月17日 14:15 by emile.anclin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg121357 - (view) | Author: Emile Anclin (emile.anclin) | Date: 2010年11月17日 14:15 | |
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) |
|||
| msg220342 - (view) | Author: PCManticore (Claudiu.Popa) * (Python triager) | Date: 2014年06月12日 12:08 | |
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
>>>
|
|||
| msg221791 - (view) | Author: PCManticore (Claudiu.Popa) * (Python triager) | Date: 2014年06月28日 14:12 | |
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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:09 | admin | set | github: 54654 |
| 2014年06月28日 14:12:10 | Claudiu.Popa | set | status: open -> closed resolution: out of date messages: + msg221791 stage: needs patch -> resolved |
| 2014年06月12日 12:08:52 | Claudiu.Popa | set | type: resource usage -> behavior messages: + msg220342 nosy: + Claudiu.Popa |
| 2012年09月11日 22:53:48 | ezio.melotti | set | nosy:
+ ncoghlan stage: needs patch components: + Interpreter Core, - None versions: + Python 3.3, Python 3.4 |
| 2010年11月21日 03:13:59 | eric.araujo | set | nosy:
+ benjamin.peterson |
| 2010年11月17日 14:15:24 | emile.anclin | create | |