From ce674d2ca1dfae136fb33df914085e56d100bc57 Mon Sep 17 00:00:00 2001 From: Gabriel Curio Date: Thu, 30 Nov 2017 20:37:09 -0600 Subject: [PATCH] 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.' --- news/4811.bugfix | 2 ++ src/pip/_internal/req/req_install.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 news/4811.bugfix diff --git a/news/4811.bugfix b/news/4811.bugfix new file mode 100644 index 00000000000..c8d11838bc0 --- /dev/null +++ b/news/4811.bugfix @@ -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. diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index d3b9dd4280d..fc097fba07c 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -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(