mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
9 lines
210 B
Python
9 lines
210 B
Python
import pickletools
|
|
|
|
def protocol_version(file_object):
|
|
maxproto = -1
|
|
for opcode, arg, pos in pickletools.genops(file_object):
|
|
maxproto = max(maxproto, opcode.proto)
|
|
return maxproto
|
|
|