1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
commit e2eb7d4a52a762795c1a8aa9804f184b11b5e64d
Author: Dain Nilsson <dain@yubico.com>
Date: Mon Apr 14 13:20:17 2025 +0200
Support pyscard >=2.2.2
--- a/fido2/pcsc.py
+++ b/fido2/pcsc.py
@@ -34,7 +34,6 @@
from smartcard import System
from smartcard.CardConnection import CardConnection
from smartcard.pcsc.PCSCExceptions import ListReadersException
-from smartcard.pcsc.PCSCContext import PCSCContext
from threading import Event
from typing import Tuple, Optional, Callable, Iterator
@@ -243,9 +242,15 @@
def _list_readers():
try:
return System.readers()
- except ListReadersException:
+ except ListReadersException as e:
# If the PCSC system has restarted the context might be stale, try
# forcing a new context (This happens on Windows if the last reader is
# removed):
- PCSCContext.instance = None
- return System.readers()
+ try:
+ from smartcard.pcsc.PCSCContext import PCSCContext
+
+ PCSCContext.instance = None
+ return System.readers()
+ except ImportError:
+ # As of pyscard 2.2.2 the PCSCContext singleton has been removed
+ raise e
|