Skip to content

Conversation

@TH3CHARLie
Copy link
Collaborator

This PR completes the support of the new style builtins.len for dict, set, tuple and generic cases.

@TH3CHARLie TH3CHARLie requested a review from JukkaL August 10, 2020 06:17
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good! It's nice to see all the various IR features being used here.

@JukkaL JukkaL merged commit 88eb84e into python:master Aug 10, 2020
@TH3CHARLie TH3CHARLie deleted the merge-all-builtins-len branch August 10, 2020 11:02
@TH3CHARLie
Copy link
Collaborator Author

TH3CHARLie commented Aug 12, 2020

@JukkaL I saw your comment in #9290. There is one thing suspicious that originally the return type for dict, set and tuple are int:

func_op(name='builtins.len',
        arg_types=[dict_rprimitive],
        result_type=int_rprimitive,
        error_kind=ERR_NEVER,
        emit=emit_len)

With this PR, this code snippet makes them short_int:

            return self.binary_int_op(short_int_rprimitive, size_value, offset,
                                      BinaryIntOp.LEFT_SHIFT, line)

Could this be a possible cause? However, please note that len for list was originally of short_int return type.

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 12, 2020

@TH3CHARLie I narrowed the issue down to mypyc/mypyc#756.

@TH3CHARLie
Copy link
Collaborator Author

@TH3CHARLie I narrowed the issue down to mypyc/mypyc#756.

cool! I just checked the issue, though I haven't come up any quick fix yet.

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 13, 2020

cool! I just checked the issue, though I haven't come up any quick fix yet.

I can also help with this, since I'd like to get fix out soon.

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.

2 participants