Issue39988
Created on 2020-03-17 07:29 by serhiy.storchaka, last changed 2020-03-20 20:13 by oconnor663. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 19038 | merged | serhiy.storchaka, 2020-03-17 07:38 | |
| Messages (5) | |||
|---|---|---|---|
| msg364390 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2020-03-17 07:29 | |
AugLoad and AugStore are never exposed to the user. They are not generated by the parser and the compiler does not accept it. >>> from ast import * >>> tree = Module(body=[AugAssign(target=Name(id='x', ctx=AugStore()), op=Add(), value=Constant(value=1))], type_ignores=[]) >>> compile(fix_missing_locations(tree), 'sample', 'exec') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: expression must have Store context but has AugStore instead They are only used in temporary nodes created by the compiler. But the support of AugLoad and AugStore is spread across many sites in the compiler, adding special cases which have very little in common with the "normal" cases of Load, Store and Del. The proposed PR removes AugLoad and AugStore. It moves support of the augmented assignment into a separate function and cleans up the rest of the code. This saves around 70 lines of handwritten code and around 60 lines of generated code. The PR depends on issue39987. See also similar issue39969. |
|||
| msg364422 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2020-03-17 12:47 | |
It is possible also to get rid of the ctx argument at all. The context may be determined by the parent nodes. But it is larger and breaking change, so I'll open a separate issue for it. |
|||
| msg364480 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2020-03-17 21:41 | |
New changeset 6b97598fb66a08d0f36e4d73bffea5c1b17740d4 by Serhiy Storchaka in branch 'master': bpo-39988: Remove ast.AugLoad and ast.AugStore node classes. (GH-19038) https://github.com/python/cpython/commit/6b97598fb66a08d0f36e4d73bffea5c1b17740d4 |
|||
| msg364713 - (view) | Author: Jack O'Connor (oconnor663) * | Date: 2020-03-20 20:12 | |
This change may have broken pyflakes on nightly Python. Is that expected or problematic?
Error message:
"pyflakes" failed during execution due to "module 'ast' has no attribute 'AugLoad'"
Seen at: https://travis-ci.org/github/buildinspace/peru/jobs/665005023
|
|||
| msg364714 - (view) | Author: Jack O'Connor (oconnor663) * | Date: 2020-03-20 20:13 | |
Ah never mind, it looks like that's covered by https://bugs.python.org/issue39999 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-03-20 20:13:32 | oconnor663 | set | messages: + msg364714 |
| 2020-03-20 20:12:24 | oconnor663 | set | nosy:
+ oconnor663 messages: + msg364713 |
| 2020-03-17 21:50:06 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-03-17 21:41:16 | serhiy.storchaka | set | messages: + msg364480 |
| 2020-03-17 16:25:48 | ned.deily | set | messages: - msg364424 |
| 2020-03-17 12:54:31 | sanjeev091 | set | nosy:
+ sanjeev091 messages: + msg364424 |
| 2020-03-17 12:47:03 | serhiy.storchaka | set | messages: + msg364422 |
| 2020-03-17 07:38:45 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request18389 |
| 2020-03-17 07:29:51 | serhiy.storchaka | create | |