@@ -14,10 +14,10 @@ cdef class TestMemoryAllocator():
14
14
>>> from memory_allocator.test import TestMemoryAllocator
15
15
>>> mem = TestMemoryAllocator()
16
16
>>> _ = mem.malloc(100)
17
- >>> mem.malloc(2**63 )
17
+ >>> mem.malloc(mem.size_t_max() )
18
18
Traceback (most recent call last):
19
19
...
20
- MemoryError: failed to allocate 9223372036854775808 bytes
20
+ MemoryError: failed to allocate ... bytes
21
21
"""
22
22
return < size_t> self .mem.malloc(size)
23
23
@@ -28,10 +28,10 @@ cdef class TestMemoryAllocator():
28
28
>>> from memory_allocator.test import TestMemoryAllocator
29
29
>>> mem = TestMemoryAllocator()
30
30
>>> _ = mem.calloc(100, 10)
31
- >>> mem.calloc(2**63 , 1)
31
+ >>> mem.calloc(mem.size_t_max() , 1)
32
32
Traceback (most recent call last):
33
33
...
34
- MemoryError: failed to allocate 9223372036854775808 * 1 bytes
34
+ MemoryError: failed to allocate ... * 1 bytes
35
35
"""
36
36
return < size_t> self .mem.calloc(nmemb, size)
37
37
@@ -42,10 +42,10 @@ cdef class TestMemoryAllocator():
42
42
>>> from memory_allocator.test import TestMemoryAllocator
43
43
>>> mem = TestMemoryAllocator()
44
44
>>> _ = mem.allocarray(100, 10)
45
- >>> mem.allocarray(2**63 , 1)
45
+ >>> mem.allocarray(size_t_max() , 1)
46
46
Traceback (most recent call last):
47
47
...
48
- MemoryError: failed to allocate 9223372036854775808 * 1 bytes
48
+ MemoryError: failed to allocate ... * 1 bytes
49
49
"""
50
50
return < size_t> self .mem.allocarray(nmemb, size)
51
51
@@ -142,3 +142,6 @@ cdef class TestMemoryAllocator():
142
142
143
143
def size (self ):
144
144
return self .mem.size
145
+
146
+ def size_t_max (self ):
147
+ return < size_t> - 1
0 commit comments