Re: [virt-manager] [PATCH 5/5] pycodestyle: Do not use bare 'except:'

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

 



On 07/24/2017 04:26 AM, Radostin Stoyanov wrote:
> A bare 'except:' catches all exceptions [1], including SystemExit,
> KeyboardInterrupt, and GeneratorExit (which is not an error and should
> not normally be caught by user code). In situations where you need to
> catch all “normal” errors, you can catch the base class for all normal
> exceptions, Exception [2].
> 
> [1] https://docs.python.org/2/howto/doanddont.html#except
> [2] https://docs.python.org/2/library/exceptions.html#Exception

Huh, I never knew that distinction, I thought SystemExit always needed to be
caught explicitly. Thanks for the explanation, I've pushed this patch now

Thanks,
Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux