@@ -34,6 +34,7 @@ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame;
3434#define sym_tuple_getitem _Py_uop_sym_tuple_getitem
3535#define sym_tuple_length _Py_uop_sym_tuple_length
3636#define sym_is_immortal _Py_uop_sym_is_immortal
37+ #define sym_new_truth _Py_uop_sym_new_truth
3738
3839extern int
3940optimize_to_bool (
@@ -391,14 +392,14 @@ dummy_func(void) {
391392
392393 op (_TO_BOOL , (value -- res )) {
393394 if (!optimize_to_bool (this_instr , ctx , value , & res )) {
394- res = sym_new_type (ctx , & PyBool_Type );
395+ res = sym_new_truth (ctx , value , false );
395396 }
396397 }
397398
398399 op (_TO_BOOL_BOOL , (value -- res )) {
399400 if (!optimize_to_bool (this_instr , ctx , value , & res )) {
400401 sym_set_type (value , & PyBool_Type );
401- res = value ;
402+ res = sym_new_truth ( ctx , value , false) ;
402403 }
403404 }
404405
@@ -430,6 +431,11 @@ dummy_func(void) {
430431 }
431432 }
432433
434+ op (_UNARY_NOT , (value -- res )) {
435+ sym_set_type (value , & PyBool_Type );
436+ res = sym_new_truth (ctx , value , true);
437+ }
438+
433439 op (_COMPARE_OP , (left , right -- res )) {
434440 if (oparg & 16 ) {
435441 res = sym_new_type (ctx , & PyBool_Type );
0 commit comments