-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
type: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
Description
A requirements file with malformed texts, such as one having just one " double-quote but not the ending one, would result in pip terminating with a ValueError exception.
Expected behavior
The malformed requirements line should be treated as a regular parsing error.
pip version
22.3.dev0
Python version
3.10
OS
MacOS / any
How to Reproduce
- Write a requirements.txt file with
--"hello - Run
pip install -r ./requirements.txt
Output
ERROR: Exception:
Traceback (most recent call last):
File "pip/src/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "pip/src/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "pip/src/pip/_internal/commands/install.py", line 341, in run
reqs = self.get_requirements(args, options, finder, session)
File "pip/src/pip/_internal/cli/req_command.py", line 433, in get_requirements
for parsed_req in parse_requirements(
File "pip/src/pip/_internal/req/req_file.py", line 145, in parse_requirements
for parsed_line in parser.parse(filename, constraint):
File "pip/src/pip/_internal/req/req_file.py", line 331, in parse
yield from self._parse_and_recurse(filename, constraint)
File "pip/src/pip/_internal/req/req_file.py", line 336, in _parse_and_recurse
for line in self._parse_file(filename, constraint):
File "pip/src/pip/_internal/req/req_file.py", line 373, in _parse_file
args_str, opts = self._line_parser(line)
File "pip/src/pip/_internal/req/req_file.py", line 400, in parse_line
options = shlex.split(options_str)
File "/opt/homebrew/Cellar/[email protected]/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shlex.py", line 315, in split
return list(lex)
File "/opt/homebrew/Cellar/[email protected]/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shlex.py", line 300, in __next__
token = self.get_token()
File "/opt/homebrew/Cellar/[email protected]/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shlex.py", line 109, in get_token
raw = self.read_token()
File "/opt/homebrew/Cellar/[email protected]/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shlex.py", line 191, in read_token
raise ValueError("No closing quotation")
ValueError: No closing quotation
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Metadata
Metadata
Assignees
Labels
type: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior