diff options
author | Marc-André Lemburg <mal@egenix.com> | 2006-08-14 10:55:19 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2006-08-14 10:55:19 (GMT) |
commit | 040f76b79c0ce86dc33b9c525fbcd84b2254e559 (patch) | |
tree | e907d6c112d52b1a92d7b98c63023ca338c9a188 /Doc | |
parent | e6dd31c50be76a5b57917226e16bdaa6ca20a28f (diff) | |
download | cpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.zip cpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.tar.gz cpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.tar.bz2 |
Slightly revised version of patch #1538956:
Replace UnicodeDecodeErrors raised during == and !=
compares of Unicode and other objects with a new
UnicodeWarning.
All other comparisons continue to raise exceptions.
Exceptions other than UnicodeDecodeErrors are also left
untouched.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/api/concrete.tex | 25 | ||||
-rw-r--r-- | Doc/api/exceptions.tex | 9 | ||||
-rw-r--r-- | Doc/lib/libexcs.tex | 5 | ||||
-rw-r--r-- | Doc/lib/libwarnings.tex | 3 |
4 files changed, 38 insertions, 4 deletions
diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex index 4c7487c..cd9d8d5 100644 --- a/Doc/api/concrete.tex +++ b/Doc/api/concrete.tex @@ -1560,6 +1560,31 @@ They all return \NULL{} or \code{-1} if an exception occurs. greater than, respectively. \end{cfuncdesc} +\begin{cfuncdesc}{int}{PyUnicode_RichCompare}{PyObject *left, + PyObject *right, + int op} + +% This entry could use some polishing - my TeX is too +% rusty these days... (MAL) + + Rich compare two strings and return one of the following: +\begin{verbatim} + - NULL in case an exception was raised + - Py_True or Py_False for successfuly comparisons + - Py_NotImplemented in case the type combination is unknown +\end{verbatim} + + Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in + case the conversion of the arguments to Unicode fails with a + UnicodeDecodeError. + + Possible values for \var{op}: +\begin{verbatim} + Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE +\end{verbatim} + +\end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyUnicode_Format}{PyObject *format, PyObject *args} Return a new string object from \var{format} and \var{args}; this diff --git a/Doc/api/exceptions.tex b/Doc/api/exceptions.tex index cb75d50..057c1da 100644 --- a/Doc/api/exceptions.tex +++ b/Doc/api/exceptions.tex @@ -288,10 +288,11 @@ for each thread. names are \samp{PyExc_} followed by the Python exception name. These have the type \ctype{PyObject*}; they are all class objects. Their names are \cdata{PyExc_Warning}, \cdata{PyExc_UserWarning}, - \cdata{PyExc_DeprecationWarning}, \cdata{PyExc_SyntaxWarning}, - \cdata{PyExc_RuntimeWarning}, and \cdata{PyExc_FutureWarning}. - \cdata{PyExc_Warning} is a subclass of \cdata{PyExc_Exception}; the - other warning categories are subclasses of \cdata{PyExc_Warning}. + \cdata{PyExc_UnicodeWarning}, \cdata{PyExc_DeprecationWarning}, + \cdata{PyExc_SyntaxWarning}, \cdata{PyExc_RuntimeWarning}, and + \cdata{PyExc_FutureWarning}. \cdata{PyExc_Warning} is a subclass of + \cdata{PyExc_Exception}; the other warning categories are subclasses + of \cdata{PyExc_Warning}. For information about warning control, see the documentation for the \module{warnings} module and the \programopt{-W} option in the diff --git a/Doc/lib/libexcs.tex b/Doc/lib/libexcs.tex index bef8bf1..6d2a3c5 100644 --- a/Doc/lib/libexcs.tex +++ b/Doc/lib/libexcs.tex @@ -456,6 +456,11 @@ Base class for warnings about probable mistakes in module imports. \versionadded{2.5} \end{excdesc} +\begin{excdesc}{UnicodeWarning} +Base class for warnings related to Unicode. +\versionadded{2.5} +\end{excdesc} + The class hierarchy for built-in exceptions is: \verbatiminput{../../Lib/test/exception_hierarchy.txt} diff --git a/Doc/lib/libwarnings.tex b/Doc/lib/libwarnings.tex index 08c0340..a37a9f5 100644 --- a/Doc/lib/libwarnings.tex +++ b/Doc/lib/libwarnings.tex @@ -76,6 +76,9 @@ features that will be deprecated in the future (ignored by default).} \lineii{ImportWarning}{Base category for warnings triggered during the process of importing a module (ignored by default).} + +\lineii{UnicodeWarning}{Base category for warnings related to Unicode.} + \end{tableii} While these are technically built-in exceptions, they are documented |