Skip to content

Commit 3138c77

Browse files
committed
Must be const
1 parent 1ccfa7f commit 3138c77

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ dummy_func(void) {
856856
}
857857

858858
op(_CALL_STR_1, (unused, unused, arg -- res)) {
859-
if (sym_matches_type(arg, &PyUnicode_Type)) {
860-
// e.g. str('foo') or str(foo) where foo is known to be a string
859+
if (sym_matches_type(arg, &PyUnicode_Type) && sym_is_const(ctx, arg)) {
860+
// e.g. str('foo') or str(foo) where foo is known to be a string const
861861
PyObject *value = sym_get_const(ctx, arg);
862862
res = sym_new_const(ctx, value);
863863
}

Python/optimizer_cases.c.h

Lines changed: 1 addition & 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)