From: Junio C Hamano <gitster@pobox•com>
To: Dennis Kaarsemaker <dennis@kaarsemaker•net>
Cc: Luke Diamand <luke@diamand•org>,
Lars Schneider <larsxschneider@gmail•com>,
Etienne Girard <etienne.g.girard@gmail•com>,
Git Users <git@vger•kernel.org>
Subject: Re: [PATCH] git-p4: import the ctypes module
Date: Tue, 20 Oct 2015 12:36:02 -0700 [thread overview]
Message-ID: <xmqqwpuh72ot.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1445369506.8543.10.camel@kaarsemaker.net> (Dennis Kaarsemaker's message of "Tue, 20 Oct 2015 21:31:46 +0200")
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?
>
> diff --git a/git-p4.py b/git-p4.py
> index daa60c6..212ef2b 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -24,6 +24,7 @@ import shutil
> import stat
> import zipfile
> import zlib
> +import ctypes
>
> try:
> from subprocess import CalledProcessError
next prev parent reply other threads:[~2015-10-20 19:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 10:34 Git-p4 fails with NameError with python 2.7.2 Etienne Girard
2015-10-20 13:57 ` Luke Diamand
2015-10-20 16:00 ` Junio C Hamano
2015-10-20 16:42 ` Manlio Perillo
2015-10-20 19:31 ` [PATCH] git-p4: import the ctypes module Dennis Kaarsemaker
2015-10-20 19:36 ` Junio C Hamano [this message]
2015-10-20 23:00 ` Luke Diamand
2015-10-21 8:23 ` Etienne Girard
2015-10-21 9:54 ` Etienne Girard
2015-10-21 20:00 ` Lars Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwpuh72ot.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=dennis@kaarsemaker$(echo .)net \
--cc=etienne.g.girard@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=larsxschneider@gmail$(echo .)com \
--cc=luke@diamand$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox