mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Cleanup code: remove int/long idioms and simplify a while statement.
This commit is contained in:
parent
8d48b43ea9
commit
2bb96f593a
5 changed files with 10 additions and 35 deletions
|
|
@ -141,11 +141,7 @@ class Unpacker:
|
|||
data = self.__buf[i:j]
|
||||
if len(data) < 4:
|
||||
raise EOFError
|
||||
x = struct.unpack('>L', data)[0]
|
||||
try:
|
||||
return int(x)
|
||||
except OverflowError:
|
||||
return x
|
||||
return struct.unpack('>L', data)[0]
|
||||
|
||||
def unpack_int(self):
|
||||
i = self.__pos
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue