Repository navigation
Produce error when NamedTuple is assigned to attribute - #7662
Merged
Merged
Conversation
AFanaei
force-pushed
the
namedtuple-as-attr
branch
from
October 9, 2019 06:30
fe9ac72 to
3c062be
Compare
AFanaei
commented
Oct 9, 2019
AFanaei
commented
Oct 9, 2019
Contributor
Author
|
hi @JukkaL , could you review this PR? |
JukkaL
reviewed
Oct 11, 2019
JukkaL
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR! Looks mostly good. I have a suggestion about tests.
AFanaei
force-pushed
the
namedtuple-as-attr
branch
from
October 12, 2019 06:59
f8df8c9 to
6651401
Compare
AFanaei
commented
Oct 12, 2019
AFanaei
commented
Oct 12, 2019
| return False | ||
| if isinstance(s.lvalues[0], MemberExpr): | ||
| self.fail("NamedTuple type as an attribute is not supported", lvalue) | ||
| return False |
Contributor
Author
There was a problem hiding this comment.
I moved this block to start but then a NamedTuple type as an attrib ... error was generated on every attribute assignment statement.
as the error should raise only if RHS is NamedTuple, i think this block is better at the end.
This was referenced Dec 8, 2019
ilevkivskyi
pushed a commit
that referenced
this pull request
Dec 9, 2019
…me for variable (#8112) Followed the discussion in #8107 (comment), refine the code merged in #7662 by: - move testcase from `pythoneval.test` to `check-namedtuple.test` and rename it from `testNamedTupleAtRunTime` to `testAssignNamedTupleAsAttribute` - change `s.lvalues[0]` to `lvalue` to make it more concise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7531