]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Change type check to isinstance in pipes (GH-27291)
authorAnton Grübel <anton.gruebel@gmail.com>
Wed, 28 Jul 2021 13:38:06 +0000 (22:38 +0900)
committerGitHub <noreply@github.com>
Wed, 28 Jul 2021 13:38:06 +0000 (15:38 +0200)
Lib/pipes.py

index f1a16f63de60a0a64c26604644a17bc7500a35f1..8cc74b0f1f781b15a095f33ce0d2bdd88ccfe008 100644 (file)
@@ -109,7 +109,7 @@ class Template:
 
     def append(self, cmd, kind):
         """t.append(cmd, kind) adds a new step at the end."""
-        if type(cmd) is not type(''):
+        if not isinstance(cmd, str):
             raise TypeError('Template.append: cmd must be a string')
         if kind not in stepkinds:
             raise ValueError('Template.append: bad kind %r' % (kind,))
@@ -125,7 +125,7 @@ class Template:
 
     def prepend(self, cmd, kind):
         """t.prepend(cmd, kind) adds a new step at the front."""
-        if type(cmd) is not type(''):
+        if not isinstance(cmd, str):
             raise TypeError('Template.prepend: cmd must be a string')
         if kind not in stepkinds:
             raise ValueError('Template.prepend: bad kind %r' % (kind,))