mirror of https://github.com/python/cpython
gh-118761: Speedup pathlib import by deferring shutil (#123520)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
42a818912b
commit
2304774465
|
@ -3,7 +3,6 @@ import ntpath
|
|||
import operator
|
||||
import os
|
||||
import posixpath
|
||||
import shutil
|
||||
import sys
|
||||
from glob import _StringGlobber
|
||||
from itertools import chain
|
||||
|
@ -824,7 +823,10 @@ class Path(PathBase, PurePath):
|
|||
"""
|
||||
os.rmdir(self)
|
||||
|
||||
_rmtree = shutil.rmtree
|
||||
def _rmtree(self):
|
||||
# Lazy import to improve module import time
|
||||
import shutil
|
||||
shutil.rmtree(self)
|
||||
|
||||
def rename(self, target):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue