[Python-Dev] What is the purpose of NEXT_BLOCK()?

Guido van Rossum guido at python.org
Wed Mar 21 11:13:32 EDT 2018

Maybe spelunking in the Python 2 branch will help? It seems it was
introduced in 2005 by Jeremy Hylton with this comment:

/* The distinction between NEW_BLOCK and NEXT_BLOCK is subtle.  (I'd
   like to find better names.)  NEW_BLOCK() creates a new block and sets
   it as the current block.  NEXT_BLOCK() also creates an implicit jump
   from the current block to the new block.

That comment (and NEW_BLOCK()) are no longer found in the Python 3 source.

On Wed, Mar 21, 2018 at 3:52 AM, Serhiy Storchaka <storchaka at gmail.com>

> There is the NEXT_BLOCK() macro in compile.c. It creates a new block,
> creates an implicit jump from the current block to the new block, and sets
> it as the current block.
> But why it is used? All seems working if remove NEXT_BLOCK(). If there was
> a need of NEXT_BLOCK() (if it reduces the computational complexity of
> compilation or allows some optimizations), it should be documented, and we
> should analyze the code and add missed NEXT_BLOCK() where they are needed,
> and perhaps add new tests. Otherwise it can be removed.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%
> 40python.org

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180321/49c6d855/attachment-0001.html>

More information about the Python-Dev mailing list