diff --git a/src/calibre/ebooks/lrf/pylrs/pylrf.py b/src/calibre/ebooks/lrf/pylrs/pylrf.py index a29c0139d0..d39418399f 100644 --- a/src/calibre/ebooks/lrf/pylrs/pylrf.py +++ b/src/calibre/ebooks/lrf/pylrs/pylrf.py @@ -652,7 +652,7 @@ class LrfWriter(object): return self.sourceEncoding def toUnicode(self, string): - if isinstance(string, str): + if isinstance(string, bytes): string = string.decode(self.sourceEncoding) return string diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index d4de4166aa..1dfb2397d5 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -121,7 +121,7 @@ def create_markdown_object(extensions): if hasattr(module, 'makeExtension'): return module.makeExtension(**configs) for name, x in vars(module).items(): - if isinstance(x, type) and issubclass(x, Extension) and x is not Extension: + if type(x) is type and issubclass(x, Extension) and x is not Extension: return x(**configs) raise ImportError('No extension class in {}'.format(ext_name)) diff --git a/src/calibre/gui2/tweak_book/diff/main.py b/src/calibre/gui2/tweak_book/diff/main.py index 0b41d6beb3..86a7fe099d 100644 --- a/src/calibre/gui2/tweak_book/diff/main.py +++ b/src/calibre/gui2/tweak_book/diff/main.py @@ -139,7 +139,7 @@ def string_diff(left, right, left_syntax=None, right_syntax=None, left_name='lef def file_diff(left, right): (raw1, syntax1), (raw2, syntax2) = map(get_decoded_raw, (left, right)) - if not isinstance(raw1, type(raw2)): + if type(raw1) is not type(raw2): raw1, raw2 = open(left, 'rb').read(), open(right, 'rb').read() cache = Cache() cache.set_left(left, raw1), cache.set_right(right, raw2)