Skip to content

Commit

Permalink
pythongh-118761: Speedup pathlib import by deferring shutil (python#1…
Browse files Browse the repository at this point in the history
…23520)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
3 people authored Sep 1, 2024
1 parent 42a8189 commit 2304774
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/pathlib/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import operator
import os
import posixpath
import shutil
import sys
from glob import _StringGlobber
from itertools import chain
Expand Down Expand Up @@ -824,7 +823,10 @@ def rmdir(self):
"""
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):
"""
Expand Down

0 comments on commit 2304774

Please sign in to comment.