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

Appearance settings

Commit 52ce698

Browse filesBrowse files
committed
Fix review idea
Signed-off-by: Manjusaka <me@manjusaka.me>
1 parent 1662b47 commit 52ce698
Copy full SHA for 52ce698

File tree

2 files changed

+20
-3
lines changed
Filter options

2 files changed

+20
-3
lines changed

‎Python/optimizer_bytecodes.c

Copy file name to clipboardExpand all lines: Python/optimizer_bytecodes.c
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,16 @@ dummy_func(void) {
10881088
res = sym_new_type(ctx, &PyLong_Type);
10891089
}
10901090

1091-
op(_GET_LEN, (-- len)) {
1092-
len = sym_new_type(ctx, &PyLong_Type);
1091+
op(_GET_LEN, (obj -- obj, len)) {
1092+
int tuple_length = sym_tuple_length(obj);
1093+
if (tuple_length == -1) {
1094+
// Unknown length
1095+
len = sym_new_type(ctx, &PyLong_Type);
1096+
}
1097+
else {
1098+
assert(tuple_length >= 0);
1099+
len = sym_new_const(ctx, PyLong_FromLong(tuple_length));
1100+
}
10931101
}
10941102

10951103
op(_GUARD_CALLABLE_LEN, (callable, unused, unused -- callable, unused, unused)) {

‎Python/optimizer_cases.c.h

Copy file name to clipboardExpand all lines: Python/optimizer_cases.c.h
+10-1Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.