Skip to content

Commit be0ffc5

Browse files
fixup! Reorder requirements file decoding
1 parent 5c6389c commit be0ffc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pip/_internal/req/req_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,11 @@ def _decode_req_file(data: bytes, url: str) -> str:
600600
return data[len(bom) :].decode(encoding)
601601

602602
for line in data.split(b"\n")[:2]:
603-
if line[0:1] == b"#" and PEP263_ENCODING_RE.search(line):
603+
if line[0:1] == b"#":
604604
result = PEP263_ENCODING_RE.search(line)
605-
assert result is not None
606-
encoding = result.groups()[0].decode("ascii")
607-
return data.decode(encoding)
605+
if result is not None:
606+
encoding = result.groups()[0].decode("ascii")
607+
return data.decode(encoding)
608608

609609
try:
610610
return data.decode(DEFAULT_ENCODING)

0 commit comments

Comments
 (0)