diff options
author | William Blevins <wblevins001@gmail.com> | 2016-09-21 23:54:23 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2016-09-21 23:54:23 (GMT) |
commit | 88eb753eb8e65721368beb2fc1247312e2a5ab4c (patch) | |
tree | f8628927dfdc201f4e4aca0a0101210be85fb1fc /src | |
parent | f5035c6a61ad10f440a22c14ce22bbb1d6796f62 (diff) | |
download | SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.zip SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.tar.gz SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.tar.bz2 |
Fixed difference in types MethodType argument list between 2/3 which allowed finishing CC folder.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Util.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 6a7e4a1..7653acd 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1425,14 +1425,22 @@ def AddMethod(obj, function, name=None): else: function = RenameFunction(function, name) + # Note the Python version checks - WLB + # Python 3.3 dropped the 3rd parameter from types.MethodType if hasattr(obj, '__class__') and obj.__class__ is not type: # "obj" is an instance, so it gets a bound method. - method = MethodType(function, obj, obj.__class__) - setattr(obj, name, method) + if sys.version_info[:2] > (3, 2): + method = MethodType(function, obj) + else: + method = MethodType(function, obj, obj.__class__) else: # "obj" is a class, so it gets an unbound method. - function = MethodType(function, None, obj) - setattr(obj, name, function) + if sys.version_info[:2] > (3, 2): + method = MethodType(function, None) + else: + method = MethodType(function, None, obj) + + setattr(obj, name, method) def RenameFunction(function, name): """ |