Uh oh!
There was an error while loading. Please reload this page.
gh-132732: Treat bytes as constants in _Py_uop_sym_is_safe_const - #136033
gh-132732: Treat bytes as constants in _Py_uop_sym_is_safe_const#136033sobolevn wants to merge 2 commits into
bytes as constants in _Py_uop_sym_is_safe_const#136033Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
brandtbucher
commented
Jun 27, 2025
One thing that slightly worries me about this is that comparing |
Fidget-Spinner
commented
Jun 27, 2025
Ok let's not do this then. We still need to fix the long stuff though so @sobolevn are you open to that or do you want me to handle it? |
Fidget-Spinner
commented
Jun 27, 2025
I opened PR #136040 to fix the compact ints issue. |
sobolevn
commented
Jun 27, 2025
Did you mean checking for |
You can fetch the value once at the start of optimization time in |
brandtbucher
commented
Jun 27, 2025
Or, simpler, just explicitly disallow optimizing the problematic comparisons. |
brandtbucher
commented
Jun 27, 2025
If one of the values is of type bytes, require the other to be as well. |
Fidget-Spinner
commented
Jun 27, 2025
Not just comparisons. BINARY_OP as well. This is a little annoying and more involved than I expected, so I'd say let's just ignore it for now? |
What |
Fidget-Spinner
commented
Jun 27, 2025
Not BytesWarning. BINARY_OP (str, bytes) will throw. |
brandtbucher
commented
Jun 27, 2025
That’s the case for many combinations of safe types. We should suppress the error and hit bottom in that case (in the |
brandtbucher
commented
Jun 27, 2025
Same for |
brandtbucher
commented
Jun 27, 2025
This is just different because it’s a warning, to clarify. |
Fidget-Spinner
commented
Jun 27, 2025
Yeah the optimizer currently doesn't do that. Opened a PR to do so #136048 |
sobolevn
commented
Jun 27, 2025
I opened https://discuss.python.org/t/consider-deprecating-and-eventually-removing-b-cli-flag/96903 about possibly removing this warning in the future versions. It does not seem very useful :( |
I fixed the merge conflict. Sorry, I am rather new to the JIT internals, and I don't quite understand the
Is there anything I need to do in this PR to address them? |
Fidget-Spinner
commented
Jun 27, 2025
We plan to follow up shortly with COMPARE_OP here #130415 |
sobolevn
commented
Jun 27, 2025
Ok then :) |
Uh oh!
There was an error while loading. Please reload this page.