From f783aa36971d78b293fb5d627d1aacd6dbd49afc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Dec 2016 11:04:10 -0500 Subject: Use generator expression to manage the scope of 'dist' --- pkg_resources/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 3be41752..92503288 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -3038,10 +3038,10 @@ def _initialize_master_working_set(): # ensure that all distributions added to the working set in the future # (e.g. by calling ``require()``) will get activated as well, # with higher priority (replace=True). - dist = None # ensure dist is defined for del dist below - for dist in working_set: + tuple( dist.activate(replace=False) - del dist + for dist in working_set + ) add_activation_listener(lambda dist: dist.activate(replace=True), existing=False) working_set.entries = [] # match order -- cgit v1.2.1