Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-144280: Add missing predicate symbol to case-switch#144298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
reidenong wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromreidenong:fix-predicate-symbol-bug
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletionsPython/optimizer_symbols.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,9 @@ _PyUOpSymPrint(JitOptRef ref)
case JIT_SYM_COMPACT_INT:
printf("<compact_int at %p>", (void *)sym);
break;
case JIT_SYM_PREDICATE_TAG:
printf("<predicate at %p>", (void *)sym);
break;
default:
printf("<tag=%d at %p>", sym->tag, (void *)sym);
break;
Expand DownExpand Up@@ -666,6 +669,7 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef ref)
case JIT_SYM_NON_NULL_TAG:
case JIT_SYM_UNKNOWN_TAG:
case JIT_SYM_COMPACT_INT:
case JIT_SYM_PREDICATE_TAG:
return -1;
case JIT_SYM_KNOWN_CLASS_TAG:
/* TODO :
Expand DownExpand Up@@ -1471,6 +1475,26 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
_Py_uop_sym_apply_predicate_narrowing(ctx, ref, true);
TEST_PREDICATE(!_Py_uop_sym_is_const(ctx, subject), "predicate narrowing incorrectly narrowed subject (inverted/true)");

subject = _Py_uop_sym_new_unknown(ctx);
value = _Py_uop_sym_new_const(ctx, one_obj);
ref = _Py_uop_sym_new_predicate(ctx, subject, value, JIT_PRED_IS);
if (PyJitRef_IsNull(subject) || PyJitRef_IsNull(value) || PyJitRef_IsNull(ref)) {
goto fail;
}
TEST_PREDICATE(_Py_uop_sym_matches_type(ref, &PyBool_Type), "predicate is not boolean");
TEST_PREDICATE(_Py_uop_sym_truthiness(ctx, ref) == -1, "predicate is not unknown");
TEST_PREDICATE(_Py_uop_sym_is_const(ctx, ref) == false, "predicate is constant");
TEST_PREDICATE(_Py_uop_sym_get_const(ctx, ref) == NULL, "predicate is not NULL");
TEST_PREDICATE(_Py_uop_sym_is_const(ctx, value) == true, "value is not constant");
TEST_PREDICATE(_Py_uop_sym_get_const(ctx, value) == one_obj, "value is not 1");
_Py_uop_sym_set_const(ctx, ref, Py_False);
TEST_PREDICATE(_Py_uop_sym_matches_type(ref, &PyBool_Type), "predicate is not boolean");
TEST_PREDICATE(_Py_uop_sym_truthiness(ctx, ref) == 0, "predicate is not False");
TEST_PREDICATE(_Py_uop_sym_is_const(ctx, ref) == true, "predicate is not constant");
TEST_PREDICATE(_Py_uop_sym_get_const(ctx, ref) == Py_False, "predicate is not False");
TEST_PREDICATE(_Py_uop_sym_is_const(ctx, value) == true, "value is not constant");
TEST_PREDICATE(_Py_uop_sym_get_const(ctx, value) == one_obj, "value is not 1");

val_big = PyNumber_Lshift(_PyLong_GetOne(), PyLong_FromLong(66));
if (val_big == NULL) {
goto fail;
Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp