Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import posixpath
import sys
from errno import *
from glob import _StringGlobber, _no_recurse_symlinks
from itertools import chain
from stat import (
S_IMODE, S_ISDIR, S_ISREG, S_ISLNK, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO,
)
from _collections_abc import Sequence
lazy import shutil
lazy from glob import _StringGlobber, _no_recurse_symlinks

try:
import pwd
Expand Down Expand Up @@ -1255,8 +1256,6 @@ def _delete(self):
if self.is_symlink() or self.is_junction():
self.unlink()
elif self.is_dir():
# Lazy import to improve module import time
import shutil
shutil.rmtree(self)
else:
self.unlink()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pathlib/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_is_notimplemented(self):
class LazyImportTest(unittest.TestCase):
@cpython_only
def test_lazy_import(self):
import_helper.ensure_lazy_imports("pathlib", {"shutil"})
import_helper.ensure_lazy_imports("pathlib", {"glob", "shutil"})


#
Expand Down
Loading