diff --git a/src/commands.py b/src/commands.py index 6f4675679..ca079d7a0 100644 --- a/src/commands.py +++ b/src/commands.py @@ -211,7 +211,10 @@ def _int(s): return int(s, base) except ValueError: if base == 10: - return int(float(s)) + try: + return int(float(s)) + except OverflowError: + raise ValueError('I don\'t understand numbers that large.') else: raise diff --git a/test/test_commands.py b/test/test_commands.py index 290ae5c93..31c9a04fc 100644 --- a/test/test_commands.py +++ b/test/test_commands.py @@ -72,6 +72,7 @@ class GeneralContextTestCase(CommandsTestCase): def testSpecInt(self): self.assertState(['int'], ['1'], [1]) self.assertState(['int', 'int', 'int'], ['1', '2', '3'], [1, 2, 3]) + self.assertError(['int'], ['9e999']) def testSpecNick(self): strict = conf.supybot.protocols.irc.strictRfc()