Python Bytecode

Neal Norwitz neal at
Fri Aug 2 20:36:17 CEST 2002

On Fri, 02 Aug 2002 12:53:27 -0400, Terry Reedy wrote:

> <emailed and posted>
> "Michael Hudson" <mwh at> wrote ...
> Thanks.  I read this, found a couple of typos, and sent note to
> python-doc (don't have Source Forge login).
> Can you or someone answer a question regarding the following from the
> above:
> "
> JUMP_IF_TRUE    delta
> If TOS is true, increment the byte code counter by delta. TOS is left on
> the stack.
> JUMP_IF_FALSE    delta
> If TOS is false, increment the byte code counter by delta. TOS is not
> changed.
> "
> Why isn't TOS removed?  Or, at least, why isn't there alternative
> bytecode that does so?  Seems like most (all?) usages remove it anyway
> on both branches.  For example (from your python-dev post)

I think it was a mistake or limitation from a long time ago.
Not sure, I wasn't around then.

However, the problem is known.  When I was playing with removing it,
4 out of the six uses could be modified easily.  But there
were 2 places (I think it was with code like: if x or y and z:)
which couldn't be fixed easily.  The compiler is being rewritten
and hopefully fixing this will be easy once the rewrite is complete.


More information about the Python-list mailing list