[PATCH] Issue 3832 - STARTF_USESHOWWINDOW not available on WinNT Python 2.6.6

Steve Barnes gadgetsteve at hotmail.com
Wed Feb 20 00:03:04 CST 2013


On 20/02/13 01:42, Siddharth Agarwal wrote:
> On 02/19/2013 01:11 AM, Steve Barnes wrote:
>>
>> # HG changeset patch
>>
>> # User Steve Barnes <gadgetsteve at hotmail.com>
>>
>> # Date 1361263154 0
>>
>> # Node ID 97b7c13ff8173c257143b9bcabb8ad726ade98cc
>>
>> # Parent 5fe53db61aa433018de8b0ee296db868f666cee7
>>
>> util: cope with missing subprocess.startf_useshowwindow in python 
>> 2.6.x on nt (issue3832)
>>
>
> This is too long. I'd suggest something like
>
> "util: hardcode STARTF_USESHOWWINDOW"
>
> with a note in the full message explaining why (it isn't present in 
> some newer versions of Python).
>
>> -    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
>>
>> +    if hasattr(subprocess, 'STARTF_USESHOWWINDOW'):  # Not all 
>> pythons have this
>>
>> +        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
>>
>
> Why not just hardcode the value? That's 1 according to 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms686331%28v=vs.85%29.aspx.
>
>
Personally I am never comfortable with adding mystery hard coded values 
nor with sending undocumented - as in not a part of the user interface 
flags to a library call.  The way that I suggested will use the flag as 
it is if it available and ignore it if it is not. Just my 2c worth.

Steve

-- 
Steve /Gadget/ Barnes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130220/f9219a0d/attachment.html>


More information about the Mercurial-devel mailing list