summaryrefslogtreecommitdiff
path: root/compat.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2011-10-25 11:13:29 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2011-10-25 11:13:29 +0200
commit252f1320ba9304820226de6c37a7752612f53146 (patch)
treed85b4011c4f656fd0ab46714d2f5bb8671f717f1 /compat.py
parentf5f50588ff5d8ca57c6556dfc5a55d0c4b50bd9f (diff)
downloadlogilab-common-252f1320ba9304820226de6c37a7752612f53146.tar.gz
[compat] use instance of the class to have a real instance method (closes: #79268)
Details: By using `klass` instead of an instance of the class, we bounded the method as a class method. During execution, the monkey-patched method considered `self` as a reference to the class and further use of `self` failed miserably.
Diffstat (limited to 'compat.py')
-rw-r--r--compat.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/compat.py b/compat.py
index 47ef25c..8983ece 100644
--- a/compat.py
+++ b/compat.py
@@ -63,7 +63,8 @@ except AttributeError:
# See also http://bugs.python.org/issue11776
if sys.version_info[0] == 3:
def method_type(callable, instance, klass):
- return types.MethodType(callable, klass)
+ # api change. klass is no more considered
+ return types.MethodType(callable, instance)
else:
# alias types otherwise
method_type = types.MethodType