Skip to content

Commit

Permalink
refix py3.7 dict_keys not reversible bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchen committed Dec 26, 2020
1 parent b2de494 commit 63b475a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true,
"python.envFile": "${workspaceRoot}/vscode.env",
"python.pythonPath": "C:\\Users\\Chen\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
"python.envFile": "${workspaceRoot}/vscode.env"
}
5 changes: 4 additions & 1 deletion src/bdfparser/bdfparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ def itercps(self, order=1, r=None):
elif order == 2:
retiterator = iter(sorted(ks, reverse=True))
elif order == -1:
retiterator = reversed(ks)
try:
retiterator = reversed(ks)
except TypeError:
retiterator = reversed(list(ks)) # Python <=3.7
if r is not None:
def f(cp):
if isinstance(r, int):
Expand Down

0 comments on commit 63b475a

Please sign in to comment.