File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -829,13 +829,26 @@ EOF
829829:fun D ()
830830:endfun
831831py3 << EOF
832+ import re
833+
834+ py33_type_error_pattern = re .compile (' ^__call__\(\) takes (\d+) positional argument but (\d+) were given$' )
835+
832836def ee (expr , g = globals (), l = locals ()):
833837 try :
834838 try :
835839 exec (expr , g , l )
836840 except Exception as e :
837841 if sys.version_info >= (3 , 3 ) and e .__class__ is AttributeError and str (e ).find (' has no attribute' )>= 0 and not str (e ).startswith (" 'vim." ):
838842 cb .append (expr + ' :' + repr ((e .__class__, AttributeError (str (e )[str (e ).rfind (" '" ) + 2 :-1 ]))))
843+ elif sys.version_info >= (3 , 3 ) and e .__class__ is ImportError and str (e ).find (' No module named \' ') >= 0 :
844+ cb .append (expr + ' :' + repr ((e .__class__, ImportError (str (e ).replace (" '" , ' ' )))))
845+ elif sys.version_info >= (3 , 3 ) and e .__class__ is TypeError:
846+ m = py33_type_error_pattern.search (str (e ))
847+ if m :
848+ msg = ' __call__() takes exactly {0} positional argument ({1} given)' .format (m .group (1 ), m .group (2 ))
849+ cb .append (expr + ' :' + repr ((e .__class__, TypeError (msg))))
850+ else :
851+ cb .append (expr + ' :' + repr ((e .__class__, e )))
839852 else :
840853 cb .append (expr + ' :' + repr ((e .__class__, e )))
841854 else :
Original file line number Diff line number Diff line change @@ -728,6 +728,8 @@ static char *(features[]) =
728728
729729static int included_patches [] =
730730{ /* Add new patch number below this line */
731+ /**/
732+ 1314 ,
731733/**/
732734 1313 ,
733735/**/
You can’t perform that action at this time.
0 commit comments