@@ -54,13 +54,7 @@ def _obsolete_line_fold(lines):
5454
5555def _decode_header_lines (lines ):
5656 for line in _obsolete_line_fold (lines ):
57- # _obsolete_line_fold yields either bytearray or bytes objects. On
58- # Python 3, validate() takes either and returns matches as bytes. But
59- # on Python 2, validate can return matches as bytearrays, so we have
60- # to explicitly cast back.
61- matches = validate (
62- header_field_re , bytes (line ), "illegal header line: {!r}" , bytes (line )
63- )
57+ matches = validate (header_field_re , line , "illegal header line: {!r}" , line )
6458 yield (matches ["field_name" ], matches ["field_value" ])
6559
6660
@@ -127,7 +121,7 @@ def read_eof(self):
127121chunk_header_re = re .compile (chunk_header .encode ("ascii" ))
128122
129123
130- class ChunkedReader ( object ) :
124+ class ChunkedReader :
131125 def __init__ (self ):
132126 self ._bytes_in_chunk = 0
133127 # After reading a chunk, we have to throw away the trailing \r\n; if
@@ -163,9 +157,7 @@ def __call__(self, buf):
163157 chunk_header ,
164158 )
165159 # XX FIXME: we discard chunk extensions. Does anyone care?
166- # We convert to bytes because Python 2's `int()` function doesn't
167- # work properly on bytearray objects.
168- self ._bytes_in_chunk = int (bytes (matches ["chunk_size" ]), base = 16 )
160+ self ._bytes_in_chunk = int (matches ["chunk_size" ], base = 16 )
169161 if self ._bytes_in_chunk == 0 :
170162 self ._reading_trailer = True
171163 return self (buf )
@@ -191,7 +183,7 @@ def read_eof(self):
191183 )
192184
193185
194- class Http10Reader ( object ) :
186+ class Http10Reader :
195187 def __call__ (self , buf ):
196188 data = buf .maybe_extract_at_most (999999999 )
197189 if data is None :
0 commit comments