mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	fix for issue 3862: test_array fails FreeBSD 7 amd64
FreeBSD 7's underlying malloc() is behaves differently to earlier versions and seriously overcommits available memory on amd64. This may affect other 64bit platforms in some circumstances, so the scale of the problematic test is wound back. Patch by Mark Dickinson, reviewed by Martin von Loewis.
This commit is contained in:
		
							parent
							
								
									0806749e63
								
							
						
					
					
						commit
						bf24401a1f
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -1011,20 +1011,21 @@ class DoubleTest(FPTest):
 | 
				
			||||||
    minitemsize = 8
 | 
					    minitemsize = 8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_alloc_overflow(self):
 | 
					    def test_alloc_overflow(self):
 | 
				
			||||||
 | 
					        from sys import maxsize
 | 
				
			||||||
        a = array.array('d', [-1]*65536)
 | 
					        a = array.array('d', [-1]*65536)
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            a *= 65536
 | 
					            a *= maxsize//65536 + 1
 | 
				
			||||||
        except MemoryError:
 | 
					        except MemoryError:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.fail("a *= 2**16 didn't raise MemoryError")
 | 
					            self.fail("Array of size > maxsize created - MemoryError expected")
 | 
				
			||||||
        b = array.array('d', [ 2.71828183, 3.14159265, -1])
 | 
					        b = array.array('d', [ 2.71828183, 3.14159265, -1])
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            b * 1431655766
 | 
					            b * (maxsize//3 + 1)
 | 
				
			||||||
        except MemoryError:
 | 
					        except MemoryError:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.fail("a * 1431655766 didn't raise MemoryError")
 | 
					            self.fail("Array of size > maxsize created - MemoryError expected")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests.append(DoubleTest)
 | 
					tests.append(DoubleTest)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue