All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Michael Goldish <mgoldish@redhat.com>,
	autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings
Date: Wed, 05 Jan 2011 18:22:45 +0200	[thread overview]
Message-ID: <4D249AD5.8010109@redhat.com> (raw)
In-Reply-To: <20110105162127.GE3361@otherpad.lan.raisama.net>

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


  reply	other threads:[~2011-01-05 16:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 15:45 [KVM-AUTOTEST PATCH v2 1/6] [RFC] Fix Unhandled* exceptions Michael Goldish
2011-01-05 15:45 ` [KVM-AUTOTEST PATCH v2 2/6] [RFC] CmdError: remove extra blank line between methods Michael Goldish
2011-01-05 15:45 ` [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings Michael Goldish
2011-01-05 15:54   ` Eduardo Habkost
2011-01-05 16:12   ` Avi Kivity
2011-01-05 16:21     ` Eduardo Habkost
2011-01-05 16:22       ` Avi Kivity [this message]
2011-01-05 18:55       ` Michael Goldish
2011-01-05 19:10         ` Eduardo Habkost
2011-01-05 16:21     ` Avi Kivity
2011-01-05 16:36       ` Eduardo Habkost
2011-01-05 16:39         ` Avi Kivity
2011-01-06 11:56       ` Michael Goldish
2011-01-05 15:45 ` [KVM-AUTOTEST PATCH v2 4/6] [RFC] Embed context information in exception strings Michael Goldish
2011-01-05 15:45 ` [KVM-AUTOTEST PATCH v2 5/6] [RFC] KVM test: use error.context() in migration_with_file_transfer Michael Goldish
2011-01-05 15:45 ` [KVM-AUTOTEST PATCH v2 6/6] [RFC] KVM test: use error.context() in kvm_preprocessing.py Michael Goldish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D249AD5.8010109@redhat.com \
    --to=avi@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mgoldish@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.