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

Appearance settings

GH-131798: Remove guard for known type in TO_BOOL_STR #131816

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Break down TO_BOOL_STR into guard and to-bool
  • Loading branch information
fluhus committed Mar 26, 2025
commit ddcb309455e38be365e2d421f8df50b173035d50
2 changes: 1 addition & 1 deletion 2 Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

193 changes: 97 additions & 96 deletions 193 Include/internal/pycore_uop_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion 6 Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion 9 Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,14 @@ dummy_func(
res = PyStackRef_False;
}

inst(TO_BOOL_STR, (unused/1, unused/2, value -- res)) {
op(_GUARD_TOS_UNICODE, (value-- value)) {
brandtbucher marked this conversation as resolved.
Show resolved Hide resolved
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
EXIT_IF(!PyUnicode_CheckExact(value_o));
}

op(_TO_BOOL_STR, (value-- res)) {
brandtbucher marked this conversation as resolved.
Show resolved Hide resolved
STAT_INC(TO_BOOL, hit);
PyObject* value_o = PyStackRef_AsPyObjectBorrow(value);
brandtbucher marked this conversation as resolved.
Show resolved Hide resolved
if (value_o == &_Py_STR(empty)) {
assert(_Py_IsImmortal(value_o));
DEAD(value);
Expand All @@ -528,6 +532,9 @@ dummy_func(
}
}

macro(TO_BOOL_STR) =
_GUARD_TOS_UNICODE + unused / 1 + unused / 2 + _TO_BOOL_STR;
brandtbucher marked this conversation as resolved.
Show resolved Hide resolved

op(_REPLACE_WITH_TRUE, (value -- res)) {
PyStackRef_CLOSE(value);
res = PyStackRef_True;
Expand Down
11 changes: 9 additions & 2 deletions 11 Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.