@@ -1475,6 +1475,26 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
14751475 _Py_uop_sym_apply_predicate_narrowing (ctx , ref , true);
14761476 TEST_PREDICATE (!_Py_uop_sym_is_const (ctx , subject ), "predicate narrowing incorrectly narrowed subject (inverted/true)" );
14771477
1478+ subject = _Py_uop_sym_new_unknown (ctx );
1479+ value = _Py_uop_sym_new_const (ctx , one_obj );
1480+ ref = _Py_uop_sym_new_predicate (ctx , subject , value , JIT_PRED_IS );
1481+ if (PyJitRef_IsNull (subject ) || PyJitRef_IsNull (value ) || PyJitRef_IsNull (ref )) {
1482+ goto fail ;
1483+ }
1484+ TEST_PREDICATE (_Py_uop_sym_matches_type (ref , & PyBool_Type ), "predicate is not boolean" );
1485+ TEST_PREDICATE (_Py_uop_sym_truthiness (ctx , ref ) == -1 , "predicate is not unknown" );
1486+ TEST_PREDICATE (_Py_uop_sym_is_const (ctx , ref ) == false, "predicate is constant" );
1487+ TEST_PREDICATE (_Py_uop_sym_get_const (ctx , ref ) == NULL , "predicate is not NULL" );
1488+ TEST_PREDICATE (_Py_uop_sym_is_const (ctx , value ) == true, "value is not constant" );
1489+ TEST_PREDICATE (_Py_uop_sym_get_const (ctx , value ) == one_obj , "value is not 1" );
1490+ _Py_uop_sym_set_const (ctx , ref , Py_False );
1491+ TEST_PREDICATE (_Py_uop_sym_matches_type (ref , & PyBool_Type ), "predicate is not boolean" );
1492+ TEST_PREDICATE (_Py_uop_sym_truthiness (ctx , ref ) == 0 , "predicate is not False" );
1493+ TEST_PREDICATE (_Py_uop_sym_is_const (ctx , ref ) == true, "predicate is not constant" );
1494+ TEST_PREDICATE (_Py_uop_sym_get_const (ctx , ref ) == Py_False , "predicate is not False" );
1495+ TEST_PREDICATE (_Py_uop_sym_is_const (ctx , value ) == true, "value is not constant" );
1496+ TEST_PREDICATE (_Py_uop_sym_get_const (ctx , value ) == one_obj , "value is not 1" );
1497+
14781498 val_big = PyNumber_Lshift (_PyLong_GetOne (), PyLong_FromLong (66 ));
14791499 if (val_big == NULL ) {
14801500 goto fail ;
0 commit comments