Is there any way to get Python's interpreter to compile any Python code into a NOP instruction?
(I'm specifically talking about obtaining bytecode via compiling Python code, not generating it directly.)
Is there any way to get Python's interpreter to compile any Python code into a NOP instruction?
(I'm specifically talking about obtaining bytecode via compiling Python code, not generating it directly.)
This appears to be impossible. NOP opcodes are only generated by the peephole optimizer, but the last step of peephole optimization removes all NOPs and retargets jumps for the new instruction indices.
In fact, barring bugs, this seems likely to have been impossible in every Python version ever released. In Python 2.3, there was no NOP opcode, and in Python 2.4, the peephole optimizer already removed all NOPs it generated.