Lines Matching refs:stack
39 The PM has two data areas, "the stack" and "the memo".
41 Many opcodes push Python objects onto the stack; e.g., INT pushes a Python
42 integer object on the stack, whose value is gotten from a decimal string
44 opcodes take Python objects off the stack. The result of unpickling is
45 whatever object is left on the stack when the final STOP opcode is executed.
50 names. Some opcodes pop a stack object into the memo at a given index,
51 and others push a memo object at a given index onto the stack again.
111 a number of opcodes that operate on many stack elements at once (like APPENDS
153 # off the stack -- ArgumentDescriptor applies only to arguments embedded in
692 # Object descriptors. The stack used by the pickle machine holds objects,
695 # appear on the stack.
706 # human-readable docs for this kind of stack object; a string
795 or pull it off the stack. Instead the MARK opcode is used
796 to push a special marker object on the stack, and then
798 the stack down to (but not including) the topmost marker
805 doc="""An object representing a contiguous slice of the stack.
808 of the stack following the topmost markobject. For example,
809 the POP_MARK opcode changes the stack from
815 No matter how many object are on the stack after the topmost
841 # what the stack looks like before this opcode runs; a list
844 # what the stack looks like after this opcode runs; a list
1040 doc="Push None on the stack."),
1053 Push True onto the stack."""),
1063 Push False onto the stack."""),
1149 Stack before: ... pylist anyobject
1150 Stack after: ... pylist+[anyobject]
1161 doc="""Extend a list by a slice of stack objects.
1163 Stack before: ... pylist markobject stackslice
1164 Stack after: ... pylist+stackslice
1175 doc="""Build a list out of the topmost stack slice, after markobject.
1177 All the stack entries following the topmost markobject are placed into
1179 stack from the topmost markobject onward. For example,
1181 Stack before: ... markobject 1 2 3 'abc'
1182 Stack after: ... [1, 2, 3, 'abc']
1201 doc="""Build a tuple out of the topmost stack slice, after markobject.
1203 All the stack entries following the topmost markobject are placed into
1205 stack from the topmost markobject onward. For example,
1207 Stack before: ... markobject 1 2 3 'abc'
1208 Stack after: ... (1, 2, 3, 'abc')
1217 doc="""Build a one-tuple out of the topmost item on the stack.
1219 This code pops one value off the stack and pushes a tuple of
1223 stack[-1] = tuple(stack[-1:])
1232 doc="""Build a two-tuple out of the top two items on the stack.
1234 This code pops two values off the stack and pushes a tuple of
1238 stack[-2:] = [tuple(stack[-2:])]
1247 doc="""Build a three-tuple out of the top three items on the stack.
1249 This code pops three values off the stack and pushes a tuple of
1253 stack[-3:] = [tuple(stack[-3:])]
1272 doc="""Build a dict out of the topmost stack slice, after markobject.
1274 All the stack entries following the topmost markobject are placed into
1276 stack from the topmost markobject onward. The stack slice alternates
1279 Stack before: ... markobject 1 2 3 'abc'
1280 Stack after: ... {1: 2, 3: 'abc'}
1291 Stack before: ... pydict key value
1292 Stack after: ... pydict
1305 The slice of the stack following the topmost markobject is taken as
1309 of the stack.
1311 Stack before: ... pydict markobject key_1 value_1 ... key_n value_n
1312 Stack after: ... pydict
1318 # Stack manipulation.
1326 doc="Discard the top stack item, shrinking the stack by one item."),
1334 doc="Push the top stack item onto the stack again, duplicating it."),
1342 doc="""Push markobject onto the stack.
1345 region of the stack containing a variable number of objects for them
1355 doc="""Pop all the stack objects at and above the topmost markobject.
1357 When an opcode using a variable number of stack objects is done,
1359 that delimited their starting position on the stack.
1371 doc="""Read an object from the memo and push it on the stack.
1384 doc="""Read an object from the memo and push it on the stack.
1396 doc="""Read an object from the memo and push it on the stack.
1408 doc="""Store the stack top into the memo. The stack is not popped.
1421 doc="""Store the stack top into the memo. The stack is not popped.
1433 doc="""Store the stack top into the memo. The stack is not popped.
1461 extension registry, and the object at that index is pushed on the stack.
1486 # Push a class object, or module function, on the stack, via its module
1495 doc="""Push a global object (module.attr) on the stack.
1499 object module.class is pushed on the stack. More accurately, the
1501 stack, so unpickling subclasses can override this form of lookup.
1519 Stack before: ... callable pytuple
1520 Stack after: ... callable(*pytuple)
1546 Stack before: ... anyobject argument
1547 Stack after: ... anyobject
1584 In addition, all the objects on the stack following the topmost
1590 + The argtuple is empty (markobject was at the top of the stack
1603 the new instance object is pushed on the stack, and we're done. In
1620 argtuple obtained from the stack, and the resulting instance object
1621 is pushed on the stack.
1636 is taken off the stack, allowing it to be retrieved from the memo
1642 the class object is taken off the stack, immediately above the
1645 Stack before: ... markobject classobject stackslice
1646 Stack after: ... new_instance_object
1648 As for INST, the remainder of the stack above the markobject is
1667 The stack before should be thought of as containing a class
1668 object followed by an argument tuple (the tuple being the stack
1669 top). Call these cls and args. They are popped off the stack,
1671 onto the stack.
1696 Every pickle ends with this opcode. The object at the top of the stack
1697 is popped, and that's the result of unpickling. The stack should be
1715 object that returns is pushed on the stack. There is no implementation
1728 Like PERSID, except the persistent ID is popped off the stack (instead
1731 returns is pushed on the stack. See PERSID for more detail.
1914 + Explicit and implicit pop operations have enough items on the stack.
1917 actually on the stack.
1927 # anyway to detect when a protocol 0 POP takes a MARK off the stack
1930 stack = [] # crude emulation of unpickler stack
1953 stack and
1954 stack[-1] is markobject):
1966 while stack[-1] is not markobject:
1967 stack.pop()
1968 stack.pop()
1976 errormsg = markmsg = "no MARK exists on stack"
1983 elif not stack:
1984 errormsg = "stack is empty -- can't store into memo"
1985 elif stack[-1] is markobject:
1988 memo[arg] = stack[-1]
1993 after = [memo[arg]] # for better stack emulation
2011 # Emulate the stack effects.
2012 if len(stack) < numtopop:
2013 raise ValueError("tries to pop %d items from stack with "
2014 "only %d items" % (numtopop, len(stack)))
2016 del stack[-numtopop:]
2021 stack.extend(after)
2024 if stack:
2025 raise ValueError("stack not empty after STOP: %r" % stack)
2177 has to emulate the stack in order to realize that the POP opcode at 16 gets