Skip to content

Commit e65987d

Browse files
authored
gh-146547: Use lazy imports in ctypes (GH-146548)
1 parent dfeb160 commit e65987d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Lib/ctypes/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

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

7+
lazy import sysconfig as _sysconfig
8+
89
from _ctypes import Union, Structure, Array
910
from _ctypes import _Pointer
1011
from _ctypes import CFuncPtr as _CFuncPtr

Lib/ctypes/_layout.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
"""
66

77
import sys
8-
import warnings
98

109
from _ctypes import CField, buffer_info
1110
import ctypes
1211

12+
lazy import warnings
13+
1314
def round_down(n, multiple):
1415
assert n >= 0
1516
assert multiple > 0

Lib/ctypes/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
2-
import shutil
3-
import subprocess
42
import sys
53

4+
lazy import shutil
5+
lazy import subprocess
6+
67
# find_library(name) returns the pathname of a library, or None.
78
if os.name == "nt":
89

0 commit comments

Comments
 (0)