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-32410: Make SendfileNotAvailableError public #5243

Merged
merged 3 commits into from
Jan 19, 2018

Conversation

asvetlov
Copy link
Contributor

@asvetlov asvetlov commented Jan 19, 2018

if fallback:
return await self._sock_sendfile_fallback(sock, file,
offset, count)
else:
raise RuntimeError(exc.args[0]) from None
raise
Copy link
Member

Choose a reason for hiding this comment

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

Can we reformat this code to:

except events.SendfileNotAvailable:
    if not fallback: 
       raise
return await self._sock_sendfile_fallback(sock, file, offset, count)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


Sendfile syscall is not available, subclass of :exc:`RuntimeError`.

Raised if Operation System does not support senfile syscall for
Copy link
Member

Choose a reason for hiding this comment

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

... Raised if the OS...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

--------------------


.. exception:: SendfileNotAvailable
Copy link
Member

Choose a reason for hiding this comment

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

One more nit: can we call it SendfileNotAvailableError? The Error suffix is used for 99% of exceptions in Python.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Done

@asvetlov asvetlov changed the title bpo-32410: Make SendfileNotAvailable public bpo-32410: Make SendfileNotAvailableError public Jan 19, 2018
@asvetlov asvetlov merged commit 7464e87 into python:master Jan 19, 2018
@asvetlov asvetlov deleted the explicit-sendfilenotavailable branch January 19, 2018 18:04
@orsenthil
Copy link
Member

@asvetlov - just curious, why did you skip-news for this new Exception introduction?

@1st1
Copy link
Member

1st1 commented Jan 20, 2018

This is a follow-up PR; we already have a NEWS entry for loop.sock_sendfile.

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.

5 participants