summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2022-12-04 18:26:29 +0100
committerArmin Rigo <arigo@tunes.org>2022-12-04 18:26:29 +0100
commit97d2ed49cebd47618fa1cee435085a2bdd64fcd3 (patch)
tree24f91859b92c6e9356c57d64755d276fdcb3551b /testing
parent5701750b89042b73af15630f4561f0d81f206ce2 (diff)
downloadcffi-97d2ed49cebd47618fa1cee435085a2bdd64fcd3.tar.gz
Issue 553
Two missing calls to PyObject_GC_UnTrack()
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi0/test_ffi_backend.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/cffi0/test_ffi_backend.py b/testing/cffi0/test_ffi_backend.py
index 2545d1f..399fb77 100644
--- a/testing/cffi0/test_ffi_backend.py
+++ b/testing/cffi0/test_ffi_backend.py
@@ -159,6 +159,24 @@ class TestFFI(backend_tests.BackendTests,
assert p.bcd == 9999999
assert p.foo.data[3] != 78 # has been overwritten with 9999999
+ def test_issue553(self):
+ import gc, warnings
+ ffi = FFI(backend=self.Backend())
+ p = ffi.new("int *", 123)
+ with warnings.catch_warnings(record=True) as w:
+ ffi.gc(p, lambda x: None)
+ gc.collect()
+ assert w == []
+
+ def test_issue553_from_buffer(self):
+ import gc, warnings
+ ffi = FFI(backend=self.Backend())
+ buf = b"123"
+ with warnings.catch_warnings(record=True) as w:
+ ffi.from_buffer(buf)
+ gc.collect()
+ assert w == []
+
class TestBitfield:
def check(self, source, expected_ofs_y, expected_align, expected_size):