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 intopython:mainfrom
bytes as constants in _Py_uop_sym_is_safe_const#136033Conversation
|
One thing that slightly worries me about this is that comparing |
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? |
|
I opened PR #136040 to fix the compact ints issue. |
Did you mean checking for |
You can fetch the value once at the start of optimization time in |
|
Or, simpler, just explicitly disallow optimizing the problematic comparisons. |
|
If one of the values is of type bytes, require the other to be as well. |
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 |
Not BytesWarning. BINARY_OP (str, bytes) will throw. |
|
That’s the case for many combinations of safe types. We should suppress the error and hit bottom in that case (in the |
|
Same for |
|
This is just different because it’s a warning, to clarify. |
Yeah the optimizer currently doesn't do that. Opened a PR to do so #136048 |
|
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? |
We plan to follow up shortly with COMPARE_OP here #130415 |
|
Ok then :) |
Uh oh!
There was an error while loading. Please reload this page.