Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(122378)

Side by Side Diff: Lib/ctypes/test/test_refcounts.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/ctypes/test/test_prototypes.py ('k') | Lib/ctypes/test/test_returnfuncptrs.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os
1 import unittest 2 import unittest
2 from test import support 3 from test import support
3 import ctypes 4 import ctypes
4 import gc 5 import gc
5 6
6 MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int) 7 MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int)
7 OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong) 8 OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong)
8 9
9 import _ctypes_test 10 import _ctypes_test
10 dll = ctypes.CDLL(_ctypes_test.__file__) 11 dll = ctypes.CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABLE' ]))
11 12
12 class RefcountTestCase(unittest.TestCase): 13 class RefcountTestCase(unittest.TestCase):
13 14
14 @support.refcount_test 15 @support.refcount_test
15 def test_1(self): 16 def test_1(self):
16 from sys import getrefcount as grc 17 from sys import getrefcount as grc
17 18
18 f = dll._testfunc_callback_i_if 19 f = dll._testfunc_callback_i_if
19 f.restype = ctypes.c_int 20 f.restype = ctypes.c_int
20 f.argtypes = [ctypes.c_int, MyCallback] 21 f.argtypes = [ctypes.c_int, MyCallback]
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 def func(a, b): 93 def func(a, b):
93 return a * b * 2 94 return a * b * 2
94 f = proto(func) 95 f = proto(func)
95 96
96 a = sys.getrefcount(ctypes.c_int) 97 a = sys.getrefcount(ctypes.c_int)
97 f(1, 2) 98 f(1, 2)
98 self.assertEqual(sys.getrefcount(ctypes.c_int), a) 99 self.assertEqual(sys.getrefcount(ctypes.c_int), a)
99 100
100 if __name__ == '__main__': 101 if __name__ == '__main__':
101 unittest.main() 102 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_prototypes.py ('k') | Lib/ctypes/test/test_returnfuncptrs.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+