Re: [PATCH] git-p4: import the ctypes module
- From
Lars Schneider <larsxschneider@gmail.com>
- Date
- Oct 21, 2015, 20:00 UTC
- Message-ID
- <C5786C82-72C3-48C5-A8D0-8DD824F247C9@gmail.com>
- In-Reply-To
- <CAJA=mv7N=PmL69kgZRjq8P6J_qsfUbLx76WguhvqPrG2o1UFww@mail.gmail.com>
Hi Etienne,
thanks for reporting this! Junio is right, I messed that up on my Windows testing box! :-( Sorry! If you have any questions around submitting patches I am happy to help as I just recently went through the learning process myself!
@Dennis: Thanks for the quick patch!
Thanks, Lars
On 21 Oct 2015, at 10:23, Etienne Girard <etienne.g.girard@gmail.com> wrote:
Show 48 quoted lines
> Hello, > > I couldn't work further on this yesterday (but I read > Documentation/SubmittingPatches, which is a good start I guess). The > diff proposed by Dennis works on my machine, I'll try to figure out > why the original script worked with 2.7.10. > > Thanks > > 2015-10-21 1:00 GMT+02:00 Luke Diamand <luke@diamand.org>: >> On 20/10/15 20:36, Junio C Hamano wrote: >>> >>> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes: >>> >>>>> I do not follow Python development, but does the above mean that >>>>> with recent 2.x you can say ctypes without first saying "import >>>>> ctypes"? It feels somewhat non-pythonesque that identifiers like >>>>> this is given to you without you asking with an explicit 'import', >>>>> so I am puzzled. >>>> >>>> >>>> No, you cannot do that. The reason others may not have noticed this bug >>>> is that >>>> in git-p4.py, ctypes is only used on windows. >>>> >>>> 111 if platform.system() == 'Windows': >>>> 112 free_bytes = ctypes.c_ulonglong(0) >>>> 113 >>>> ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(os.getcwd()), >>>> None, None, ctypes.pointer(free_bytes)) >>>> >>>> The fact that it works for the OP with 2.7.10 is puzzling (assuming that >>>> it's >>>> on the same system). >>> >>> >>> Exactly. That is where my "I am puzzled" comes from. >>> >>> The patch looks obviously the right thing to do. Luke? Lars? >> >> >> It looks sensible to me, and works fine on Linux, thanks. ack. >> >> I can't test on Windows today but I can't see why it wouldn't work. >> >> Luke >> >>