[Python-checkins] Change type check to isinstance in pipes (GH-27291)

ambv webhook-mailer at python.org
Wed Jul 28 09:38:16 EDT 2021


https://github.com/python/cpython/commit/9ffbb899462b819864f777d0228fb8f1bb89b018
commit: 9ffbb899462b819864f777d0228fb8f1bb89b018
branch: main
author: Anton Grübel <anton.gruebel at gmail.com>
committer: ambv <lukasz at langa.pl>
date: 2021-07-28T15:38:06+02:00
summary:

Change type check to isinstance in pipes (GH-27291)

files:
M Lib/pipes.py

diff --git a/Lib/pipes.py b/Lib/pipes.py
index f1a16f63de60a..8cc74b0f1f781 100644
--- a/Lib/pipes.py
+++ b/Lib/pipes.py
@@ -109,7 +109,7 @@ def debug(self, flag):
 
     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 @@ def append(self, cmd, kind):
 
     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,))



More information about the Python-checkins mailing list