FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-73991: Use same signature for `shutil._rmtree_[un]safe()`. by barneygale · Pull Request #120517 · python/cpython · GitHub

/ cpython Public

GH-73991: Use same signature for shutil._rmtree_[un]safe(). - #120517

Merged
barneygale merged 1 commit into
python:mainfrom
barneygale:gh-73991-rmtree-common-api
Jun 18, 2024
Merged

GH-73991: Use same signature for shutil._rmtree_[un]safe().#120517
barneygale merged 1 commit into
python:mainfrom
barneygale:gh-73991-rmtree-common-api

Conversation

barneygale commented Jun 14, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Preparatory work for moving _rmtree_unsafe() and _rmtree_safe_fd() to pathlib._os so that they can be used from both shutil and pathlib.

Move implementation-specific setup from rmtree() into the safe/unsafe functions, and give them the same signature (path, dir_fd, onexc).

In the tests, mock os.open rather than _rmtree_safe_fd() to ensure the FD-based walk is used, and replace a couple references to shutil._use_fd_functions with shutil.rmtree.avoids_symlink_attacks (which has the same value).

No change of behaviour.

Preparatory work for moving `_rmtree_unsafe()` and `_rmtree_safe_fd()` to
`pathlib._os` so that they can be used from both `shutil` and `pathlib`.

Move implementation-specific setup from `rmtree()` into the safe/unsafe
functions, and give them the same signature `(path, dir_fd, onexc)`.

In the tests, mock `os.open` rather than `_rmtree_safe_fd()` to ensure the
FD-based walk is used, and replace a couple references to
`shutil._use_fd_functions` with `shutil.rmtree.avoids_symlink_attacks`
(which has the same value).

No change of behaviour.
barneygale merged commit 69058e2 into python:main Jun 18, 2024
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
…ython#120517)

Preparatory work for moving `_rmtree_unsafe()` and `_rmtree_safe_fd()` to
`pathlib._os` so that they can be used from both `shutil` and `pathlib`.

Move implementation-specific setup from `rmtree()` into the safe/unsafe
functions, and give them the same signature `(path, dir_fd, onexc)`.

In the tests, mock `os.open` rather than `_rmtree_safe_fd()` to ensure the
FD-based walk is used, and replace a couple references to
`shutil._use_fd_functions` with `shutil.rmtree.avoids_symlink_attacks`
(which has the same value).

No change of behaviour.
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
…ython#120517)

Preparatory work for moving `_rmtree_unsafe()` and `_rmtree_safe_fd()` to
`pathlib._os` so that they can be used from both `shutil` and `pathlib`.

Move implementation-specific setup from `rmtree()` into the safe/unsafe
functions, and give them the same signature `(path, dir_fd, onexc)`.

In the tests, mock `os.open` rather than `_rmtree_safe_fd()` to ensure the
FD-based walk is used, and replace a couple references to
`shutil._use_fd_functions` with `shutil.rmtree.avoids_symlink_attacks`
(which has the same value).

No change of behaviour.
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…ython#120517)

Preparatory work for moving `_rmtree_unsafe()` and `_rmtree_safe_fd()` to
`pathlib._os` so that they can be used from both `shutil` and `pathlib`.

Move implementation-specific setup from `rmtree()` into the safe/unsafe
functions, and give them the same signature `(path, dir_fd, onexc)`.

In the tests, mock `os.open` rather than `_rmtree_safe_fd()` to ensure the
FD-based walk is used, and replace a couple references to
`shutil._use_fd_functions` with `shutil.rmtree.avoids_symlink_attacks`
(which has the same value).

No change of behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL