Change if old scandir binary module is installed, fallback to slow Python.

This commit is contained in:
Prinz23 2018-09-05 03:28:39 +02:00 committed by JackDandy
parent 1a3f0e8a7e
commit cec00f41fc

View file

@ -35,7 +35,12 @@ try:
except ImportError: except ImportError:
ctypes = None 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 import warnings
warnings.warn("scandir can't find the compiled _scandir C module " warnings.warn("scandir can't find the compiled _scandir C module "
"or ctypes, using slow generic fallback") "or ctypes, using slow generic fallback")