-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-19225: Remove duplicated description for standard warning categories #1068
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,16 +291,10 @@ an error value). | |
is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, | ||
and so forth. | ||
|
||
Warning categories must be subclasses of :c:data:`Warning`; the default warning | ||
category is :c:data:`RuntimeWarning`. The standard Python warning categories are | ||
available as global variables whose names are ``PyExc_`` followed by the Python | ||
exception name. These have the type :c:type:`PyObject\*`; they are all class | ||
objects. Their names are :c:data:`PyExc_Warning`, :c:data:`PyExc_UserWarning`, | ||
:c:data:`PyExc_UnicodeWarning`, :c:data:`PyExc_DeprecationWarning`, | ||
:c:data:`PyExc_SyntaxWarning`, :c:data:`PyExc_RuntimeWarning`, and | ||
:c:data:`PyExc_FutureWarning`. :c:data:`PyExc_Warning` is a subclass of | ||
:c:data:`PyExc_Exception`; the other warning categories are subclasses of | ||
:c:data:`PyExc_Warning`. | ||
:c:data:`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; | ||
warning categories must be subclasses of :c:data:`Warning`; the default warning | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think that the fact that PyExc_Warning is a subclass of PyExc_Exception should be mentioned after saying that warning categories must be subclasses of PyExc_Warning. |
||
category is :c:data:`RuntimeWarning`. Their names are enumerated at | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Their names" -- that are not all names. Only names of the standard Python warning categories. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe: "The standard Python warning categories are available as global variables whose names are enumerated at...". |
||
:ref:`standarwarningcategories`. | ||
|
||
For information about warning control, see the documentation for the | ||
:mod:`warnings` module and the :option:`-W` option in the command line | ||
|
@@ -963,8 +957,10 @@ Notes: | |
Only defined on Windows; protect code that uses this by testing that the | ||
preprocessor macro ``MS_WINDOWS`` is defined. | ||
|
||
Standard Warnings | ||
================= | ||
.. _standarwarningcategories: | ||
|
||
Standard Warning Categories | ||
=========================== | ||
|
||
All standard Python warning categories are available as global variables whose | ||
names are ``PyExc_`` followed by the Python exception name. These have the type | ||
|
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.
Perhaps the last sentence should be kept here or added to the Standard Warning Categories section (if it already is not duplicated anywhere).
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.
The sentence at the bottom line seems to say the same meaning.
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.
But is it documented that PyExc_Warning is a subclass of PyExc_Exception?
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.
No, it isn't. So, that sentence should be put somewhere around the paragraph or Standard Warning Categories section.
It seems suitable for that sentence to sit at the beginning of the paragraph, doesn't it?
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.
LGTM.
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.
I have updated the PR.