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

Skip to content

Commit 0179481

Browse files
committed
Merge pull request #1642 from tacaswell/remove_import_new
remove `import new` from cbook.py
2 parents 5ac976f + c71084d commit 0179481

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)