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

[mypyc] feat: extend `get_expr_length` to try `constant_fold_expr` [1/4] by BobTheBuidler · Pull Request #19930 · python/mypy · GitHub

Repository navigation

[mypyc] feat: extend get_expr_length to try constant_fold_expr [1/4] - #19930

Merged
hauntsaninja merged 19 commits into
python:masterfrom
BobTheBuidler:patch-8
Dec 10, 2025
Merged

hauntsaninja merged 19 commits into
python:masterfrom
BobTheBuidler:patch-8

Conversation

BobTheBuidler commented Sep 26, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

Among other things, get_expr_length currently supports StrExpr, BytesExpr, and string-type Final values.

constant_fold_expr already has the code to parse values from all of these, so we can use it to deduplicate code in get_expr_length.

It's able to parse a few more Expressions than our existing implementation, not that any of these are particularly relevant at the moment, and allows get_expr_length to automatically benefit from more relevant future constant-folding enhancements.

This PR is ready for review. All of the get_expr_length PRs are entirely independent and can be reviewed/merged in any order.

BobTheBuidler and others added 2 commits September 25, 2025 23:49
get_expr_len currently support StrExpr, BytesExpr, and string-type Final values

constant_fold_expr already has the code to parse values from all of these, so we can deduplicate code by using it

It's able to parse a few more Expressions than our existing implementation, and allows get_expr_length to automatically benefit from future constant-folding enhancements
BobTheBuidler changed the title [mypyc] feat: extend get_expr_len to try constant_fold_expr [mypyc] feat: extend get_expr_length to try constant_fold_expr Sep 26, 2025
BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to try constant_fold_expr [mypyc] feat: extend get_expr_length to try constant_fold_expr [review me next plz] Oct 1, 2025
BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to try constant_fold_expr [review me next plz] [mypyc] feat: extend get_expr_length to try constant_fold_expr [1/4] Oct 1, 2025
hauntsaninja merged commit 0430236 into python:master Dec 10, 2025
16 checks passed
BobTheBuidler deleted the patch-8 branch December 11, 2025 14:57
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.

3 participants


Back | FazBrowse Home | New Git URL