File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 106
106
import threading
107
107
import unittest
108
108
import weakref
109
+ try :
110
+ import ctypes
111
+ except ImportError :
112
+ ctypes = None
109
113
from test .support import (run_doctest , run_unittest , cpython_only ,
110
114
check_impl_detail )
111
115
@@ -214,8 +218,7 @@ def callback(code):
214
218
self .assertTrue (self .called )
215
219
216
220
217
- if check_impl_detail (cpython = True ):
218
- import ctypes
221
+ if check_impl_detail (cpython = True ) and ctypes is not None :
219
222
py = ctypes .pythonapi
220
223
freefunc = ctypes .CFUNCTYPE (None ,ctypes .c_voidp )
221
224
@@ -311,7 +314,7 @@ def test_main(verbose=None):
311
314
from test import test_code
312
315
run_doctest (test_code , verbose )
313
316
tests = [CodeTest , CodeConstsTest , CodeWeakRefTest ]
314
- if check_impl_detail (cpython = True ):
317
+ if check_impl_detail (cpython = True ) and ctypes is not None :
315
318
tests .append (CoExtra )
316
319
run_unittest (* tests )
317
320
You can’t perform that action at this time.
0 commit comments