@@ -28,7 +28,8 @@ def _types(self):
28
28
29
29
def check_getitem_with_type (self , tp ):
30
30
b = tp (self ._source )
31
- oldrefcount = sys .getrefcount (b )
31
+ # XXX GraalVM change - no refcount
32
+ # oldrefcount = sys.getrefcount(b)
32
33
m = self ._view (b )
33
34
self .assertEqual (m [0 ], ord (b"a" ))
34
35
self .assertIsInstance (m [0 ], int )
@@ -45,7 +46,7 @@ def check_getitem_with_type(self, tp):
45
46
self .assertRaises (TypeError , lambda : m [0.0 ])
46
47
self .assertRaises (TypeError , lambda : m ["a" ])
47
48
m = None
48
- self .assertEqual (sys .getrefcount (b ), oldrefcount )
49
+ # self.assertEqual(sys.getrefcount(b), oldrefcount)
49
50
50
51
def test_getitem (self ):
51
52
for tp in self ._types :
@@ -61,22 +62,24 @@ def test_setitem_readonly(self):
61
62
if not self .ro_type :
62
63
self .skipTest ("no read-only type to test" )
63
64
b = self .ro_type (self ._source )
64
- oldrefcount = sys .getrefcount (b )
65
+ # XXX GraalVM change - no refcount
66
+ # oldrefcount = sys.getrefcount(b)
65
67
m = self ._view (b )
66
68
def setitem (value ):
67
69
m [0 ] = value
68
70
self .assertRaises (TypeError , setitem , b"a" )
69
71
self .assertRaises (TypeError , setitem , 65 )
70
72
self .assertRaises (TypeError , setitem , memoryview (b"a" ))
71
73
m = None
72
- self .assertEqual (sys .getrefcount (b ), oldrefcount )
74
+ # self.assertEqual(sys.getrefcount(b), oldrefcount)
73
75
74
76
def test_setitem_writable (self ):
75
77
if not self .rw_type :
76
78
self .skipTest ("no writable type to test" )
77
79
tp = self .rw_type
78
80
b = self .rw_type (self ._source )
79
- oldrefcount = sys .getrefcount (b )
81
+ # XXX GraalVM change - no refcount
82
+ # oldrefcount = sys.getrefcount(b)
80
83
m = self ._view (b )
81
84
m [0 ] = ord (b'1' )
82
85
self ._check_contents (tp , b , b"1bcdef" )
@@ -121,7 +124,7 @@ def setitem(key, value):
121
124
self .assertRaises (ValueError , setitem , slice (0 ,2 ), b"a" )
122
125
123
126
m = None
124
- self .assertEqual (sys .getrefcount (b ), oldrefcount )
127
+ # self.assertEqual(sys.getrefcount(b), oldrefcount)
125
128
126
129
def test_delitem (self ):
127
130
for tp in self ._types :
@@ -205,14 +208,15 @@ def test_getbuffer(self):
205
208
# Test PyObject_GetBuffer() on a memoryview object.
206
209
for tp in self ._types :
207
210
b = tp (self ._source )
208
- oldrefcount = sys .getrefcount (b )
211
+ # XXX GraalVM change - no refcount
212
+ # oldrefcount = sys.getrefcount(b)
209
213
m = self ._view (b )
210
- oldviewrefcount = sys .getrefcount (m )
214
+ # oldviewrefcount = sys.getrefcount(m)
211
215
s = str (m , "utf-8" )
212
216
self ._check_contents (tp , b , s .encode ("utf-8" ))
213
- self .assertEqual (sys .getrefcount (m ), oldviewrefcount )
217
+ # self.assertEqual(sys.getrefcount(m), oldviewrefcount)
214
218
m = None
215
- self .assertEqual (sys .getrefcount (b ), oldrefcount )
219
+ # self.assertEqual(sys.getrefcount(b), oldrefcount)
216
220
217
221
def test_gc (self ):
218
222
for tp in self ._types :
@@ -443,6 +447,7 @@ def _view(self, obj):
443
447
def _check_contents (self , tp , obj , contents ):
444
448
self .assertEqual (obj [1 :7 ], tp (contents ))
445
449
450
+ @test .support .impl_detail ("refcounting" , graalvm = False )
446
451
def test_refs (self ):
447
452
for tp in self ._types :
448
453
m = memoryview (tp (self ._source ))
0 commit comments