diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-03-13 09:40:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 09:40:28 (GMT) |
commit | aa7bcf284f006434b07839d82f325618f7a5c06c (patch) | |
tree | f295c0cc868042e4096466ce97a53e0dad05d25d /Lib/shutil.py | |
parent | 8332e85b2f079e8b9334666084d1f8495cff25c1 (diff) | |
download | cpython-aa7bcf284f006434b07839d82f325618f7a5c06c.zip cpython-aa7bcf284f006434b07839d82f325618f7a5c06c.tar.gz cpython-aa7bcf284f006434b07839d82f325618f7a5c06c.tar.bz2 |
gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421)
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r-- | Lib/shutil.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index f8be82d..94b0950 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -681,7 +681,7 @@ def _rmtree_safe_fd(topfd, path, onexc): continue if is_dir: try: - dirfd = os.open(entry.name, os.O_RDONLY, dir_fd=topfd) + dirfd = os.open(entry.name, os.O_RDONLY | os.O_NONBLOCK, dir_fd=topfd) dirfd_closed = False except FileNotFoundError: continue @@ -786,7 +786,7 @@ def rmtree(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None): onexc(os.lstat, path, err) return try: - fd = os.open(path, os.O_RDONLY, dir_fd=dir_fd) + fd = os.open(path, os.O_RDONLY | os.O_NONBLOCK, dir_fd=dir_fd) fd_closed = False except OSError as err: onexc(os.open, path, err) |