FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[mypyc] feat: extend `get_expr_length` to work with RTuple and TupleType [2/4] by BobTheBuidler · Pull Request #19929 · python/mypy · GitHub

Repository navigation

[mypyc] feat: extend get_expr_length to work with RTuple and TupleType [2/4] - #19929

Merged
JukkaL merged 14 commits into
python:masterfrom
BobTheBuidler:tuple-length
Oct 14, 2025
Merged

JukkaL merged 14 commits into
python:masterfrom
BobTheBuidler:tuple-length

Conversation

BobTheBuidler commented Sep 26, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

This PR extends get_expr_length to work with type information from RTuple and TupleType classes

All of the get_expr_length PRs are entirely independent and can be reviewed/merged in any order.

BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to work with RTuple and TupleType [mypyc] feat: extend get_expr_length to work with RTuple and TupleType Sep 26, 2025

Copy link
Copy Markdown
Contributor Author

If we merge #19931 first, this PR will be reflected in a change to its IR test data

BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to work with RTuple and TupleType [mypyc] feat: extend get_expr_length to work with RTuple and TupleType [2/4] Oct 1, 2025
Comment thread mypyc/irbuild/for_helpers.py Outdated
rtype = builder.node_type(expr)
if isinstance(rtype, RTuple):
return len(rtype.types)
proper_type = get_proper_type(builder.types[expr])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do we need this or will the check above it catch every case?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This check is redundant. If this would be required for some unexpected reason, the issue should be fixed in node_type instead of here, since it would likely affect other things as well. Can you remove the second check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Removed

r4 = box(int, r1)
r5 = box(int, r2)
r6 = box(int, r3)
r7 = PyTuple_Pack(3, r4, r5, r6)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice, the new IR is much more efficient!

JukkaL merged commit d69419c into python:master Oct 14, 2025
13 checks passed
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL