summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-10-25 12:36:37 +0200
committerThomas Haller <thaller@redhat.com>2022-10-25 12:36:43 +0200
commitc34c8fdb823df72fbc3c2332f5ee08116aab3044 (patch)
tree69d286a68f3a0b51227977fa6fe1522e4a8c574f /examples
parentea5cd47bc45ad0a0a9d6dc53ecaab7c1239a2372 (diff)
downloadNetworkManager-c34c8fdb823df72fbc3c2332f5ee08116aab3044.tar.gz
examples: avoid unreachable code in "gmaincontext.py"
lgtm.com warns about this. Avoid it.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/python/gi/gmaincontext.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/python/gi/gmaincontext.py b/examples/python/gi/gmaincontext.py
index 9118cf86e6..b41cdc8c61 100755
--- a/examples/python/gi/gmaincontext.py
+++ b/examples/python/gi/gmaincontext.py
@@ -259,7 +259,6 @@ def create_nmc(dbus_connection):
# This actually should not happen. There is no other reason why
# initialization can fail.
assert False, "NMClient initialization is not supposed to fail"
- return nmc
###############################################################################
@@ -296,12 +295,11 @@ def make_call(nmc):
else:
log(f"[make_call]: dbus_call() completed with error: {e}")
- if False:
- # I don't understand why, but if you hit this exception (e.g. by setting a low
- # timeout) and pass the exception to the out context, then an additional reference
- # to nmc is leaked, and destroy_nmc() will fail. Workaround
- r.error = e
-
+ # I don't understand why, but if you hit this exception (e.g. by setting a low
+ # timeout) and pass the exception to the out context, then an additional reference
+ # to nmc is leaked, and destroy_nmc() will fail. Workaround
+ #
+ #r.error = e
r.error = str(e)
else:
log(