Skip to content

Commit 363b75e

Browse files
author
Colin D Bennett
committed
Use name as sort key to fix Python 3 TypeError
Sort types explicitly by name to fix unorderable types TypeError in Python 3. The call to sort() on cli.py line 259 produced the error: TypeError: unorderable types: type() < type()
1 parent acc1511 commit 363b75e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gitlab/cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from __future__ import absolute_import
2222
import argparse
2323
import inspect
24+
import operator
2425
import re
2526
import sys
2627

@@ -256,7 +257,7 @@ def main():
256257
classes.append(cls)
257258
except AttributeError:
258259
pass
259-
classes.sort()
260+
classes.sort(key=operator.attrgetter("__name__"))
260261

261262
for cls in classes:
262263
arg_name = clsToWhat(cls)

0 commit comments

Comments
 (0)