Skip to content

Conversation

@zhhsplendid
Copy link
Member

PR types

New features

PR changes

Others

Describe

For python, if users write a, b = var, the __getitem__ method will iterate through 0, 1, 2 ... until __getitem__ throws an IndexError, then stop. The var[0], var[1] will be given to a, b respectively. If more values are given, the unpack size would cause error.

We didn't raise the IndexError in the past and we add statement in __getitem__ to raise IndexError here to support grammar like a, b = var in this PR.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhhsplendid zhhsplendid merged commit aa50868 into PaddlePaddle:develop Jun 11, 2021
@zhhsplendid zhhsplendid deleted the fix_unit_test branch July 15, 2021 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants