[Numpy-discussion] numpy 2.0, what else to do?

Xavier Gnata xavier.gnata@gmail....
Sat Feb 13 15:07:14 CST 2010


On 02/13/2010 09:28 PM, Pauli Virtanen wrote:
> We will most likely have experimental py3 support in 2.0.
>
> If you, or someone else wishes to help bringing 2.0 to fully work with Py3, now is a very good time to step up.
>
> How to give a hand:
>
> 1. Get my latest py3 branch from http://github.com/pv/numpy-work/tree/py3k
>
> Read doc/py3k.txt
>
> 2. Get py3 branch of nose (see doc/py3k.txt in the branch). 
>
> 3. Build numpy, and run unit tests (build with "NPY_SEPARATE_BUILD=1 python3 setup.py build", numscons is not supported at the moment).
>
> 4. Fix bugs revealed by the unit tests. Currently, C code is mostly ported, so you can probably also help only by writing Python. There are about 100 test failures (of 2400) left.
>
> Many test failures occur also because the tests are wrong. For instance: the numpy I/O requires bytes, but some tests supply it unicode strings -> need changes in tests.
>
> One useful thing to do is to help with the str/bytes transition on the python side. Since the same code must work with pythons from 2.4 to 3.0 (for 3 it's automatically run through 2to3 on build), there are some helpers in numpy.compat.py3k for helping with this. See several previous commits on the branch on that.
>
> Another useful thing could be to port an existing numpy-using code to py3 and test if it works with the current py3k branch, what fails, and if the failures are already revealed by unit tests. Even if it does not work at the moment, having it at hand will help testing the rc when it comes. This, because I wouldn't completely rely on our unit test coverage.
>
> Finally, try to write some PEP 3118 using code, and check how it works. (You can use python >= 2.6 for this if you get numpy from the py3k branch.)
>
>   
Well I don't know where I should report that but your branch doesn't
compile with python3.1:
numpy/core/blasdot/_dotblas.c: In function
‘dotblas_matrixproduct’:                       
numpy/core/blasdot/_dotblas.c:404: error: ‘PyArrayObject’ has no member
named ‘ob_type’   
numpy/core/blasdot/_dotblas.c:404: error: ‘PyArrayObject’ has no member
named ‘ob_type’   
numpy/core/blasdot/_dotblas.c:407: error: ‘PyArrayObject’ has no member
named ‘ob_type’   

and so on...


AFAICS, it is easy to fix using the Py_TYPE macro.

For instance:
-  if (ap1->ob_type != ap2->ob_type) {
+ if (Py_TYPE(ap1) != Py_TYPE(ap2)) {

Xavier


More information about the NumPy-Discussion mailing list