Skip to content

Commit 2a6a96a

Browse files
committed
Fix #100: strip lines before parsing with Requirement()
packaging 26.3 made requirement parsing strict: a trailing newline now raises InvalidRequirement. process_line() parsed the raw line straight from file iteration, the error was silently swallowed, and source packages stayed pinned in the generated constraints. Parse the stripped line instead, and log unparseable lines at debug level so parser-behavior changes surface under -v instead of silently producing downstream resolver errors.
1 parent 6af9854 commit 2a6a96a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/mxdev/processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def process_line(
122122
cache_dir=cache_dir,
123123
)
124124
try:
125-
parsed = Requirement(line)
125+
parsed = Requirement(line.strip())
126126
except Exception:
127-
pass
127+
logger.debug(f"Line is not a requirement specifier: {line.strip()!r}")
128128
else:
129129
parsed_name_lower = parsed.name.lower()
130130
if parsed_name_lower in [k.lower() for k in package_keys]:

0 commit comments

Comments
 (0)