-
Notifications
You must be signed in to change notification settings - Fork 52
Add a page on exceptions, and treat exceptions more consistently #613
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. _exceptions: | ||
|
||
Exceptions | ||
========== | ||
|
||
This standard specifies expected syntax and semantics for a set of APIs. When | ||
inputs to an API do not match what is expected, libraries may emit warnings, | ||
raise exceptions, or misbehave in unexpected ways. In general it is not | ||
possible to foresee or specify all the ways in which unexpected or invalid | ||
inputs are provided. Therefore, this standard does not attempt to specify | ||
exception or warning types to the extent needed in order to do exception | ||
handling in a portable manner. In general, it is expected that array library | ||
implementers follow `the guidance given by the documentation of the Python | ||
language <https://docs.python.org/3/library/exceptions.html>`__, and use either | ||
kgryte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fitting builtin exception or warning types that are appropriate for the | ||
kgryte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
situation, or custom exceptions or warnings that derive from those builtin | ||
kgryte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ones. | ||
|
||
In specific cases, it may be useful to provide guidance to array library | ||
authors regarding what an appropriate exception is. That guidance will be | ||
phrased as *should* rather than *must* (typically in a *Raises* section), | ||
because (a) there may be reasons for an implementer to deviate, and (b) more | ||
often than not existing array library implementation already differ in their | ||
kgryte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
choices and it may not be worth them breaking backwards compatibility in order | ||
kgryte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
to comply with a "must" in this standard. | ||
|
||
In other cases, this standard will only specify that an exception should or | ||
must be raised, but not mention what type of exception that is. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ Design topics & constraints | |
device_support | ||
static_typing | ||
accuracy | ||
exceptions | ||
complex_numbers | ||
C_API | ||
parallelism |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.