Remove special handling for Python < 2.6

See #701.
This commit is contained in:
Olly Betts 2018-05-18 15:52:46 +12:00
commit 7c034ead32
9 changed files with 56 additions and 454 deletions

View file

@ -84,16 +84,11 @@ def container_insert_step(i, j, step, newval):
except IndexError, e:
il_error = e
# Python 2.6 contains bug fixes in extended slicing syntax:
# http://docs.python.org/2/whatsnew/2.6.html
skip_check = ps_error != None and(
iv_error == il_error == None) and step > 0 and (sys.version_info[0:2] < (2, 6))
if not(skip_check):
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
raise RuntimeError, "ValueError exception not consistently thrown: " + \
str(ps_error) + " " + str(iv_error) + " " + str(il_error)
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
raise RuntimeError, "ValueError exception not consistently thrown: " + \
str(ps_error) + " " + str(iv_error) + " " + str(il_error)
compare_containers(ps, iv, il)
compare_containers(ps, iv, il)
# Check std::vector and std::list delete behaves same as Python list

View file

@ -1,17 +1,9 @@
import python_strict_unicode
from sys import version_info
test_bytes = 'hello \x01world\x99'
BYTES = 'BYTES'
test_bytes = b'hello \x01world\x99'
BYTES = b'BYTES'
test_unicode = u'h\udce9llo w\u00f6rld'
# Python < 2.6 rejects the b prefix for byte string literals as a SyntaxError,
# so instead create Python3 bytes objects by encoding unicode strings as
# latin-1, which maps code points 0-255 directly to the corresponding bytes.
if version_info[0] >= 3:
test_bytes = test_bytes.encode('latin-1')
BYTES = BYTES.encode('latin-1')
# Test that byte string inputs and outputs work as expected
bdbl = python_strict_unicode.double_str(test_bytes)
if bdbl != test_bytes + test_bytes: