Message288372
| Author |
vstinner |
| Recipients |
methane, vstinner |
| Date |
2017年02月22日.16:48:32 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1487782112.74.0.332451655516.issue29622@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The _ast.AST constructor requires a tuple with the same number of items than the fields list.
Example with Raise:
ASDL: Raise(expr? exc, expr? cause)
>>> import _ast
>>> _ast.Raise()
<_ast.Raise object at 0x7fc2ca7dee90>
>>> _ast.Raise(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Raise constructor takes either 0 or 2 positional arguments
>>> _ast.Raise(1, 2)
<_ast.Raise object at 0x7fc2ca7def60>
The cause field is optional in the ASDL, but required in the _ast module.
A tradeoff would be to add the minimum and maximum number of fields to _ast.AST.
This issue should prevent API breakage caused by the new docstring attribute added by issue #29463. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年02月22日 16:48:32 | vstinner | set | recipients:
+ vstinner, methane |
| 2017年02月22日 16:48:32 | vstinner | set | messageid: <1487782112.74.0.332451655516.issue29622@psf.upfronthosting.co.za> |
| 2017年02月22日 16:48:32 | vstinner | link | issue29622 messages |
| 2017年02月22日 16:48:32 | vstinner | create |
|