To: vim_dev@googlegroups.com Subject: Patch 8.0.0422 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0422 Problem: Python test fails with Python 3.6. Solution: Convert new exception messages to old ones. (closes #1359) Files: src/testdir/test87.in *** ../vim-8.0.0421/src/testdir/test87.in 2016-09-09 14:57:15.000000000 +0200 --- src/testdir/test87.in 2017-03-05 18:33:37.193000759 +0100 *************** *** 230,242 **** 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, 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))) 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: --- 230,255 ---- 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: ! 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: *** ../vim-8.0.0421/src/version.c 2017-03-05 18:02:59.999101021 +0100 --- src/version.c 2017-03-05 18:58:44.309529086 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 422, /**/ -- hundred-and-one symptoms of being an internet addict: 61. Your best friends know your e-mail address, but neither your phone number nor the address where you live. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///