[pypy-issue] [issue864] numpy: initialize empty/zeros/ones with a tuple as size argument - with test

timo tracker at bugs.pypy.org
Wed Sep 7 12:54:44 CEST 2011

timo <timonator at perpetuum-immobile.de> added the comment:

here's a second patch that depends on the first one for raising a ValueError 
instead of a MemoryError when size is negative.

I've considered adding the check to SingleDimArray.__init__, but I felt, that 
the SingleDimArray constructor will only be called from code that interfaces 
with applevel code, anyway, so rather than checking for valid sizes every single 
time such a SingleDimArray is created, it would be less of a performance hit to 
check for negative sizes in the interfacing code (in this case, the function 
that unwraps a w_int or w_tuple for sizes, that is now used for ones, zeros and 

status: unread -> chatting

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list