File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 106106import threading
107107import unittest
108108import weakref
109+ try :
110+ import ctypes
111+ except ImportError :
112+ ctypes = None
109113from test .support import (run_doctest , run_unittest , cpython_only ,
110114 check_impl_detail )
111115
@@ -214,8 +218,7 @@ def callback(code):
214218 self .assertTrue (self .called )
215219
216220
217- if check_impl_detail (cpython = True ):
218- import ctypes
221+ if check_impl_detail (cpython = True ) and ctypes is not None :
219222 py = ctypes .pythonapi
220223 freefunc = ctypes .CFUNCTYPE (None ,ctypes .c_voidp )
221224
@@ -311,7 +314,7 @@ def test_main(verbose=None):
311314 from test import test_code
312315 run_doctest (test_code , verbose )
313316 tests = [CodeTest , CodeConstsTest , CodeWeakRefTest ]
314- if check_impl_detail (cpython = True ):
317+ if check_impl_detail (cpython = True ) and ctypes is not None :
315318 tests .append (CoExtra )
316319 run_unittest (* tests )
317320
You can’t perform that action at this time.
0 commit comments