New GitHub issue #118910 from markshannon:<br>

<hr>

<pre>
The tier 2 optimizer specification (optimizer_bytecodes.c) contains lots of boilerplate for handling contradictions and running out of space in the optimizer's data structures.
These can be handled but setting flags on the optimizer context and checking those in the abstract interpreter loop.

For example 
`OUT_OF_SPACE_IF_NULL(res = sym_new_unknown(ctx));` can be replaced with `res = sym_new_unknown(ctx)`
and 
```C
if (!sym_set_type(right, &PyUnicode_Type)) {
    goto hit_bottom;
}
```
can be replaced with `sym_set_type(left, &PyUnicode_Type);`

Hopefully this will make the optimizer a bit more approachable and maintainable
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/118910">View on GitHub</a>
<p>Labels: </p>
<p>Assignee: </p>