[PATCH 3 of 7 V2] transaction: add onclose/onabort hook for pre-close logic
Gregory Szorc
gregory.szorc at gmail.com
Mon Mar 31 19:14:21 CDT 2014
On 3/31/14, 5:07 PM, Pierre-Yves David wrote:
>
>
> On 03/31/2014 04:19 PM, Durham Goode wrote:
>> + if self.count == 1 and self.onclose:
>> + self.onclose()
>
> `onclose is not None`
>
> Please, otherwise this is going to bit someone in 31.4 months
>
>> @@ -149,6 +155,9 @@
>> self.usages = 0
>> self.file.close()
>>
>> + if self.onabort:
>> + self.onabort()
>
> `onabort is not None`
This is an anti-pattern in Python. Unless you are trying to
differentiate None from False from [] from {} from '' from any other
type whose __nonzero__ can return False, the explicit type comparison
can be safely left out.
More information about the Mercurial-devel
mailing list