Message52500
You could always check the value of sys.maxint. The test_bigrepeat below fails quickly on a 64-bit box if you don't have enough memory. :-) If you calculated 16 in the __mul__ calls based on sys.maxint, wouldn't that do what you want?
Perhaps something like:
reasonable_exp = 16
x *= 2 ** reasonable_exp
overflow_exp = int(math.log(sys.maxint, 2)) + 1 - reasonable_exp
self.assertRaises(MemoryError, x.__mul__, 2**overflow_exp)
|
|
Date |
User |
Action |
Args |
2007-08-23 15:58:11 | admin | link | issue1704621 messages |
2007-08-23 15:58:11 | admin | create | |
|