bytecode JUMP_IF_* always followed by POP_TOP?

Robert Brewer fumanchu at amor.org
Thu Apr 22 17:17:00 EDT 2004


Tim Peters wrote:
> [Robert Brewer]
> > Playing around with bytecodes some more:
> > ...
> > I notice that, whether JUMP_IF_FALSE jumps or not, the next
> > instruction it executes is POP_TOP
> > ...
> > Are there any constructions whereby this does not happen for
> > JUMP_IF_FALSE and JUMP_IF_TRUE?
> 
> Try
> 
>     x and y
> 
> and
> 
>     x or y
> 
> When those jump, they want to retain the tested value, so 
> there's no POP_TOP
> at the branch target then.

Ah. They only POP_TOP if they *don't* jump. Got it. Thanks!


Der Fu Man




More information about the Python-list mailing list