summaryrefslogtreecommitdiffstats
path: root/Lib/optparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-20 19:29:31 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-20 19:29:31 (GMT)
commit7e52705ee362001a8761461e9c4d49e3873568e0 (patch)
tree5699fe91c61176691c42f95e7ed367172c8382e5 /Lib/optparse.py
parent6c01e38677550839d10b558b1a9e0e615d6e4a81 (diff)
downloadcpython-7e52705ee362001a8761461e9c4d49e3873568e0.zip
cpython-7e52705ee362001a8761461e9c4d49e3873568e0.tar.gz
cpython-7e52705ee362001a8761461e9c4d49e3873568e0.tar.bz2
Issue #20315: Removed support for backward compatibility with early 2.x versions.
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r--Lib/optparse.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py
index be0145f..432a2eb 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -645,14 +645,8 @@ class Option:
self.type = "string"
else:
# Allow type objects or builtin type conversion functions
- # (int, str, etc.) as an alternative to their names. (The
- # complicated check of builtins is only necessary for
- # Python 2.1 and earlier, and is short-circuited by the
- # first check on modern Pythons.)
- import builtins
- if ( isinstance(self.type, type) or
- (hasattr(self.type, "__name__") and
- getattr(builtins, self.type.__name__, None) is self.type) ):
+ # (int, str, etc.) as an alternative to their names.
+ if isinstance(self.type, type):
self.type = self.type.__name__
if self.type == "str":