diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-30 01:11:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 01:11:41 +0100 |
commit | 3b0e431c82c9cc2ea294bf339f1dabf7e2e69a2f (patch) | |
tree | 7ff083a2b28dc57f943362e5e7edb1e2baf041bc /synapse | |
parent | Merge pull request #3085 from NotAFile/py3-config-text-mode (diff) | |
parent | Don't yield in list comprehensions (diff) | |
download | synapse-3b0e431c82c9cc2ea294bf339f1dabf7e2e69a2f.tar.xz |
Merge pull request #3150 from NotAFile/py3-listcomp-yield
Don't yield in list comprehensions
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/appservice.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 6cc2388306..0d11d890ff 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -262,11 +262,15 @@ class ApplicationServicesHandler(object): event based on the service regex. """ services = self.store.get_app_services() - interested_list = [ - s for s in services if ( - yield s.is_interested(event, self.store) - ) - ] + + # we can't use a list comprehension here. Since python 3, list + # comprehensions use a generator internally. This means you can't yield + # inside of a list comprehension anymore. + interested_list = [] + for s in services: + if (yield s.is_interested(event, self.store)): + interested_list.append(s) + defer.returnValue(interested_list) def _get_services_for_user(self, user_id): |