pypa/pip — pull request #1959 by eosrei (2014-08-06 02:33:19+00:00)
Title: Optional finder variable must be validated before use in parse_requirements()

In req/req_file.py:

def parse_requirements(filename, finder=None, comes_from=None, options=None,
session=None):

`finder` is optional, but code assumes it exists. Maybe it should be required? IDK. I doubled up on the if statements for layout consistency.

Discovered while using caniusepython3 when requirements.txt contains --allow-external or --allow-unverified:

```
user@server:~/project$ caniusepython3 -r requirements.txt
Traceback (most recent call last):
File "/usr/local/project/bin/caniusepython3", line 11, in
sys.exit(main())
File "/usr/local/project/local/lib/python2.7/site-packages/caniusepython3/__main__.py", line 157, in main
check(projects_from_cli(args))
File "/usr/local/project/local/lib/python2.7/site-packages/caniusepython3/__main__.py", line 84, in projects_from_cli
projects.extend(projects_from_requirements(parsed.requirements))
File "/usr/local/project/local/lib/python2.7/site-packages/caniusepython3/__main__.py", line 37, in projects_from_requirements
for req in reqs:
File "/usr/local/project/local/lib/python2.7/site-packages/pip/req.py", line 1569, in parse_requirements
for item in parse_requirements(req_url, finder, comes_from=filename, options=options, session=session):
File "/usr/local/project/local/lib/python2.7/site-packages/pip/req.py", line 1620, in parse_requirements
finder.allow_unverified |= set([normalize_name(line).lower()])
AttributeError: 'NoneType' object has no attribute 'allow_unverified'
```