Skip to content
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

Merged
merged 1 commit into from
Jul 5, 2019

Conversation

timhoffm
Copy link
Contributor

@timhoffm timhoffm commented Jun 20, 2019

PEP 3151 introduced more specific OSError subclasses. This PR uses them in the documentation of os` where appropriate.

https://bugs.python.org/issue37346

Copy link
Contributor

@mangrisano mangrisano left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double space after stop.

Copy link
Contributor

@willingc willingc Jun 20, 2019

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].

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double space after stop.

@timhoffm
Copy link
Contributor Author

timhoffm commented Jul 4, 2019

I'm not quite clear what the status is. Should I switch to double-spaces, or is this just waiting for core review?

@miss-islington
Copy link
Contributor

Thanks @timhoffm for the PR, and @asvetlov for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-14596 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Jul 5, 2019
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 5, 2019
(cherry picked from commit a55f75a)

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@bedevere-bot
Copy link

GH-14597 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 5, 2019
(cherry picked from commit a55f75a)

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Jul 5, 2019
(cherry picked from commit a55f75a)

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Jul 5, 2019
(cherry picked from commit a55f75a)

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@timhoffm timhoffm deleted the doc-oserror branch July 5, 2019 15:58

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
Copy link
Member

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 :)

lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
ronaldoussoren added a commit to ronaldoussoren/cpython that referenced this pull request Nov 18, 2022
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.
ronaldoussoren added a commit that referenced this pull request Nov 21, 2022
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 #14262.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 21, 2022
…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>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 21, 2022
…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>
ronaldoussoren added a commit that referenced this pull request Nov 21, 2022
#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>
ronaldoussoren added a commit that referenced this pull request Nov 21, 2022
#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants