Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c71084d

Browse files
author
Thomas A Caswell
committed
removed the import new in favor of import types for all versions.
types is supported from 2.2 and new is deprecated as of 2.6. This is the only place `import new` appears in the code.
1 parent 1787a1a commit c71084d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/matplotlib/cbook.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
import numpy.ma as ma
2929

3030

31-
if sys.version_info[0] >= 3:
32-
import types
33-
else:
34-
import new
31+
32+
import types
33+
3534

3635
# On some systems, locale.getpreferredencoding returns None,
3736
# which can break unicode; and the sage project reports that
@@ -209,10 +208,9 @@ def __call__(self, *args, **kwargs):
209208
elif self.inst is not None:
210209
# build a new instance method with a strong reference to the
211210
# instance
212-
if sys.version_info[0] >= 3:
213-
mtd = types.MethodType(self.func, self.inst())
214-
else:
215-
mtd = new.instancemethod(self.func, self.inst(), self.klass)
211+
212+
mtd = types.MethodType(self.func, self.inst())
213+
216214
else:
217215
# not a bound method, just return the func
218216
mtd = self.func

0 commit comments

Comments
 (0)