Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCSCCardConnection.__del__: ignore SCARD_E_INVALID_VALUE error
In some cases the value self.hcontext becomes invalid before SCardReleaseContext() is called. This happens if the reader is removed for example. The problem was visible when using a smartcard.Session() and we disconnect the reader before the end of the session. When the program exists we had something like: Exception ignored in: <function PCSCCardConnection.__del__ at 0x7f8fb65957e0> Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/pyscard-2.0.3-py3.10-linux-x86_64.egg/smartcard/pcsc/PCSCCardConnection.py", line 90, in __del__ smartcard.Exceptions.CardConnectionException: Failed to release context: Invalid value given. Thanks to Frank Morgner for the bug report " Quitting Session causes "Exception ignored in" LudovicRousseau#131 " LudovicRousseau#131
- Loading branch information