Change in pysim[master]: ModemATCommandLink: fix AttributeError exception in __del__()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon May 3 14:13:14 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/24039 )

Change subject: ModemATCommandLink: fix AttributeError exception in __del__()
......................................................................

ModemATCommandLink: fix AttributeError exception in __del__()

self._sl will not be assigned if serial.Serial() fails.

Change-Id: I179a7efd92eaa3469a17b6ef252b3949c44ea6ea
---
M pySim/transport/modem_atcmd.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  dexter: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 43614f1..2018ac2 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -43,7 +43,8 @@
 		self.reset_card()
 
 	def __del__(self):
-		self._sl.close()
+		if hasattr(self, '_sl'):
+			self._sl.close()
 
 	def send_at_cmd(self, cmd, timeout=0.2, patience=0.002):
 		# Convert from string to bytes, if needed

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24039
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I179a7efd92eaa3469a17b6ef252b3949c44ea6ea
Gerrit-Change-Number: 24039
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210503/548a227b/attachment.htm>


More information about the gerrit-log mailing list