https://github.com/python/cpython/commit/614d79231d1e60d31b9452ea2afbc2a7d2f0034b
commit: 614d79231d1e60d31b9452ea2afbc2a7d2f0034b
branch: main
author: Nadeshiko Manju <m...@manjusaka.me>
committer: Fidget-Spinner <kenjin4...@gmail.com>
date: 2025-04-27T20:30:28+08:00
summary:

gh-131798: JIT - Use `sym_new_type` instead of `sym_new_not_null` for 
_BUILD_STRING, _BUILD_SET (GH-132564)

Signed-off-by: Manjusaka <m...@manjusaka.me>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst
M Python/optimizer_bytecodes.c
M Python/optimizer_cases.c.h

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst
new file mode 100644
index 00000000000000..a252d2b69fc020
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst
@@ -0,0 +1,2 @@
+Use ``sym_new_type`` instead of ``sym_new_not_null`` for _BUILD_STRING,
+_BUILD_SET
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index f862c9c8c6a840..567caad22554ea 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -977,6 +977,14 @@ dummy_func(void) {
         map = sym_new_type(ctx, &PyDict_Type);
     }
 
+    op(_BUILD_STRING, (values[oparg] -- str)) {
+        str = sym_new_type(ctx, &PyUnicode_Type);
+    }
+
+    op(_BUILD_SET, (values[oparg] -- set)) {
+        set = sym_new_type(ctx, &PySet_Type);
+    }
+
     op(_UNPACK_SEQUENCE_TWO_TUPLE, (seq -- val1, val0)) {
         val0 = sym_tuple_getitem(ctx, seq, 0);
         val1 = sym_tuple_getitem(ctx, seq, 1);
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index c92b036eb56463..679240b6efa315 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -1032,7 +1032,7 @@
 
         case _BUILD_STRING: {
             JitOptSymbol *str;
-            str = sym_new_not_null(ctx);
+            str = sym_new_type(ctx, &PyUnicode_Type);
             stack_pointer[-oparg] = str;
             stack_pointer += 1 - oparg;
             assert(WITHIN_STACK_BOUNDS());
@@ -1073,7 +1073,7 @@
 
         case _BUILD_SET: {
             JitOptSymbol *set;
-            set = sym_new_not_null(ctx);
+            set = sym_new_type(ctx, &PySet_Type);
             stack_pointer[-oparg] = set;
             stack_pointer += 1 - oparg;
             assert(WITHIN_STACK_BOUNDS());

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to