diff options
author | shireenrao <shireenrao@gmail.com> | 2019-08-08 20:02:49 (GMT) |
---|---|---|
committer | Paul Moore <p.f.moore@gmail.com> | 2019-08-08 20:02:49 (GMT) |
commit | f4e725f224b864bf9bf405ff7f863cda46fca1cd (patch) | |
tree | 694f5ea767d27a66344401171f1bfc494c48581f /Lib | |
parent | 2a570af12ac5e4ac5575a68f8739b31c24d01367 (diff) | |
download | cpython-f4e725f224b864bf9bf405ff7f863cda46fca1cd.zip cpython-f4e725f224b864bf9bf405ff7f863cda46fca1cd.tar.gz cpython-f4e725f224b864bf9bf405ff7f863cda46fca1cd.tar.bz2 |
bpo-25172: Raise appropriate ImportError msg when crypt module used on Windows (GH-15149)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/crypt.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/crypt.py b/Lib/crypt.py index b0e47f4..8846602 100644 --- a/Lib/crypt.py +++ b/Lib/crypt.py @@ -1,6 +1,15 @@ """Wrapper to the POSIX crypt library call and associated functionality.""" -import _crypt +import sys as _sys + +try: + import _crypt +except ModuleNotFoundError: + if _sys.platform == 'win32': + raise ImportError("The crypt module is not supported on Windows") + else: + raise ImportError("The required _crypt module was not built as part of CPython") + import string as _string from random import SystemRandom as _SystemRandom from collections import namedtuple as _namedtuple |