Raise more correct exception on overflow in setting buffer_size attribute of

expat parser.
This commit is contained in:
Serhiy Storchaka 2015-09-07 22:51:56 +03:00
parent 931331a328
commit de5f9f4f70
2 changed files with 10 additions and 6 deletions

View file

@ -3,6 +3,7 @@
from io import BytesIO
import os
import sys
import sysconfig
import unittest
import traceback
@ -543,6 +544,8 @@ class ChardataBufferTest(unittest.TestCase):
parser.buffer_size = -1
with self.assertRaises(ValueError):
parser.buffer_size = 0
with self.assertRaises((ValueError, OverflowError)):
parser.buffer_size = sys.maxsize + 1
with self.assertRaises(TypeError):
parser.buffer_size = 512.0