Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Thank you for your PR Mark.

The main difference between PR 5883 and PR 5112 is that in PR 5883 the pair of 
old WITH_CLEANUP_FINISH and END_FINALLY are replaced with a single new 
WITH_CLEANUP_FINISH, and in PR 5112 it is replaced with a sequence of 7 opcodes 
including a new opcode RERAISE.

    POP_JUMP_IF_TRUE  L
    RERAISE
L:
    POP_TOP
    POP_TOP
    POP_TOP
    POP_EXCEPT
    POP_TOP

This doesn't affect a performance in normal case because this code is executed 
only when an exception has been raised (an in that case the performance is less 
important). And seems this doesn't introduce new race conditions.

The number of opcodes is the same in both PRs. The implementation of RERAISE in 
ceval.c in PR 5112 is a tiny bit simpler than the implementation of 
WITH_CLEANUP_FINISH in PR 5883. But the generated bytecode and the compiler are 
a tiny bit simpler in PR 5883. If RERAISE be used for other purposes besides 
implementing a "with" statement, it would be a great advantage.

For now both approaches look to me not having significant advantages or 
disadvantages against the other one. Does anybody have preferences?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32949>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to