-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-37346: Use OSError subclasses in os documentation #14262
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for your pull request.
I've left a couple of suggestions about the changes.
Thanks a lot. :)
the renaming will be an atomic operation (this is a POSIX requirement). On | ||
Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a | ||
file. | ||
Rename the file or directory *src* to *dst*. If *dst* exists, the operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space after stop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mangrisano, Thanks for taking the time to review this PR. One or two spaces after a period are both acceptable in Python documentation [devguide reference].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, thank for clarifying me that.
:exc:`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised | ||
respectively. If both are directories and *dst* is empty, *dst* will be | ||
silently replaced. If *dst* is a non-empty directory, an :exc:`OSError` | ||
is raised. If both are files, *dst* it will be replaced silently if the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space after stop.
I'm not quite clear what the status is. Should I switch to double-spaces, or is this just waiting for core review? |
GH-14596 is a backport of this pull request to the 3.8 branch. |
(cherry picked from commit a55f75a) Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
GH-14597 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit a55f75a) Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
(cherry picked from commit a55f75a) Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
(cherry picked from commit a55f75a) Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
|
||
On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. | ||
|
||
On Unix, if *src* is a file and *dst* is a directory or vice-versa, anq:q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bpo-37554 points out the errant vim exit at the end of this line :)
os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in python#14262.
…99571) os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in pythonGH-14262. (cherry picked from commit 1cae31d) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
…99571) os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in pythonGH-14262. (cherry picked from commit 1cae31d) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
#99641) GH-95815: Document less specific error for os.remove (GH-99571) os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in GH-14262. (cherry picked from commit 1cae31d) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
#99639) GH-95815: Document less specific error for os.remove (GH-99571) os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in GH-14262. (cherry picked from commit 1cae31d) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
PEP 3151 introduced more specific
OSError
subclasses. This PR uses them in the documentation of
os` where appropriate.https://bugs.python.org/issue37346