Skip to content

Commit 4a06713

Browse files
committed
Python 2.7 sucks
1 parent d823526 commit 4a06713

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/http_ece/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,11 @@ def unpad_legacy(data):
232232
def unpad(data, last):
233233
i = len(data) - 1
234234
for i in range(len(data) - 1, -1, -1):
235-
if data[i] != 0:
236-
if not last and data[i] != 1:
235+
x = struct.unpack('B', data[i:i+1])[0]
236+
if x != 0:
237+
if not last and x != 1:
237238
raise ECEException(u'record delimiter != 1')
238-
if last and data[i] != 2:
239+
if last and x != 2:
239240
raise ECEException(u'last record delimiter != 2')
240241
return data[0:i]
241242
i -= 1

0 commit comments

Comments
 (0)