bpo-29762: More use "raise from None". (#569)

This hides unwanted implementation details from tracebacks.
This commit is contained in:
Serhiy Storchaka 2017-04-05 09:37:24 +03:00 committed by GitHub
parent 43ba8861e0
commit 5affd23e6f
30 changed files with 50 additions and 48 deletions

View file

@ -149,25 +149,25 @@ def _read_long(file):
try:
return struct.unpack('>l', file.read(4))[0]
except struct.error:
raise EOFError
raise EOFError from None
def _read_ulong(file):
try:
return struct.unpack('>L', file.read(4))[0]
except struct.error:
raise EOFError
raise EOFError from None
def _read_short(file):
try:
return struct.unpack('>h', file.read(2))[0]
except struct.error:
raise EOFError
raise EOFError from None
def _read_ushort(file):
try:
return struct.unpack('>H', file.read(2))[0]
except struct.error:
raise EOFError
raise EOFError from None
def _read_string(file):
length = ord(file.read(1))