summaryrefslogtreecommitdiff
path: root/Lib/ast.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-28 13:43:03 +0200
committerGitHub <noreply@github.com>2018-10-28 13:43:03 +0200
commit6015cc50bc38b9e920ce4986ee10658eaa14f561 (patch)
treeeeae07dc8d901b5295b10c11c98a96205415bade /Lib/ast.py
parent913876d824d969f8c7431e8a9d4610a9a11a786e (diff)
downloadcpython-git-6015cc50bc38b9e920ce4986ee10658eaa14f561.tar.gz
bpo-32892: Support subclasses of base types in isinstance checks for AST constants. (GH-9934)
Some projects (e.g. Chameleon) create ast.Str containing an instance of the str subclass.
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index de3df1473e..4c8c7795ff 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -346,7 +346,7 @@ class _ABC(type):
except AttributeError:
return False
else:
- return type(value) in _const_types[cls]
+ return isinstance(value, _const_types[cls])
return type.__instancecheck__(cls, inst)
def _new(cls, *args, **kwargs):