From a4b740aacb147d8c50d4e7fdb81f14649560a0e6 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 16 Nov 2013 19:08:03 +0100 Subject: [PATCH] Add current opcodes, as implemented by Alexandre --- pep-3154.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pep-3154.txt b/pep-3154.txt index 8e0d4e368..1ef50aa05 100644 --- a/pep-3154.txt +++ b/pep-3154.txt @@ -143,6 +143,39 @@ integer, which is wasteful. A specific opcode with a 1-byte length would make many pickles smaller. +Summary of new opcodes +====================== + +* ``SHORT_BINUNICODE``: push a utf8-encoded str object with a one-byte + size prefix (therefore less than 256 bytes long). + +* ``BINUNICODE8``: push a utf8-encoded str object with a eight-byte + size prefix (for strings longer than 2**32 bytes, which therefore cannot + be serialized using ``BINUNICODE``). + +* ``BINBYTES8``: push a bytes object with a eight-byte size prefix + (for bytes objects longer than 2**32 bytes, which therefore cannot be + serialized using ``BINBYTES``). + +* ``EMPTY_SET``: push a new empty set object on the stack. + +* ``ADDITEMS``: add the topmost stack items to the set (to be used with + ``EMPTY_SET``). + +* ``EMPTY_FROZENSET``: push a new empty frozenset object on the stack. + +* ``FROZENSET``: create a frozenset object from the topmost stack items, + and push it on the stack. + +* ``NEWOBJ_EX``: take the three topmost stack items ``cls``, ``args`` + and ``kwargs``, and push the result of calling + ``cls.__new__(*args, **kwargs)``. + +* ``STACK_GLOBAL``: take the two topmost stack items ``module_name`` and + ``qualname``, and push the result of looking up the dotted ``qualname`` + in the module named ``module_name``. + + Alternative ideas =================