summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-28 00:13:19 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-28 00:13:19 (GMT)
commitfdb8cfab085d0f412411b090796e9f856ee0cab5 (patch)
tree17a5b88a77249d651d903f0f6a71c42065df65db /Lib/pickle.py
parentbdbe74183ceb7aedd71dd1afdf8755ee93e8c3ca (diff)
downloadcpython-fdb8cfab085d0f412411b090796e9f856ee0cab5.zip
cpython-fdb8cfab085d0f412411b090796e9f856ee0cab5.tar.gz
cpython-fdb8cfab085d0f412411b090796e9f856ee0cab5.tar.bz2
Removed the new LONG2 opcode: it's extravagant. If LONG1 isn't enough,
then the embedded argument consumes at least 256 bytes. The difference between a 3-byte prefix (LONG2 + 2 bytes) and a 5-byte prefix (LONG4 + 4 bytes) is at worst less than 1%. Note that binary strings and binary Unicode strings also have only "size is 1 byte, or size is 4 bytes?" flavors, and I expect for the same reason. The only place a 2-byte thingie was used was in BININT2, where the 2 bytes make up the *entire* embedded argument (and now EXT2 also does this); that's a large savings over 4 bytes, because the total opcode+argument size is so small in the BININT2/EXT2 case. Removed the TAKEN_FROM_ARGUMENT "number of bytes" code, and bifurcated it into TAKEN_FROM_ARGUMENT1 and TAKEN_FROM_ARGUMENT4. Now there's enough info in ArgumentDescriptor objects to deduce the # of bytes consumed by each opcode. Rearranged the order in which proto2 opcodes are listed in pickle.py.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 9352283..27d28eb 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -135,19 +135,18 @@ FALSE = 'I00\n' # not an opcode; see INT docs in pickletools.py
# Protocol 2 (not yet implemented) (XXX comments will be added later)
-NEWOBJ = '\x81'
PROTO = '\x80'
-EXT2 = '\x83'
+NEWOBJ = '\x81'
EXT1 = '\x82'
-TUPLE1 = '\x85'
+EXT2 = '\x83'
EXT4 = '\x84'
-TUPLE3 = '\x87'
+TUPLE1 = '\x85'
TUPLE2 = '\x86'
-NEWFALSE = '\x89'
+TUPLE3 = '\x87'
NEWTRUE = '\x88'
-LONG2 = '\x8b'
+NEWFALSE = '\x89'
LONG1 = '\x8a'
-LONG4 = '\x8c'
+LONG4 = '\x8b'
__all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$",x)])