mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
added pickleversion.py
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user