changeset 259:b24080e5ca96

FIX: Handle OverflowErrlr when comparing CRCs with ints
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 16 Feb 2025 09:46:41 +0100
parents 57057028f13e
children 07a0bc723139
files cutils/util/crc32.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cutils/util/crc32.py	Sun Feb 16 09:46:21 2025 +0100
+++ b/cutils/util/crc32.py	Sun Feb 16 09:46:41 2025 +0100
@@ -54,7 +54,10 @@
         if isinstance(other, crc32):
             return self._crc == other._crc
         elif isinstance(other, INT_TYPES):
-            return self._get_crc_as_uint32() == self.as_uint32(other)
+            try:
+                return self._get_crc_as_uint32() == self.as_uint32(other)
+            except OverflowError:
+                return False
         else:
             return NotImplemented