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

@ -10,7 +10,6 @@ import stat
import fnmatch
import collections
import errno
import warnings
try:
import zlib
@ -723,6 +722,7 @@ def rmtree(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None):
"""
if onerror is not None:
import warnings
warnings.warn("onerror argument is deprecated, use onexc instead",
DeprecationWarning, stacklevel=2)