Skip to content

Commit

Permalink
CardMonitoringThread(): do not catch unexpected exceptions
Browse files Browse the repository at this point in the history
The exceptions were supposed to be gnerated by the __del__() method.
But the __del__() method was already commented out since
9f2198c in 2007.

Thanks to Anton Hvornum for the bug report
" pyscard mutes/hides user created exceptions in on_insert() hook. #167 "
Closes: #167
  • Loading branch information
LudovicRousseau committed May 8, 2024
1 parent e0d000c commit 4560bc1
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions smartcard/CardMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,6 @@ def run(self):
self.observable.notifyObservers(
(addedcards, removedcards))

# when CardMonitoringThread.__del__() is invoked in
# response to shutdown, e.g., when execution of the
# program is done, other globals referenced by the
# __del__() method may already have been deleted.
# this causes ReaderMonitoringThread.run() to except
# with a TypeError or AttributeError
except TypeError:
pass
except AttributeError:
pass

except SmartcardException as exc:
# FIXME Tighten the exceptions caught by this block
traceback.print_exc()
Expand Down Expand Up @@ -223,13 +212,6 @@ def __getattr__(self, name):
if self.instance:
return getattr(self.instance, name)

# commented to avoid bad clean-up sequence of python where __del__
# is called when some objects it uses are already gargabe collected
# def __del__(self):
# if CardMonitoringThread.instance!=None:
# CardMonitoringThread.instance.stop()
# CardMonitoringThread.instance = None


if __name__ == "__main__":
print('insert or remove cards in the next 10 seconds')
Expand Down

0 comments on commit 4560bc1

Please sign in to comment.