# HG changeset patch # User Christian Brabandt # Date 1488737704 -3600 # Node ID a99a1234625f2f4adfdde13c3f72344528a068ee # Parent 3e57d960cbd1612032bf0c0035e47f105c9effb7 patch 8.0.0422: Python test fails with Python 3.6 commit https://github.com/vim/vim/commit/f411a3c5aff644ec7a999be83ef22adf3e1132dd Author: Bram Moolenaar Date: Sun Mar 5 19:00:34 2017 +0100 patch 8.0.0422: Python test fails with Python 3.6 Problem: Python test fails with Python 3.6. Solution: Convert new exception messages to old ones. (closes https://github.com/vim/vim/issues/1359) diff --git a/src/testdir/test87.in b/src/testdir/test87.in --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -230,13 +230,26 @@ def ee(expr, g=globals(), l=locals()): cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1])))) elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0: cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", ''))))) + elif sys.version_info >= (3, 6) and e.__class__ is ModuleNotFoundError: + # Python 3.6 gives ModuleNotFoundError, change it to an ImportError + cb.append(expr + ':' + repr((ImportError, ImportError(str(e).replace("'", ''))))) elif sys.version_info >= (3, 3) and e.__class__ is TypeError: m = py33_type_error_pattern.search(str(e)) if m: msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2)) cb.append(expr + ':' + repr((e.__class__, TypeError(msg)))) else: - cb.append(expr + ':' + repr((e.__class__, e))) + msg = repr((e.__class__, e)) + # Messages changed with Python 3.6, change new to old. + newmsg1 = """'argument must be str, bytes or bytearray, not None'""" + oldmsg1 = '''"Can't convert 'NoneType' object to str implicitly"''' + if msg.find(newmsg1) > -1: + msg = msg.replace(newmsg1, oldmsg1) + newmsg2 = """'argument must be str, bytes or bytearray, not int'""" + oldmsg2 = '''"Can't convert 'int' object to str implicitly"''' + if msg.find(newmsg2) > -1: + msg = msg.replace(newmsg2, oldmsg2) + cb.append(expr + ':' + msg) elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null')))) else: diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 422, +/**/ 421, /**/ 420,