Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Implement new-style builtins.len for all supported type #9284

Merged
merged 1 commit into from Aug 10, 2020
Merged

[mypyc] Implement new-style builtins.len for all supported type #9284

merged 1 commit into from Aug 10, 2020

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.

None yet

2 participants