diff options
author | Guido van Rossum <guido@python.org> | 2003-04-19 18:15:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-19 18:15:10 (GMT) |
commit | aa86e35c524275e1f6cca91c1f8fcfc15e8d8b30 (patch) | |
tree | 09a2231543fb1f83d759ee5bfa41bca0a88d500a /Objects | |
parent | a26854095be67418bc89eff4874b32e33d7e5bf6 (diff) | |
download | cpython-aa86e35c524275e1f6cca91c1f8fcfc15e8d8b30.zip cpython-aa86e35c524275e1f6cca91c1f8fcfc15e8d8b30.tar.gz cpython-aa86e35c524275e1f6cca91c1f8fcfc15e8d8b30.tar.bz2 |
- bool() called without arguments now returns False rather than
raising an exception. This is consistent with calling the
constructors for the other builtin types -- called without argument
they all return the false value of that type. (SF patch #724135)
Thanks to Alex Martelli.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/boolobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/boolobject.c b/Objects/boolobject.c index af6150d..f2429fe 100644 --- a/Objects/boolobject.c +++ b/Objects/boolobject.c @@ -51,10 +51,10 @@ static PyObject * bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"x", 0}; - PyObject *x; + PyObject *x = Py_False; long ok; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:bool", kwlist, &x)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:bool", kwlist, &x)) return NULL; ok = PyObject_IsTrue(x); if (ok < 0) |