kirr has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/40045?usp=email )
Change subject: trx_toolkit/*: Don't use `del x; x = None` idiom
......................................................................
trx_toolkit/*: Don't use `del x; x = None` idiom
In Python it is enough to do `x = None` to release the object that was
pointed to by x previously. So at Python level doing this extra
del only spends more CPU time, but when we will switch to Cython, and
e.g. Msg.burst will be a C-level attribute, the following will not work
at all
del msg.burst
msg.burst = None
because at runtime it will complain that
del msg.burst
AttributeError: 'Msg' object has no attribute 'burst' and no __dict__
for setting new attributes
-> Remove unneeded del to save some time and avoid problems with upcoming switch to
Cython.
Change-Id: I7a83bdd52fb9318bd8b975f85ce37c7144873f61
---
M src/target/trx_toolkit/burst_fwd.py
M src/target/trx_toolkit/clck_gen.py
M src/target/trx_toolkit/fake_trx.py
3 files changed, 2 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/45/40045/1
diff --git a/src/target/trx_toolkit/burst_fwd.py b/src/target/trx_toolkit/burst_fwd.py
index e3da9c2..2824e0a 100644
--- a/src/target/trx_toolkit/burst_fwd.py
+++ b/src/target/trx_toolkit/burst_fwd.py
@@ -47,8 +47,7 @@
tx_freq = src_trx.get_tx_freq(rx_msg.fn)
if src_trx.rf_muted:
- del rx_msg.burst # burst bits are omited
- rx_msg.burst = None
+ rx_msg.burst = None # burst bits are omited
# Iterate over all known transceivers
for trx in self.trx_list:
diff --git a/src/target/trx_toolkit/clck_gen.py b/src/target/trx_toolkit/clck_gen.py
index ae7a899..f769c3e 100755
--- a/src/target/trx_toolkit/clck_gen.py
+++ b/src/target/trx_toolkit/clck_gen.py
@@ -82,7 +82,6 @@
self._thread.join()
# Free memory, reset breaker
- del self._thread
self._thread = None
self._breaker.clear()
diff --git a/src/target/trx_toolkit/fake_trx.py b/src/target/trx_toolkit/fake_trx.py
index 8f187ac..711ad21 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -226,8 +226,7 @@
return
# Since TRXDv1, we should send a NOPE.ind
- del msg.burst # burst bits are omited
- msg.burst = None
+ msg.burst = None # burst bits are omited
# TODO: shoud we make these values configurable?
msg.toa256 = self.TOA256_NOISE_DEFAULT
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/40045?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I7a83bdd52fb9318bd8b975f85ce37c7144873f61
Gerrit-Change-Number: 40045
Gerrit-PatchSet: 1
Gerrit-Owner: kirr <kirr(a)nexedi.com>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>