MCPcopy Index your code
hub / github.com/python/cpython / highest_proto_for_py_version

Function highest_proto_for_py_version

Lib/test/test_xpickle.py:35–48  ·  view source on GitHub ↗

Finds the highest supported pickle protocol for a given Python version. Args: py_version: a 2-tuple of the major, minor version. Eg. Python 3.7 would be (3, 7) Returns: int for the highest supported pickle protocol

(py_version)

Source from the content-addressed store, hash-verified

33}
34
35def highest_proto_for_py_version(py_version):
36 """Finds the highest supported pickle protocol for a given Python version.
37 Args:
38 py_version: a 2-tuple of the major, minor version. Eg. Python 3.7 would
39 be (3, 7)
40 Returns:
41 int for the highest supported pickle protocol
42 """
43 proto = 2
44 for p, v in protocols_map.items():
45 if py_version < v:
46 break
47 proto = p
48 return proto
49
50def have_python_version(py_version):
51 """Check whether a Python binary exists for the given py_version and has

Callers 1

setUpClassMethod · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…