updated for version 7.3.1063
Problem:    Python: Function is not standard.
Solution:   Python patch 22: make Function subclassable. (ZyX)
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index dfba65d..981d5e5 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -31,6 +31,9 @@
 :"
 :" Extending Dictionary directly with different types
 :let d = {}
+:fun d.f()
+:  return 1
+:endfun
 py << EOF
 d=vim.bindeval('d')
 d['1']='asd'
@@ -44,12 +47,13 @@
 dv.sort(key=repr)
 di.sort(key=repr)
 EOF
+:$put =pyeval('d[''f''](self={})')
 :$put =pyeval('repr(dk)')
 :$put =substitute(pyeval('repr(dv)'),'0x\x\+','','g')
 :$put =substitute(pyeval('repr(di)'),'0x\x\+','','g')
-:for [key, val] in sort(items(d))
-:  $put =string(key) . ' : ' . string(val)
-:  unlet key val
+:for [key, Val] in sort(items(d))
+:  $put =string(key) . ' : ' . string(Val)
+:  unlet key Val
 :endfor
 :"
 :" removing items with del
@@ -66,6 +70,7 @@
 :$put =string(l)
 :"
 :py del d['-1']
+:py del d['f']
 :$put =string(pyeval('d.get(''b'', 1)'))
 :$put =string(pyeval('d.pop(''b'')'))
 :$put =string(pyeval('d.get(''b'', 1)'))
@@ -187,9 +192,10 @@
 :catch
 :   $put =v:exception[:16]
 :endtry
+:py f=l[0]
 :delfunction New
 :try
-:   py l[0](1, 2, 3)
+:   py f(1, 2, 3)
 :catch
 :   $put =v:exception[:16]
 :endtry
@@ -737,6 +743,7 @@
 :$put =string(pyeval('vim.Dictionary(((''a'', 1),))'))
 :$put =string(pyeval('vim.List()'))
 :$put =string(pyeval('vim.List(iter(''abc''))'))
+:$put =string(pyeval('vim.Function(''tr'')'))
 :"
 :" Test stdout/stderr
 :redir => messages
@@ -747,6 +754,10 @@
 :redir END
 :$put =string(substitute(messages, '\d\+', '', 'g'))
 :" Test subclassing
+:fun Put(...)
+:   $put =string(a:000)
+:   return a:000
+:endfun
 py << EOF
 class DupDict(vim.Dictionary):
     def __setitem__(self, key, value):
@@ -762,10 +773,17 @@
 dl = DupList()
 dl2 = DupList(iter('abc'))
 dl.extend(dl2[0])
+
+class DupFun(vim.Function):
+    def __call__(self, arg):
+        return super(DupFun, self).__call__(arg, arg)
+
+df = DupFun('Put')
 EOF
 :$put =string(sort(keys(pyeval('dd'))))
 :$put =string(pyeval('dl'))
 :$put =string(pyeval('dl2'))
+:$put =string(pyeval('df(2)'))
 :"
 :" Test exceptions
 :fun Exe(e)
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index b484ec6..34e1e68 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -4,13 +4,15 @@
 Vim(put):E684:
 [0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
 [0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
-['-1', '0', '1', 'b']
-['asd', -1L, <vim.dictionary object at >, <vim.list object at >]
-[('-1', <vim.dictionary object at >), ('0', -1L), ('1', 'asd'), ('b', <vim.list object at >)]
+1
+['-1', '0', '1', 'b', 'f']
+['asd', -1L, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >]
+[('-1', <vim.dictionary object at >), ('0', -1L), ('1', 'asd'), ('b', <vim.list object at >), ('f', <vim.Function '1'>)]
 '-1' : {'a': 1}
 '0' : -1
 '1' : 'asd'
 'b' : [1, 2, function('strlen')]
+'f' : function('1')
 [0, function('strlen')]
 [3]
 [1, 2, function('strlen')]
@@ -407,13 +409,14 @@
 range:__dir__,__members__,append,end,start
 dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
 list:__dir__,__members__,extend,locked
-function:__call__,__dir__,__members__,softspace
+function:__dir__,__members__,softspace
 output:__dir__,__members__,flush,softspace,write,writelines
 {}
 {'a': 1}
 {'a': 1}
 []
 ['a', 'b', 'c']
+function('tr')
 '
 abcdef
 line  :
@@ -424,6 +427,8 @@
 ['a', 'dup_a']
 ['a', 'a']
 ['a', 'b', 'c']
+[2, 2]
+[2, 2]
 (<class 'vim.error'>, error('abc',))
 (<class 'vim.error'>, error('def',))
 (<class 'vim.error'>, error('ghi',))
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 82edc8b..776d53a 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -26,6 +26,9 @@
 :"
 :" Extending Dictionary directly with different types
 :let d = {}
+:fun d.f()
+:  return 1
+:endfun
 py3 << EOF
 d=vim.bindeval('d')
 d['1']='asd'
@@ -39,12 +42,13 @@
 dv.sort(key=repr)
 di.sort(key=repr)
 EOF
+:$put =py3eval('d[''f''](self={})')
 :$put =py3eval('repr(dk)')
 :$put =substitute(py3eval('repr(dv)'),'0x\x\+','','g')
 :$put =substitute(py3eval('repr(di)'),'0x\x\+','','g')
-:for [key, val] in sort(items(d))
-:  $put =string(key) . ' : ' . string(val)
-:  unlet key val
+:for [key, Val] in sort(items(d))
+:  $put =string(key) . ' : ' . string(Val)
+:  unlet key Val
 :endfor
 :"
 :" removing items with del
@@ -61,6 +65,7 @@
 :$put =string(l)
 :"
 :py3 del d['-1']
+:py3 del d['f']
 :$put =string(py3eval('d.get(''b'', 1)'))
 :$put =string(py3eval('d.pop(''b'')'))
 :$put =string(py3eval('d.get(''b'', 1)'))
@@ -182,9 +187,10 @@
 :catch
 :   $put =v:exception[:13]
 :endtry
+:py3 f=l[0]
 :delfunction New
 :try
-:   py3 l[0](1, 2, 3)
+:   py3 f(1, 2, 3)
 :catch
 :   $put =v:exception[:13]
 :endtry
@@ -698,6 +704,7 @@
 :$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
 :$put =string(py3eval('vim.List()'))
 :$put =string(py3eval('vim.List(iter(''abc''))'))
+:$put =string(py3eval('vim.Function(''tr'')'))
 :"
 :" Test stdout/stderr
 :redir => messages
@@ -708,6 +715,10 @@
 :redir END
 :$put =string(substitute(messages, '\d\+', '', 'g'))
 :" Test subclassing
+:fun Put(...)
+:   $put =string(a:000)
+:   return a:000
+:endfun
 py3 << EOF
 class DupDict(vim.Dictionary):
     def __setitem__(self, key, value):
@@ -723,10 +734,17 @@
 dl = DupList()
 dl2 = DupList(iter('abc'))
 dl.extend(dl2[0])
+
+class DupFun(vim.Function):
+    def __call__(self, arg):
+        return super(DupFun, self).__call__(arg, arg)
+
+df = DupFun('Put')
 EOF
 :$put =string(sort(keys(py3eval('dd'))))
 :$put =string(py3eval('dl'))
 :$put =string(py3eval('dl2'))
+:$put =string(py3eval('df(2)'))
 :"
 :" Test exceptions
 :fun Exe(e)
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
index 0945396..2d732fd 100644
--- a/src/testdir/test87.ok
+++ b/src/testdir/test87.ok
@@ -4,13 +4,15 @@
 Vim(put):E684:
 [0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
 [0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
-[b'-1', b'0', b'1', b'b']
-[-1, <vim.dictionary object at >, <vim.list object at >, b'asd']
-[(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.list object at >)]
+1
+[b'-1', b'0', b'1', b'b', b'f']
+[-1, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >, b'asd']
+[(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.list object at >), (b'f', <vim.Function '1'>)]
 '-1' : {'a': 1}
 '0' : -1
 '1' : 'asd'
 'b' : [1, 2, function('strlen')]
+'f' : function('1')
 [0, function('strlen')]
 [3]
 [1, 2, function('strlen')]
@@ -396,13 +398,14 @@
 range:__dir__,append,end,start
 dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
 list:__dir__,extend,locked
-function:__call__,__dir__,softspace
+function:__dir__,softspace
 output:__dir__,flush,softspace,write,writelines
 {}
 {'a': 1}
 {'a': 1}
 []
 ['a', 'b', 'c']
+function('tr')
 '
 abcdef
 line  :
@@ -413,6 +416,8 @@
 ['a', 'dup_a']
 ['a', 'a']
 ['a', 'b', 'c']
+[2, 2]
+[2, 2]
 (<class 'vim.error'>, error('abc',))
 (<class 'vim.error'>, error('def',))
 (<class 'vim.error'>, error('ghi',))