Skip to content

Commit

Permalink
fixup! Reorder requirements file decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ichard26 committed Dec 27, 2024
1 parent 5c49381 commit f1dbf49
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pip/_internal/req/req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ def get_file_content(url: str, session: "PipSession") -> Tuple[str, str]:


def _decode_req_file(data: bytes, url: str) -> str:
# NOTE: Byte Order Marks other than the UTF-8 BOM (used by PEP 263)
# aren't allowed as per the requirements.txt spec, but deprecating
# them isn't feasible as Windows Powershell uses UTF-16 (usually
# encountered while redirecting output to a requirements.txt).
# Thus, they remain as implementation-defined behaviour :/
for bom, encoding in BOMS:
if data.startswith(bom):
return data[len(bom) :].decode(encoding)
Expand Down

0 comments on commit f1dbf49

Please sign in to comment.