gh-109653: Defer importing warnings in several modules (#110286)

This commit is contained in:
Alex Waygood 2023-10-04 06:09:43 +01:00 committed by GitHub
parent f02f26e293
commit bfe7e72522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 6 deletions

View file

@ -18,7 +18,6 @@ import contextlib
import io
import os
import sys
import warnings
__all__ = ["getpass","getuser","GetPassWarning"]
@ -118,6 +117,7 @@ def win_getpass(prompt='Password: ', stream=None):
def fallback_getpass(prompt='Password: ', stream=None):
import warnings
warnings.warn("Can not control echo on the terminal.", GetPassWarning,
stacklevel=2)
if not stream: