mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-31 09:24:48 +03:00
transport/pcsc: work around Python 3.5 bug: guard disconnect()
Unfortunately, Debian ships old Python (3.5 vs 3.8) and old pyscard (1.9.4 vs 1.9.9). Calling PCSCCardConnection.disconnect() from a destructor causes warnings about ignored exceptions: AttributeError: 'NoneType' object has no attribute 'disconnect' AttributeError: 'NoneType' object has no attribute 'setChanged' AttributeError: 'NoneType' object has no attribute 'SCardDisconnect' TypeError: 'NoneType' object is not callable All these exceptions happen in pyscard's own destructors. Change-Id: I9c644bc5fe9791b141a30bfc13647d77937a82ee
This commit is contained in:
@@ -39,7 +39,11 @@ class PcscSimLink(LinkBase):
|
|||||||
self._con = self._reader.createConnection()
|
self._con = self._reader.createConnection()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self._con.disconnect()
|
try:
|
||||||
|
# FIXME: this causes multiple warnings in Python 3.5.3
|
||||||
|
self._con.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
def wait_for_card(self, timeout=None, newcardonly=False):
|
def wait_for_card(self, timeout=None, newcardonly=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user