[CRIU] [PATCH] [RFC] p.haul: close socket to the CRIU service if smth failed

Pavel Emelyanov xemul at parallels.com
Mon Mar 24 15:57:31 PDT 2014


On 03/24/2014 05:26 PM, Andrey Vagin wrote:
> This patch implements __exit__ and __enter__ methods for the
> criu_conn class and uses the "with" statement to access objects
> of this class.
> 
> """
> When the “with” statement is executed, Python evaluates the expression,
> calls the __enter__ method on the resulting value (which is called a
> “context guard”), and assigns whatever __enter__ returns to the variable
> given by as. Python will then execute the code body, and no matter what
> happens in that code, call the guard object’s __exit__ method.
> """

Isn't it easier just to call cc.close() at the end? Just wondering.


More information about the CRIU mailing list