mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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.
This commit is contained in:
parent
913876d824
commit
6015cc50bc
2 changed files with 5 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue