diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-12-27 02:26:16 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-12-27 02:26:16 (GMT) |
commit | 8702d5f33ffb9c55b2372d3cd424b65e783c13ee (patch) | |
tree | 88c1d9335d418b164b0c7baa07a83fa2eae2a476 | |
parent | 00237037ae5ced7f4921e2d0e6c3d24d685e74af (diff) | |
download | cpython-8702d5f33ffb9c55b2372d3cd424b65e783c13ee.zip cpython-8702d5f33ffb9c55b2372d3cd424b65e783c13ee.tar.gz cpython-8702d5f33ffb9c55b2372d3cd424b65e783c13ee.tar.bz2 |
And put back a little code duplication, in the form of asserts.
-rw-r--r-- | Modules/datetimemodule.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 60c9fcf..4381d03 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -3168,6 +3168,7 @@ datetime_richcompare(PyDateTime_DateTime *self, PyObject *other, int op) if (classify_two_utcoffsets((PyObject *)self, &offset1, &n1, other, &offset2, &n2) < 0) return NULL; + assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); /* If they're both naive, or both aware and have the same offsets, * we get off cheap. Note that if they're both naive, offset1 == * offset2 == 0 at this point. @@ -3681,6 +3682,7 @@ time_richcompare(PyDateTime_Time *self, PyObject *other, int op) if (classify_two_utcoffsets((PyObject *)self, &offset1, &n1, other, &offset2, &n2) < 0) return NULL; + assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); /* If they're both naive, or both aware and have the same offsets, * we get off cheap. Note that if they're both naive, offset1 == * offset2 == 0 at this point. @@ -4619,6 +4621,7 @@ datetimetz_subtract(PyObject *left, PyObject *right) if (classify_two_utcoffsets(left, &offset1, &n1, right, &offset2, &n2) < 0) return NULL; + assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); if (n1 != n2) { PyErr_SetString(PyExc_TypeError, "can't subtract offset-naive and " |