From f635544a4be9f69d663809be834d14a0e16e1080 Mon Sep 17 00:00:00 2001 From: "Gregory M. Turner" Date: Mon, 12 Sep 2016 21:37:24 -0700 Subject: [PATCH 1/2] distutils type checks can fail (issue 23102) Avoid goofy setuptools behavior when using from foo.bar import baz import style with "Extension". --- Lib/distutils/command/build_ext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 5e51ae4..ba7a614 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -352,7 +352,8 @@ class build_ext(Command): "'ext_modules' option must be a list of Extension instances") for i, ext in enumerate(extensions): - if isinstance(ext, Extension): + # Is it an Extension instance or duck-type thereof? + if hasattr(ext, 'define_macros'): continue # OK! (assume type-checking done # by Extension constructor) -- 2.9.3