mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
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.
This commit is contained in:
parent
e6dd31c50b
commit
040f76b79c
11 changed files with 170 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue