From cec00f41fcb117ea38bfec8960b80f936e360c2a Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Wed, 5 Sep 2018 03:28:39 +0200 Subject: [PATCH] Change if old scandir binary module is installed, fallback to slow Python. --- lib/scandir/scandir.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/scandir/scandir.py b/lib/scandir/scandir.py index d898d2d4..73d6fbf5 100644 --- a/lib/scandir/scandir.py +++ b/lib/scandir/scandir.py @@ -35,7 +35,12 @@ try: except ImportError: ctypes = None -if _scandir is None and ctypes is None: +if not getattr(_scandir, 'DirEntry', None): + import warnings + warnings.warn("scandir compiled _scandir C module is too old" + ", using slow generic fallback") + _scandir = None +elif _scandir is None and ctypes is None: import warnings warnings.warn("scandir can't find the compiled _scandir C module " "or ctypes, using slow generic fallback")