Skip to content

Commit 82202f4

Browse files
committed
Move numpy compatibility imports to the compat package. Remove them from __all__, as that's not needed for compatibility.
1 parent 731a65e commit 82202f4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

distutils/ccompiler.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
from .compilers.C import base
2-
from .compilers.C.base import (
3-
# `_default_compilers` is needed by numpy.distutils, which is supported until
4-
# Python 3.11 is deprecated. This import & export can be removed when
5-
# Python 3.11 is no longer supported by distutils.
1+
from .compat.numpy import ( # noqa: F401
62
_default_compilers,
73
compiler_class,
4+
)
5+
from .compilers.C import base
6+
from .compilers.C.base import (
87
gen_lib_options,
98
gen_preprocess_options,
109
get_default_compiler,
@@ -16,8 +15,6 @@
1615
__all__ = [
1716
'CompileError',
1817
'LinkError',
19-
'_default_compilers',
20-
'compiler_class',
2118
'gen_lib_options',
2219
'gen_preprocess_options',
2320
'get_default_compiler',

distutils/compat/numpy.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# required for older numpy versions on Pythons prior to 3.12; see pypa/setuptools#4876
2+
from ..compilers.C.base import _default_compilers, compiler_class

0 commit comments

Comments
 (0)