[Python-checkins] r60793 - in python/branches/release25-maint: Include/pymem.h Include/pyport.h Lib/test/test_array.py Lib/test/test_struct.py Misc/NEWS Modules/_csv.c Modules/_struct.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/cPickle.c Modules/cStringIO.c Modules/cjkcodecs/multibytecodec.c Modules/datetimemodule.c Modules/md5.c Modules/rgbimgmodule.c Modules/stropmodule.c Objects/bufferobject.c Objects/listobject.c Objects/obmalloc.c Parser/node.c Python/asdl.c Python/ast.c Python/bltinmodule.c Python/compile.c

Nick Coghlan ncoghlan at gmail.com
Thu Feb 14 14:40:09 CET 2008


martin.v.loewis wrote:
> Modified: python/branches/release25-maint/Lib/test/test_array.py
> ==============================================================================
> --- python/branches/release25-maint/Lib/test/test_array.py	(original)
> +++ python/branches/release25-maint/Lib/test/test_array.py	Thu Feb 14 12:26:18 2008
> @@ -975,6 +975,23 @@
>  class DoubleTest(FPTest):
>      typecode = 'd'
>      minitemsize = 8
> +
> +    def test_alloc_overflow(self):
> +        a = array.array('d', [-1]*65536)
> +        try:
> +            a *= 65536
> +        except MemoryError:
> +            pass
> +        else:
> +            self.fail("a *= 2**16 didn't raise MemoryError")
> +        b = array.array('d', [ 2.71828183, 3.14159265, -1])
> +        try:
> +            b * 1431655766
> +        except MemoryError:
> +            pass
> +        else:
> +            self.fail("a * 1431655766 didn't raise MemoryError")
> +

Will those tests necessarily work properly on a 64-bit machine? The 
sizes being tested seem very 32-bit-ish (and the relevant arraymodule 
code seems to adjust dynamically to the larger 64-bit address space).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-checkins mailing list