[Numpy-discussion] distutils issue - python 3.1 on windows
Mon Aug 2 12:52:12 CDT 2010
On Mon, Aug 2, 2010 at 12:48, Pauli Virtanen <email@example.com> wrote:
> Mon, 02 Aug 2010 23:48:52 +0800, Ralf Gommers wrote:
>> I'm trying to get building to work with Python 3.1 under Wine on OS X.
>> The first thing you run into is a python distutils problem, which is
>> fixed by replacing line 379 of cygwinccompiler.py with
>> result = RE_VERSION.search(str(out_string))
> That's going to bust when out_string contains stuff that does not fit in
> I don't remember how this was addressed in the rest of distutils.
>> The next thing I run into is a numpy.distutils issue (complete build
>> output below email):
>> line 177, in link
>> AttributeError: 'function' object has no attribute '__func__'
>> What I think that line is for is to test what kind of arguments can be
>> passed to 'func', but I'm really not sure. A comment would have been
>> helpful, that must be the most obscure line of Python code I've ever
>> seen:) Does anyone have any idea what causes this error?
> This is change in the code object internals in Python 3, and 2to3 doesn't
> seem able make the conversions automatically. I don't remember exactly
> how it goes, but there are other instances of this in Numpy -- need to do
> one thing on Python 2 and another on Python 3.
> Anyway, here it seems like the `inspect` module should be used -- no need
> to go mucking with in the code objects to just find the number of
> arguments for a function.
> Nobody has tested this part of the distutils code on Python 3, and indeed
> it does not have any tests, so it's not a surprise that stuff like this
> is left over :)
I believe we avoided the inspect module because it is quite expensive
to import. It may not matter inside numpy.distutils, but be wary of
"fixing" things to use inspect elsewhere. It would be worth extracting
the commonly-used pieces of inspect (and hacks like this) into an
internal utility module that is fast to import.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion