[Numpy-discussion] distutils issue - python 3.1 on windows

Pauli Virtanen pav@iki...
Mon Aug 2 12:48:37 CDT 2010

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):
>   File
> "Z:\Users\rgommers\Code\numpy\build\py3k\numpy\distutils
> line 177, in link
>     func(*args[:func.__func__.__code__.co_argcount])
> 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 :)

Pauli Virtanen

More information about the NumPy-Discussion mailing list