summaryrefslogtreecommitdiff
path: root/Doc/library/constants.rst
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:40 -0800
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:40 -0800
commitb2fa705fd3887c326e811c418469c784353027f4 (patch)
treeb3428f73de91453edbfd4df1a5d4a212d182eb44 /Doc/library/constants.rst
parent134e58fd3aaa2e91390041e143f3f0a21a60142b (diff)
parentb53654b6dbfce8318a7d4d1cdaddca7a7fec194b (diff)
downloadcpython-b2fa705fd3887c326e811c418469c784353027f4.tar.gz
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Doc/library/constants.rst')
-rw-r--r--Doc/library/constants.rst22
1 files changed, 14 insertions, 8 deletions
diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst
index d5a0f09173..f0742cee55 100644
--- a/Doc/library/constants.rst
+++ b/Doc/library/constants.rst
@@ -33,16 +33,22 @@ A small number of constants live in the built-in namespace. They are:
(e.g. :meth:`__imul__`, :meth:`__iand__`, etc.) for the same purpose.
Its truth value is true.
-.. note::
+ .. note::
+
+ When a binary (or in-place) method returns ``NotImplemented`` the
+ interpreter will try the reflected operation on the other type (or some
+ other fallback, depending on the operator). If all attempts return
+ ``NotImplemented``, the interpreter will raise an appropriate exception.
+ Incorrectly returning ``NotImplemented`` will result in a misleading
+ error message or the ``NotImplemented`` value being returned to Python code.
+
+ See :ref:`implementing-the-arithmetic-operations` for examples.
- When ``NotImplemented`` is returned, the interpreter will then try the
- reflected operation on the other type, or some other fallback, depending
- on the operator. If all attempted operations return ``NotImplemented``, the
- interpreter will raise an appropriate exception.
+ .. note::
- See
- :ref:`implementing-the-arithmetic-operations`
- for more details.
+ ``NotImplentedError`` and ``NotImplemented`` are not interchangeable,
+ even though they have similar names and purposes.
+ See :exc:`NotImplementedError` for details on when to use it.
.. data:: Ellipsis