diff --git a/PyPDF2/_utils.py b/PyPDF2/_utils.py index b73fa93e1..e2521dc7e 100644 --- a/PyPDF2/_utils.py +++ b/PyPDF2/_utils.py @@ -56,7 +56,6 @@ float, float, float, float, float, float ] -bytes_type = bytes # Works the same in Python 2.X and 3.X StreamType = Union[BytesIO, BufferedReader, BufferedWriter, FileIO] StrByteType = Union[str, StreamType] diff --git a/PyPDF2/generic.py b/PyPDF2/generic.py index e092c4aa4..ecf6ec211 100644 --- a/PyPDF2/generic.py +++ b/PyPDF2/generic.py @@ -48,7 +48,6 @@ WHITESPACES, StreamType, b_, - bytes_type, deprecate_no_replacement, deprecate_with_replacement, hex_str, @@ -496,7 +495,7 @@ def read_string_from_stream( return create_string_object(txt, forced_encoding) -class ByteStringObject(bytes_type, PdfObject): # type: ignore +class ByteStringObject(bytes, PdfObject): # type: ignore """ Represents a string object where the text encoding could not be determined. This occurs quite often, as the PDF spec doesn't provide an alternate way to @@ -1897,7 +1896,7 @@ def create_string_object( """ if isinstance(string, str): return TextStringObject(string) - elif isinstance(string, bytes_type): + elif isinstance(string, bytes): if isinstance(forced_encoding, (list, dict)): out = "" for x in string: