On Tue, Oct 20, 2015 at 6:00 PM, Junio C Hamano wrote:
>
> Luke Diamand writes:
>
> > On 20 October 2015 at 11:34, Etienne Girard
> > wrote:
> >> Hello,
> >>
> >> Git-p4 fail when I try to rebase with the error: "NameError: global
> >> name 'ctypes' is not defined". The error occurs when I use python
> >> 2.7.2 that is installed by default on my company's computers (it goes
> >> without saying that everything works fine with python 2.7.10).
> >>
> >> I'm a beginner in python, but simply importing ctypes at the beginning
> >> of the script does the trick. I was wondering if submitting a patch
> >> for this issue is worth the trouble, when a satisfying solution is not
> >> using a 4 years old version of python.
> >
> > If you're able to submit a patch that would be great!
>
> Lars's 4d25dc44 (git-p4: check free space during streaming,
> 2015-09-26) introduced two references to ctypes.* and there is no
> 'import ctypes' anywhere in the script.
>
> 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"?
No.
You need to import the ctypes module.
However in Python it is possible to "inject" the ctypes module (and
any other name) in the builtin namespace.
The builtin module contains names that are accessible without importing them:
https://docs.python.org/2/library/__builtin__.html
IMHO, some code is messing with the __builtin__ module.
Running pyflakes on git-p4.py code I get:
git-p4.py:26: 'zlib' imported but unused
git-p4.py:640: local variable 'v' is assigned to but never used
git-p4.py:2114: local variable 'rhs_index' is assigned to but never used
Running pylint I get a **lot** of warning and style issues; and the
following errors:
E:112,21: Undefined variable 'ctypes' (undefined-variable)
E:113, 8: Undefined variable 'ctypes' (undefined-variable)
E:113,51: Undefined variable 'ctypes' (undefined-variable)
E:113,94: Undefined variable 'ctypes' (undefined-variable)
E:1002,51: No value for argument 'contentFile' in method call
(no-value-for-parameter)
pyflakes is not reporting an error for ctypes.
Whatever the cause, the code must be fixed to import the ctypes module.
P.S.:
Sorry for the double message.
The first message contained an HTML part and was rejected by vger.kernel.org.
Regards Manlio
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html