Download tasks/swe-next-159a25db393017cefba9/instruction.md from FineEnvs/repo2rlenv-swe-next: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/datasets/FineEnvs/repo2rlenv-swe-next/resolve/main/tasks/swe-next-159a25db393017cefba9/instruction.md
- Command line
-
hf download hf://datasets/FineEnvs/repo2rlenv-swe-next/tasks/swe-next-159a25db393017cefba9/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/FineEnvs/repo2rlenv-swe-next/resolve/main/tasks/swe-next-159a25db393017cefba9/instruction.md
parse_tag() raises ValueError instead of InvalidTag for tags with wrong number of components
Description
Calling parse_tag() with a tag string that doesn't have exactly three hyphen-separated components (interpreter, ABI, platform) raises a raw ValueError from Python's tuple unpacking instead of the documented InvalidTag exception.
For example:
from packaging import tags
# Tag with only two components (missing platform)
tags.parse_tag("py3-none")
# Tag with four components (extra field)
tags.parse_tag("py3-none-any-extra")
Running either of these raises:
ValueError: not enough values to unpack (expected 3, got 2)
or
ValueError: too many values to unpack (expected 3)
The error originates from the internal tuple unpacking interpreters, abis, platforms = component_parts in parse_tag() in src/packaging/tags.py.
Expected behavior
Both inputs should raise tags.InvalidTag (a subclass of ValueError) with a message indicating the tag must have exactly three components, consistent with how empty tag components are already handled. Code that catches InvalidTag to handle malformed tags should not need to also catch the bare ValueError.
Actual behavior
A plain ValueError is raised directly from the tuple unpacking, bypassing the InvalidTag public error contract. Any caller that catches tags.InvalidTag to validate tag strings will miss these malformed inputs.
Work in /workspace. Submit your fix in the existing Python source files under src/packaging. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.