Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Typo in _GUARD_BOTH_UNICODE dsl #130903

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

Closed
ordinary-jamie opened this issue Mar 6, 2025 · 0 comments
Closed

Typo in _GUARD_BOTH_UNICODE dsl #130903

ordinary-jamie opened this issue Mar 6, 2025 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@ordinary-jamie
Copy link
Contributor

ordinary-jamie commented Mar 6, 2025

Bug report

Bug description:

There appears to be a typo in the optimizer_bytecodes for _GUARD_BOTH_UNICODE where the right operand is not getting checked:

op(_GUARD_BOTH_UNICODE, (left, right -- left, right)) {
if (sym_matches_type(left, &PyUnicode_Type) &&
sym_matches_type(right, &PyUnicode_Type)) {
REPLACE_OP(this_instr, _NOP, 0 ,0);
}
sym_set_type(left, &PyUnicode_Type);
sym_set_type(left, &PyUnicode_Type);

Original change from gh-118910:

https://github.com/python/cpython/pull/118913/files#diff-e5bd2b14b0b10f0f47786e26306d689ed1361c3dc3b11dcc3ea52b8a2422ff64L151-R141

N.b. I'm not very familiar with this part of the code-base and just happened to stumble upon this when studying through it; apologies if I misunderstood something 🙏

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

No response

Linked PRs

@ordinary-jamie ordinary-jamie added the type-bug An unexpected behavior, bug, or error label Mar 6, 2025
vstinner pushed a commit that referenced this issue Mar 6, 2025
@vstinner vstinner closed this as completed Mar 6, 2025
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants