RFC: Proposal: Deterministic Object Destruction

Chris Angelico rosuav at gmail.com
Mon Mar 5 09:36:09 EST 2018


On Tue, Mar 6, 2018 at 1:25 AM, Ooomzay <ooomzay at gmail.com> wrote:
> Ahah... I see now you are running it from a shell so the exception is staying in scope. We just need to include normal exception handling in the example to fix this:-
>
> def main():
>     try:
>         c = C()
>         c.dostuff()
>     except:
>         print("Boom!")
>
> main()
>

So RAII depends on absorbing every exception close to where the
resource is being managed? You can't permit that exception to bubble
up lest the resource get leaked??

ChrisA



More information about the Python-list mailing list