Skip to content

Commit

Permalink
Fix unassigned variable.
Browse files Browse the repository at this point in the history
In the event of an error, 'req' will be unassigned. This will cause another error in the exception.

Replace 'req' with 'name.'
  • Loading branch information
GabrielC101 authored and xavfernandez committed Dec 2, 2017
1 parent fc6b2c1 commit ce674d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/4811.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix an issue where a variable assigned in a try clause was accessed in the except clause, resulting in an undefined
variable error in the except clause.
2 changes: 1 addition & 1 deletion src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def from_editable(cls, editable_req, comes_from=None, isolated=False,
try:
req = Requirement(name)
except InvalidRequirement:
raise InstallationError("Invalid requirement: '%s'" % req)
raise InstallationError("Invalid requirement: '%s'" % name)
else:
req = None
return cls(
Expand Down

0 comments on commit ce674d2

Please sign in to comment.