summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_sys.py2
-rw-r--r--Lib/test/test_weakref.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 854e786..c50b20b 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -784,7 +784,7 @@ class SizeofTest(unittest.TestCase):
# buffer
# XXX
# builtin_function_or_method
- check(len, size('3P')) # XXX check layout
+ check(len, size('4P')) # XXX check layout
# bytearray
samples = [b'', b'u'*100000]
for sample in samples:
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index adb923f..7476273 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -92,6 +92,18 @@ class ReferencesTestCase(TestBase):
self.check_basic_callback(create_function)
self.check_basic_callback(create_bound_method)
+ @support.cpython_only
+ def test_cfunction(self):
+ import _testcapi
+ create_cfunction = _testcapi.create_cfunction
+ f = create_cfunction()
+ wr = weakref.ref(f)
+ self.assertIs(wr(), f)
+ del f
+ self.assertIsNone(wr())
+ self.check_basic_ref(create_cfunction)
+ self.check_basic_callback(create_cfunction)
+
def test_multiple_callbacks(self):
o = C()
ref1 = weakref.ref(o, self.callback)