Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/05/2011 06:21 PM, Eduardo Habkost wrote:
On Wed, Jan 05, 2011 at 06:12:05PM +0200, Avi Kivity wrote:
>  It would be nice to make the error context a stack, and to use the
>  with statement to manage the stack:
>
>
>     with error.context("main test"):
>         foo()
>         with error.context("before reboot"):
>             bar()
>
>  If foo() throws an exception, the context would be "main test",
>  while if bar() throws an exception, the context would be "before
>  reboot" in "main test".

Autotest targets Python 2.4, and Python 2.4 doesn't have the 'with'
statement.


Too bad :(

The error context is already a stack, but without the 'with' statement
you would have to use try/finally explicitly:

   _new_context('foo')
   try:
     # [...]
   finally:
     _pop_context()

By the way, I think we could make _new_context() and _pop_context() part
of the public interface (i.e. remove the "_" from their names).  I see
@context_aware as just a helper for a stack interface that could be used
directly if needed.


Yeah.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux