Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-04 Thread Eduardo Habkost
On Tue, Jan 04, 2011 at 12:56:16AM +0200, Michael Goldish wrote: On 01/04/2011 12:06 AM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 07:22:17PM -0200, Eduardo Habkost wrote: [...] If you want to be extra careful, you can keep an index of contexts for each exception ever seen, and clear

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-04 Thread Eduardo Habkost
On Tue, Jan 04, 2011 at 12:56:16AM +0200, Michael Goldish wrote: I think that's risky: try: vm.create() # context aware, raises an exception except: try: vm.destroy() # context aware, raises an exception except: pass raise Heh, did you try the code

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Eduardo Habkost
On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: +# Exception context information: +# -- +# Every function can have some context string associated with it. +# The context string can be changed by calling context(str) and cleared by +# calling

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Eduardo Habkost
On Mon, Jan 03, 2011 at 05:26:20PM -0200, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: +# Exception context information: +# -- +# Every function can have some context string associated with it. +# The context string

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Michael Goldish
On 01/03/2011 09:26 PM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: +# Exception context information: +# -- +# Every function can have some context string associated with it. +# The context string can be changed by

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Eduardo Habkost
On Mon, Jan 03, 2011 at 09:48:02PM +0200, Michael Goldish wrote: On 01/03/2011 09:26 PM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: +# Exception context information: +# -- +# Every function can have some context

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Eduardo Habkost
On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: + +context_data = threading.local() +context_data.contexts = {} Won't this create a single dictionary, only for one single thread, leaving all other threads with 'context_data.contexts' undefined? -- Eduardo -- To unsubscribe

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Michael Goldish
On 01/03/2011 10:26 PM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: + +context_data = threading.local() +context_data.contexts = {} Won't this create a single dictionary, only for one single thread, leaving all other threads with

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Michael Goldish
On 01/03/2011 10:16 PM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 09:48:02PM +0200, Michael Goldish wrote: On 01/03/2011 09:26 PM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 08:34:07PM +0200, Michael Goldish wrote: +# Exception context information: +# --

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Eduardo Habkost
On Mon, Jan 03, 2011 at 11:07:53PM +0200, Michael Goldish wrote: If I understand your suggestion correctly, then: - The purpose of contexts is to add information to exceptions. If an exception is raised and you call clear_context() in a finally clause, you remove the context of the

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

2011-01-03 Thread Michael Goldish
On 01/04/2011 12:06 AM, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 07:22:17PM -0200, Eduardo Habkost wrote: On Mon, Jan 03, 2011 at 11:07:53PM +0200, Michael Goldish wrote: If I understand your suggestion correctly, then: - The purpose of contexts is to add information to exceptions. If