Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[mypyc] feat: optimize f-string building from Final values#19611

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JukkaL merged 35 commits intopython:masterfromBobTheBuidler:patch-3
Aug 15, 2025
Merged
Changes from1 commit
Commits
Show all changes
35 commits
Select commitHold shift + click to select a range
12e0a9d
WIP [mypyc] optimize f-string building
BobTheBuidlerAug 7, 2025
5b44af1
Update specialize.py
BobTheBuidlerAug 7, 2025
fc40c81
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 7, 2025
61970f5
Update specialize.py
BobTheBuidlerAug 7, 2025
c5ebd11
Update specialize.py
BobTheBuidlerAug 11, 2025
8a68800
Update specialize.py
BobTheBuidlerAug 11, 2025
996d852
Update specialize.py
BobTheBuidlerAug 11, 2025
3fe0a63
Update specialize.py
BobTheBuidlerAug 11, 2025
c817b67
Update specialize.py
BobTheBuidlerAug 11, 2025
8636006
Update specialize.py
BobTheBuidlerAug 11, 2025
5cee243
Update specialize.py
BobTheBuidlerAug 11, 2025
8b50424
Update specialize.py
BobTheBuidlerAug 11, 2025
712b10a
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
ad58850
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 11, 2025
a69ea3f
Update format_str_tokenizer.py
BobTheBuidlerAug 11, 2025
5351050
Update format_str_tokenizer.py
BobTheBuidlerAug 11, 2025
5b32541
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
0a03849
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
a68c9f8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 11, 2025
0216858
Update specialize.py
BobTheBuidlerAug 11, 2025
6047b0f
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
7b3ca5b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 11, 2025
ceb0e03
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
ba03d50
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
fc973df
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
029b657
Update irbuild-str.test
BobTheBuidlerAug 11, 2025
8064845
fix ir whitespace
BobTheBuidlerAug 11, 2025
55c4a8d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 11, 2025
e71e215
Merge branch 'master' into patch-3
BobTheBuidlerAug 13, 2025
417fa73
Update specialize.py
BobTheBuidlerAug 13, 2025
aed4c1d
add more tests
BobTheBuidlerAug 13, 2025
1de5018
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 13, 2025
212bee8
Update specialize.py
BobTheBuidlerAug 14, 2025
80a97a9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Aug 14, 2025
60c8af0
Merge branch 'master' into patch-3
BobTheBuidlerAug 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Update specialize.py
  • Loading branch information
@BobTheBuidler
BobTheBuidler authoredAug 11, 2025
commit8636006619c0ded4ce5c8c49f97983549887de6b
5 changes: 3 additions & 2 deletionsmypyc/irbuild/specialize.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,7 @@
RefExpr,
StrExpr,
TupleExpr,
Var,
)
from mypy.types import AnyType, TypeOfAny
from mypyc.ir.ops import (
Expand DownExpand Up@@ -719,12 +720,12 @@ def get_literal_str(expr: Expression) -> str | None:
if isinstance(expr, StrExpr):
return expr.value
elif isinstance(expr, RefExpr) and isinstance(expr.node, Var) and expr.node.final_value is not None:
return str(expr.final_value)
return str(expr.node.final_value)
return None

while len(exprs) >= i + 2 and is_literal_str(exprs[i]) and is_literal_str(exprs[i + 1]):
first = exprs[i]
concatenated = get_literal_str(first) + get_literal_str(exprs[i + 1])
concatenated = get_literal_str(first) + get_literal_str(exprs[i + 1]) # type: ignore [operator]
exprs = [*exprs[:i], StrExpr(concatenated, first.line), *exprs[i + 2 :]]
format_ops = [*format_ops[:i], format_ops[i + 1], *format_ops[i + 2 :]]

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp