Commit 0db676fd authored by John (J5) Palmieri's avatar John (J5) Palmieri Committed by Tomeu Vizoso
Browse files

make vfuncs work in py3k

* methods now export __func__ instead of im_func for getting the function
  out of a method closure
* however classes no longer return unbound methods in py3k and instead
  return the actual function
* in python 2 we use im_func when getting the function from the vfunc closure
* in py3k we simply assign vfunc to the function

https://bugzilla.gnome.org/show_bug.cgi?id=615872
parent 286dcd0c
......@@ -105,10 +105,14 @@ class MetaClassHelper(object):
'the method do_%s()' % (base.__info__.get_namespace(),
base.__info__.get_name(),
vfunc_info.get_name()))
elif vfunc is not None and not \
is_function_in_classes(vfunc.im_func, cls.__bases__):
hook_up_vfunc_implementation(vfunc_info, cls.__gtype__,
vfunc)
elif vfunc is not None:
function = vfunc
if sys.version_info < (3, 0):
function = vfunc.im_func
if not is_function_in_classes(function, cls.__bases__):
hook_up_vfunc_implementation(vfunc_info, cls.__gtype__,
vfunc)
def is_function_in_classes(function, classes):
for klass in classes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment