conftest fixed

This commit is contained in:
Deekshu Kare 2024-06-27 03:18:35 +02:00
parent fdcb04ca81
commit d73ce6aa55
2 changed files with 13 additions and 10 deletions

View File

@ -40,6 +40,11 @@ from typing import IO
from . import Image, ImageFile from . import Image, ImageFile
branches = {
"1": False,
"2": False,
}
class Format(IntEnum): class Format(IntEnum):
JPEG = 0 JPEG = 0
@ -276,22 +281,20 @@ class BlpImageFile(ImageFile.ImageFile):
class _BLPBaseDecoder(ImageFile.PyDecoder): class _BLPBaseDecoder(ImageFile.PyDecoder):
_pulls_fd = True
def decode(self, buffer: bytes) -> tuple[int, int]:
branches = { branches = {
"1": False, "1": False,
"2": False, "2": False,
} }
_pulls_fd = True
def decode(self, buffer: bytes) -> tuple[int, int]:
try: try:
branches["1"] = True; branches["1"] = True
self._read_blp_header() self._read_blp_header()
self._load() self._load()
except struct.error as e: except struct.error as e:
branches["2"] = True; branches["2"] = True
msg = "Truncated BLP file" msg = "Truncated BLP file"
raise OSError(msg) from e raise OSError(msg) from e
return -1, 0 return -1, 0

View File

@ -48,11 +48,11 @@ def read_32t(fobj, start_length, size):
fobj.seek(start) fobj.seek(start)
sig = fobj.read(4) sig = fobj.read(4)
if sig != b"\x00\x00\x00\x00": if sig != b"\x00\x00\x00\x00":
branches["1"] = True; branches["1"] = True
msg = "Unknown signature, expecting 0x00000000" msg = "Unknown signature, expecting 0x00000000"
raise SyntaxError(msg) raise SyntaxError(msg)
else: else:
branches["2"] = True; branches["2"] = True
return read_32(fobj, (start + 4, length - 4), size) return read_32(fobj, (start + 4, length - 4), size)