Re: [PATCH v2 05/12] simpletrace: Changed Analyzer class to become context-manager

2023-05-15 Thread Mads Ynddal
> > Bearing in mind compatibility with existing simpletrace analysis > scripts, how about the following default method implementations? > > def __enter__(self): > self.begin() > > def __exit__(self, exc_type, exc_val, exc_tb): > if exc_type is None: > self.end() > ret

Re: [PATCH v2 05/12] simpletrace: Changed Analyzer class to become context-manager

2023-05-09 Thread Stefan Hajnoczi
On Tue, May 02, 2023 at 11:23:32AM +0200, Mads Ynddal wrote: > From: Mads Ynddal > > Instead of explicitly calling `begin` and `end`, we can change the class > to use the context-manager paradigm. This is mostly a styling choice, > used in modern Python code. But it also allows for more advanced

[PATCH v2 05/12] simpletrace: Changed Analyzer class to become context-manager

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method (not