summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Util.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index d61db37..259a133 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -1486,8 +1486,6 @@ def AddMethod(object, function, name = None):
AddMethod(lambda self, i: self.l[i], a, "listIndex")
print a.listIndex(5)
"""
- import new
-
if name is None:
name = function.func_name
else:
@@ -1497,18 +1495,16 @@ def AddMethod(object, function, name = None):
klass = object.__class__
except AttributeError:
# "object" is really a class, so it gets an unbound method.
- object.__dict__[name] = new.instancemethod(function, None, object)
+ object.__dict__[name] = types.MethodType(function, None, object)
else:
# "object" is really an instance, so it gets a bound method.
- object.__dict__[name] = new.instancemethod(function, object, klass)
+ object.__dict__[name] = types.MethodType(function, object, klass)
def RenameFunction(function, name):
"""
Returns a function identical to the specified function, but with
the specified name.
"""
- import new
-
# Compatibility for Python 1.5 and 2.1. Can be removed in favor of
# passing function.func_defaults directly to new.function() once
# we base on Python 2.2 or later.
@@ -1516,10 +1512,10 @@ def RenameFunction(function, name):
if func_defaults is None:
func_defaults = ()
- return new.function(function.func_code,
- function.func_globals,
- name,
- func_defaults)
+ return types.FunctionType(function.func_code,
+ function.func_globals,
+ name,
+ func_defaults)
md5 = False