8000 gh-131798: JIT: Narrow the return type of `_GET_LEN` to int by Zheaoli · Pull Request #133345 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131798: JIT: Narrow the return type of _GET_LEN to int #133345

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

Merged
merged 23 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Fix review idea
Signed-off-by: Manjusaka <me@manjusaka.me>
  • Loading branch information
Zheaoli committed May 8, 2025
commit 52ce69827de5d584abf0097c6f672858e5eaf7e9
12 changes: 10 additions & 2 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,16 @@ dummy_func(void) {
res = sym_new_type(ctx, &PyLong_Type);
}

op(_GET_LEN, (-- len)) {
len = sym_new_type(ctx, &PyLong_Type);
op(_GET_LEN, (obj -- obj, len)) {
int tuple_length = sym_tuple_length(obj);
if (tuple_length == -1) {
// Unknown length
len = sym_new_type(ctx, &PyLong_Type);
}
else {
assert(tuple_length >= 0);
len = sym_new_const(ctx, PyLong_FromLong(tuple_length));
}
}

op(_GUARD_CALLABLE_LEN, (callable, unused, unused -- callable, unused, unused)) {
Expand Down
11 changes: 10 additions & 1 deletion Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
0