diff options
| author | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-09-28 11:14:38 +0200 |
|---|---|---|
| committer | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-09-28 11:46:14 +0200 |
| commit | d258185dd3b02d058894f8a99fdb5149e1bf65de (patch) | |
| tree | 56246c0c1e8848b360760928435ba1033986e4af | |
| parent | 02f18a88c15f98c5879bb90e5a29463f08d262ec (diff) | |
| download | numpy-d258185dd3b02d058894f8a99fdb5149e1bf65de.tar.gz | |
MAINT: Fix LGTM.com warning: Comparison result is always the same (`denom`)
Comparison is always false because denom >= 1.
An overflow of `denom` is impossible because `denom` is initialized to 1
and then multiplied by 400*12*7 at most.
Besides, checking if the result is 0 is certainly not the proper way to
check for overflow or wrapping of an integer multiplication.
| -rw-r--r-- | numpy/core/src/multiarray/datetime.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/datetime.c b/numpy/core/src/multiarray/datetime.c index 11a941e72..b24bc0356 100644 --- a/numpy/core/src/multiarray/datetime.c +++ b/numpy/core/src/multiarray/datetime.c @@ -1160,7 +1160,7 @@ get_datetime_conversion_factor(PyArray_DatetimeMetaData *src_meta, } /* If something overflowed, make both num and denom 0 */ - if (denom == 0 || num == 0) { + if (num == 0) { PyErr_Format(PyExc_OverflowError, "Integer overflow while computing the conversion " "factor between NumPy datetime units %s and %s", |
