Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d494f3

Browse files
committed
Patch #1015021: Stop claiming that coerce can return None.
Will backport to 2.3.
1 parent b92b7ed commit 8d494f3

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/lib/libfuncs.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ \section{Non-essential Built-in Functions \label{non-essential-built-in-funcs}}
11801180
\begin{funcdesc}{coerce}{x, y}
11811181
Return a tuple consisting of the two numeric arguments converted to
11821182
a common type, using the same rules as used by arithmetic
1183-
operations.
1183+
operations. If coercion is not possible, raise \exception{TypeError}.
11841184
\end{funcdesc}
11851185

11861186
\begin{funcdesc}{intern}{string}

Python/bltinmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ builtin_coerce(PyObject *self, PyObject *args)
322322
}
323323

324324
PyDoc_STRVAR(coerce_doc,
325-
"coerce(x, y) -> None or (x1, y1)\n\
325+
"coerce(x, y) -> (x1, y1)\n\
326326
\n\
327-
When x and y can be coerced to values of the same type, return a tuple\n\
328-
containing the coerced values. When they can't be coerced, return None.");
329-
327+
Return a tuple consisting of the two numeric arguments converted to\n\
328+
a common type, using the same rules as used by arithmetic operations.\n\
329+
If coercion is not possible, raise TypeError.");
330330

331331
static PyObject *
332332
builtin_compile(PyObject *self, PyObject *args)

0 commit comments

Comments
 (0)