1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Fix unassigned variable.

In the event of an error, 'req' will be unassigned. This will cause another error in the exception.

Replace 'req' with 'name.'
This commit is contained in:
Gabriel Curio 2017-11-30 20:37:09 -06:00 committed by Xavier Fernandez
parent fc6b2c1920
commit ce674d2ca1
2 changed files with 3 additions and 1 deletions

2
news/4811.bugfix Normal file
View file

@ -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.

View file

@ -139,7 +139,7 @@ class InstallRequirement(object):
try:
req = Requirement(name)
except InvalidRequirement:
raise InstallationError("Invalid requirement: '%s'" % req)
raise InstallationError("Invalid requirement: '%s'" % name)
else:
req = None
return cls(