[Pcsclite-git-commit] [PCSC] 02/02: Python 3: fix SCardGetStatusChange()

Ludovic Rousseau rousseau at moszumanska.debian.org
Wed Feb 15 23:21:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit 1c5426260c8e74e4bdfe2bbd27eb4336f49cc7ed
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Feb 16 00:17:42 2017 +0100

    Python 3: fix SCardGetStatusChange()
    
    The SCardGetStatusChange() readerstatelist argument must be a list.
    With Python 3 a dict.values() if of type dict_values instead of list in
    Python 2. So we force a conversion into a list using list().
---
 UnitaryTests/SCardCancel.py           | 6 ++++--
 UnitaryTests/SCardCancel3.py          | 6 ++++--
 UnitaryTests/SCardGetStatusChange.py  | 6 ++++--
 UnitaryTests/SCardGetStatusChange2.py | 3 ++-
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/UnitaryTests/SCardCancel.py b/UnitaryTests/SCardCancel.py
index 37bde1c..700bf7f 100755
--- a/UnitaryTests/SCardCancel.py
+++ b/UnitaryTests/SCardCancel.py
@@ -43,7 +43,8 @@ print('PC/SC Readers:', readers)
 readerstates = {}
 for reader in readers:
     readerstates[reader] = (reader, SCARD_STATE_UNAWARE)
-hresult, newstates = SCardGetStatusChange(hcontext, 0, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 0,
+        list(readerstates.values()))
 if hresult != SCARD_S_SUCCESS:
     raise BaseSCardException(hresult)
 print(newstates)
@@ -54,7 +55,8 @@ for state in newstates:
 t = threading.Thread(target=cancel)
 t.start()
 
-hresult, newstates = SCardGetStatusChange(hcontext, 10000, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 10000,
+        list(readerstates.values()))
 print("SCardGetStatusChange()", SCardGetErrorMessage(hresult))
 if hresult != SCARD_S_SUCCESS and hresult != SCARD_E_TIMEOUT:
     if SCARD_E_CANCELLED == hresult:
diff --git a/UnitaryTests/SCardCancel3.py b/UnitaryTests/SCardCancel3.py
index ce76668..bf1f5ab 100755
--- a/UnitaryTests/SCardCancel3.py
+++ b/UnitaryTests/SCardCancel3.py
@@ -34,7 +34,8 @@ import sys
 
 def getstatuschange():
     # this call will be cancelled
-    hresult, newstates = SCardGetStatusChange(hcontext, 10000, readerstates.values())
+    hresult, newstates = SCardGetStatusChange(hcontext, 10000,
+            list(readerstates.values()))
     print("SCardGetStatusChange()", SCardGetErrorMessage(hresult))
     if hresult != SCARD_S_SUCCESS and hresult != SCARD_E_TIMEOUT:
         if SCARD_E_CANCELLED == hresult:
@@ -67,7 +68,8 @@ print('PC/SC Readers:', readers)
 readerstates = {}
 for reader in readers:
     readerstates[reader] = (reader, SCARD_STATE_UNAWARE)
-hresult, newstates = SCardGetStatusChange(hcontext, 0, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 0,
+        list(readerstates.values()))
 if hresult != SCARD_S_SUCCESS:
     raise BaseSCardException(hresult)
 print(newstates)
diff --git a/UnitaryTests/SCardGetStatusChange.py b/UnitaryTests/SCardGetStatusChange.py
index 4d73d6f..eff978c 100755
--- a/UnitaryTests/SCardGetStatusChange.py
+++ b/UnitaryTests/SCardGetStatusChange.py
@@ -69,7 +69,8 @@ print('PC/SC Readers:', readers)
 readerstates = {}
 for reader in readers:
     readerstates[reader] = (reader, SCARD_STATE_UNAWARE)
-hresult, newstates = SCardGetStatusChange(hcontext, 0, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 0,
+        list(readerstates.values()))
 if hresult != SCARD_S_SUCCESS:
     raise BaseSCardException(hresult)
 print(newstates)
@@ -79,7 +80,8 @@ for readerState in newstates:
 
 print("Remove the reader")
 
-hresult, newstates = SCardGetStatusChange(hcontext, 10000, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 10000,
+        list(readerstates.values()))
 print("SCardGetStatusChange()", SCardGetErrorMessage(hresult))
 if hresult != SCARD_S_SUCCESS and hresult != SCARD_E_TIMEOUT:
     raise BaseSCardException(hresult)
diff --git a/UnitaryTests/SCardGetStatusChange2.py b/UnitaryTests/SCardGetStatusChange2.py
index 4509479..ade7484 100755
--- a/UnitaryTests/SCardGetStatusChange2.py
+++ b/UnitaryTests/SCardGetStatusChange2.py
@@ -38,7 +38,8 @@ print(readers)
 readerstates = {}
 for reader in readers:
     readerstates[reader] = (reader, SCARD_STATE_UNAWARE)
-hresult, newstates = SCardGetStatusChange(hcontext, 10, readerstates.values())
+hresult, newstates = SCardGetStatusChange(hcontext, 10,
+        list(readerstates.values()))
 print("SCardGetStatusChange()", SCardGetErrorMessage(hresult))
 if hresult != SCARD_S_SUCCESS:
     raise BaseSCardException(hresult)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list