bpo-25172: Raise appropriate ImportError msg when crypt module used on Windows (GH-15149)

(cherry picked from commit f4e725f224)

Co-authored-by: shireenrao <shireenrao@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-08-13 14:27:14 -07:00 committed by GitHub
parent 6ad902a088
commit 7f7f74734a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -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