[PATCH] osmo-gsm-tester[master]: log.Origin: return self on __enter__

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon May 29 00:54:23 UTC 2017


Review at  https://gerrit.osmocom.org/2769

log.Origin: return self on __enter__

Allows using 'with some_origin() as foo:' constructs.
Not used actively, but is sometimes useful during debugging sessions.

Change-Id: I7a6463ee39761775305dd2272c24f248552db4ad
---
M src/osmo_gsm_tester/log.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/69/2769/1

diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index 3af7bbe..c4a9861 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -332,8 +332,9 @@
 
     def __enter__(self):
         if not self.set_child_of(Origin._global_current_origin):
-            return
+            return self
         Origin._global_current_origin = self
+        return self
 
     def __exit__(self, *exc_info):
         rc = None

-- 
To view, visit https://gerrit.osmocom.org/2769
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a6463ee39761775305dd2272c24f248552db4ad
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list