File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 2525# Python binary to execute and its arguments.
2626py_executable_map = {}
2727
28+ protocols_map = {
29+ 3 : (3 , 0 ),
30+ 4 : (3 , 4 ),
31+ 5 : (3 , 8 ),
32+ }
33+
2834def highest_proto_for_py_version (py_version ):
2935 """Finds the highest supported pickle protocol for a given Python version.
3036 Args:
@@ -33,20 +39,12 @@ def highest_proto_for_py_version(py_version):
3339 Returns:
3440 int for the highest supported pickle protocol
3541 """
36- major = sys .version_info .major
37- minor = sys .version_info .minor
38- # Versions older than py 3 only supported up until protocol 2.
39- if py_version < (3 , 0 ):
40- return 2
41- elif py_version < (3 , 4 ):
42- return 3
43- elif py_version < (3 , 8 ):
44- return 4
45- elif py_version <= (major , minor ):
46- return 5
47- else :
48- # Safe option.
49- return 2
42+ proto = 2
43+ for p , v in protocols_map .items ():
44+ if py_version < v :
45+ break
46+ proto = p
47+ return proto
5048
5149def have_python_version (py_version ):
5250 """Check whether a Python binary exists for the given py_version and has
You can’t perform that action at this time.
0 commit comments