summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorJack Diederich <jackdied@gmail.com>2006-11-28 19:15:13 (GMT)
committerJack Diederich <jackdied@gmail.com>2006-11-28 19:15:13 (GMT)
commit4dafcc4ece09c2a60473bb109513de4e7d2c2b11 (patch)
tree32be8af9dd16e1ea407bf008c92d62f7cd7539bd /Modules
parentdfc9d4f7aa38a3961847c034532e39f05a569f54 (diff)
downloadcpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.zip
cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.gz
cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.bz2
- patch #1600346 submitted by Tomer Filiba
- Renamed nb_nonzero slots to nb_bool - Renamed __nonzero__ methods to __bool__ - update core, lib, docs, and tests to match
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c8
-rw-r--r--Modules/datetimemodule.c12
2 files changed, 10 insertions, 10 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index e4aae2d..7948516 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4017,7 +4017,7 @@ static PyMethodDef Simple_methods[] = {
{ NULL, NULL },
};
-static int Simple_nonzero(CDataObject *self)
+static int Simple_bool(CDataObject *self)
{
return memcmp(self->b_ptr, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", self->b_size);
}
@@ -4032,7 +4032,7 @@ static PyNumberMethods Simple_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
- (inquiry)Simple_nonzero, /* nb_nonzero */
+ (inquiry)Simple_bool, /* nb_bool */
};
#if (PY_VERSION_HEX < 0x02040000)
@@ -4364,7 +4364,7 @@ static PySequenceMethods Pointer_as_sequence = {
};
static int
-Pointer_nonzero(CDataObject *self)
+Pointer_bool(CDataObject *self)
{
return *(void **)self->b_ptr != NULL;
}
@@ -4379,7 +4379,7 @@ static PyNumberMethods Pointer_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
- (inquiry)Pointer_nonzero, /* nb_nonzero */
+ (inquiry)Pointer_bool, /* nb_bool */
};
PyTypeObject Pointer_Type = {
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 4c05134..b57ccbc 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -1958,7 +1958,7 @@ Done:
}
static int
-delta_nonzero(PyDateTime_Delta *self)
+delta_bool(PyDateTime_Delta *self)
{
return (GET_TD_DAYS(self) != 0
|| GET_TD_SECONDS(self) != 0
@@ -2083,7 +2083,7 @@ static PyNumberMethods delta_as_number = {
(unaryfunc)delta_negative, /* nb_negative */
(unaryfunc)delta_positive, /* nb_positive */
(unaryfunc)delta_abs, /* nb_absolute */
- (inquiry)delta_nonzero, /* nb_nonzero */
+ (inquiry)delta_bool, /* nb_bool */
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
@@ -2653,7 +2653,7 @@ static PyNumberMethods date_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
- 0, /* nb_nonzero */
+ 0, /* nb_bool */
};
static PyTypeObject PyDateTime_DateType = {
@@ -3324,7 +3324,7 @@ time_replace(PyDateTime_Time *self, PyObject *args, PyObject *kw)
}
static int
-time_nonzero(PyDateTime_Time *self)
+time_bool(PyDateTime_Time *self)
{
int offset;
int none;
@@ -3418,7 +3418,7 @@ static PyNumberMethods time_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
- (inquiry)time_nonzero, /* nb_nonzero */
+ (inquiry)time_bool, /* nb_bool */
};
static PyTypeObject PyDateTime_TimeType = {
@@ -4501,7 +4501,7 @@ static PyNumberMethods datetime_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
- 0, /* nb_nonzero */
+ 0, /* nb_bool */
};
static PyTypeObject PyDateTime_DateTimeType = {