Skip to content

Commit 1ed0ec6

Browse files
authored
Load sysconfig only when needed
1 parent 5992238 commit 1ed0ec6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/ctypes/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os as _os
44
import sys as _sys
5-
import sysconfig as _sysconfig
65
import types as _types
76

87
from _ctypes import Union, Structure, Array
@@ -550,7 +549,9 @@ def LoadLibrary(self, name):
550549
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
551550
elif _sys.platform in ["android", "cygwin"]:
552551
# These are Unix-like platforms which use a dynamically-linked libpython.
553-
pythonapi = PyDLL(_sysconfig.get_config_var("LDLIBRARY"))
552+
import sysconfig # delay import
553+
pythonapi = PyDLL(sysconfig.get_config_var("LDLIBRARY"))
554+
del sysconfig
554555
else:
555556
pythonapi = PyDLL(None)
556557

0 commit comments

Comments
 (0)