Skip to content

Commit 63b475a

Browse files
committed
refix py3.7 dict_keys not reversible bug
1 parent b2de494 commit 63b475a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"python.testing.unittestEnabled": false,
33
"python.testing.nosetestsEnabled": false,
44
"python.testing.pytestEnabled": true,
5-
"python.envFile": "${workspaceRoot}/vscode.env",
6-
"python.pythonPath": "C:\\Users\\Chen\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
5+
"python.envFile": "${workspaceRoot}/vscode.env"
76
}

src/bdfparser/bdfparser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ def itercps(self, order=1, r=None):
379379
elif order == 2:
380380
retiterator = iter(sorted(ks, reverse=True))
381381
elif order == -1:
382-
retiterator = reversed(ks)
382+
try:
383+
retiterator = reversed(ks)
384+
except TypeError:
385+
retiterator = reversed(list(ks)) # Python <=3.7
383386
if r is not None:
384387
def f(cp):
385388
if isinstance(r, int):

0 commit comments

Comments
 (0)