• Home
  • Raw
  • Download

Lines Matching refs:pickle

3 import pickle
24 assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2
25 protocols = range(pickle.HIGHEST_PROTOCOL + 1)
80 def opcode_in_pickle(code, pickle): argument
81 for op, dummy, dummy in pickletools.genops(pickle):
87 def count_opcode(code, pickle): argument
89 for op, dummy, dummy in pickletools.genops(pickle):
1085 pickle = self.dumps(n, proto)
1086 got = self.loads(pickle)
1103 pickle = self.dumps(value, proto)
1104 got = self.loads(pickle)
1127 copy_reg.pickle(pickling_metaclass, pickling_metaclass.__reduce__)
1157 build_none = pickle.NONE + pickle.STOP
1161 expected = pickle.PROTO + chr(proto) + expected
1166 badpickle = pickle.PROTO + chr(oob) + build_none
1181 self.assertEqual(opcode_in_pickle(pickle.LONG1, s), proto >= 2)
1189 self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2)
1193 expected_opcode = {(0, 0): pickle.TUPLE,
1194 (0, 1): pickle.TUPLE,
1195 (0, 2): pickle.TUPLE,
1196 (0, 3): pickle.TUPLE,
1197 (0, 4): pickle.TUPLE,
1199 (1, 0): pickle.EMPTY_TUPLE,
1200 (1, 1): pickle.TUPLE,
1201 (1, 2): pickle.TUPLE,
1202 (1, 3): pickle.TUPLE,
1203 (1, 4): pickle.TUPLE,
1205 (2, 0): pickle.EMPTY_TUPLE,
1206 (2, 1): pickle.TUPLE1,
1207 (2, 2): pickle.TUPLE2,
1208 (2, 3): pickle.TUPLE3,
1209 (2, 4): pickle.TUPLE,
1226 expected_opcode = {(0, None): pickle.NONE,
1227 (1, None): pickle.NONE,
1228 (2, None): pickle.NONE,
1230 (0, True): pickle.INT,
1231 (1, True): pickle.INT,
1232 (2, True): pickle.NEWTRUE,
1234 (0, False): pickle.INT,
1235 (1, False): pickle.INT,
1236 (2, False): pickle.NEWFALSE,
1334 self.produce_global_ext(0x00000001, pickle.EXT1) # smallest EXT1 code
1335 self.produce_global_ext(0x000000ff, pickle.EXT1) # largest EXT1 code
1338 self.produce_global_ext(0x00000100, pickle.EXT2) # smallest EXT2 code
1339 self.produce_global_ext(0x0000ffff, pickle.EXT2) # largest EXT2 code
1340 self.produce_global_ext(0x0000abcd, pickle.EXT2) # check endianness
1343 self.produce_global_ext(0x00010000, pickle.EXT4) # smallest EXT4 code
1344 self.produce_global_ext(0x7fffffff, pickle.EXT4) # largest EXT4 code
1345 self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness
1354 num_appends = count_opcode(pickle.APPENDS, s)
1363 num_appends = count_opcode(pickle.APPENDS, s)
1376 num_setitems = count_opcode(pickle.SETITEMS, s)
1385 num_setitems = count_opcode(pickle.SETITEMS, s)
1400 self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), proto >= 2)
1416 self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), proto >= 2)
1501 except (AttributeError, pickle.PicklingError, cPickle.PicklingError):
1505 except (AttributeError, pickle.PicklingError, cPickle.PicklingError):
1557 self._check_pickling_with_opcode(obj, pickle.APPEND, proto)
1559 self._check_pickling_with_opcode(obj, pickle.APPENDS, proto)
1565 self._check_pickling_with_opcode(obj, pickle.SETITEM, proto)
1567 self._check_pickling_with_opcode(obj, pickle.SETITEMS, proto)