Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/__pycache__/pickletools.cpython-311.opt-2.pyc
�

�,d.m�
�f�	ddlZddlZddlZddlZddlZgd�ZejZdZdZdZ	dZ
dZGd�d	e��Z
dd
lmZd�Ze
dd
ed���Zd�Ze
dded���Zd�Ze
dded���Zd�Ze
dded���Zd�Ze
dded���Z�d�d �Ze
d!eed"���Zd#�Ze
d$eed%���Zd&�Ze
d'eed(���Z d)�Z!e
d*ee!d+���Z"d,�Z#e
d-e	e#d.���Z$d/�Z%e
d0ee%d1���Z&d2�Z'e
d3e
e'd4���Z(d5�Z)e
d6ee)d7���Z*d8�Z+e
d9ee+d:���Z,d;�Z-e
d<ee-d=���Z.d>�Z/e
d?ee/d@���Z0dA�Z1e
dBe
e1dC���Z2dD�Z3e
dEee3dF���Z4dG�Z5dH�Z6e
dIee5dJ���Z7e
dKee6dL���Z8dM�Z9e
dNee9dO���Z:dP�Z;e
dQde;dR���Z<ddSlm=Z=dT�Z>e
dUee>dV���Z?dW�Z@e
dXe	e@dY���ZAGdZ�d[e��ZBeBd\eCd]�^��xZDZEeBd_eCeFfd`�^��ZGeBdaeFdb�^��ZHeBdceIdd�^��ZJeBdeeKeLfdf�^��xZMZNeBdgeKdh�^��ZOeBdiePdj�^��ZQeBdkeLdl�^��ZReBdmeSd��dn�^��ZTeBdoeUdp�^��ZVeBdqeWdr�^��ZXeBdseYdt�^��ZZeBdue[dv�^��Z\eBdwe[dx�^��Z]eBdyedz�^��Z^eBd{ed|�^��Z_eBd}eBd~�^��Z`eBdeBd��^��ZaGd��d�e��ZbebZcgecd�d�e7geGgdd������ecd�d�egeDgd
d������ecd�d�egeDgd
d������ecd�d�egeDgd
d������ecd�d�e8geDgdd������ecd�d�e?geDgdd������ecd�d�eAgeDgdd������ecd�d�egeMgdd������ecd�d�e$geMgd
d������ecd�d�e"geMgd
d������ecd�d�e(geOgd�d������ecd�d�e&geOgd�d������ecd�d�e*geOgdd������ecd�d�e,geQgd�d������ecd�d�dge^gd�d������ecd�d�de^ge^gd�d������ecd�d�dgeTgdd������ecd�d�dgeHgdd������ecd�d�dgeHgdd������ecd�d�e.geRgdd������ecd�d�e0geRgddĬ����ecd�d�e2geRgd
dǬ����ecd�d�e4geRgddʬ����ecd�d�e:geJgddͬ����ecd�d�e<geJgd
d����ecd�d�dgeXgd
dӬ����ecd�d�deXe_geXgdd֬����ecd�d�deXe`eageXgd
d٬����ecd�d�de`eageXgddܬ����ecd�d�dgeVgd
d߬����ecd�d�de`eageVgdd⬆���ecd�d�de_geVgdd嬆���ecd�d�de_e_geVgdd謆���ecd�d�de_e_e_geVgdd묆���ecd�d�dgeZgd
d���ecd�d�de`eageZgdd񬆦��ecd�d�deZe_e_geZgdd���ecd�d�deZe`eageZgd
d������ecd�d�dge\gdd������ecd�d�de\e`eage\gdd������ecd�d�de`eage]gd�d�����ec�d�dde_ggd�d�����ec�d�dde_ge_e_gd�d�����ec�d�ddge`gd�d	�����ec�d
�dde`eaggd
�d�����ec�d
�de7ge_gd�d�����ec�d�dege_gd
�d�����ec�d�dege_gd
�d�����ec�d�de7ggd�d�����ec�d�deggd
�d�����ec�d�deggd
�d�����ec�d�d de_ge_gd�d!�����ec�d"�d#ege_gd�d$�����ec�d%�d&ege_gd�d'�����ec�d(�d)ege_gd�d*�����ec�d+�d,e ge_gd�d-�����ec�d.�d/deReRge_gd�d0�����ec�d1�d2de_e_ge_gd�d3�����ec�d4�d5de_e_ge_gd�d6�����ec�d7�d8e e`eage_gd�d9�����ec�d:�d;de`e_eage_gd
�d<�����ec�d=�d>de_e_ge_gd�d?�����ec�d@�dAde_e_e_ge_gd�dB�����ec�dC�dDeggd�dE�����ec�dF�dGde_ggd�dH�����ec�dI�dJeggd�dK�����ec�dL�dMege_gd�dN�����ec�dO�dPde_ge_gd
�dQ�����Zd[ciZeiZfeged��D]o\ZhZieijjeevr"ek�dReijjeeeijjehfz���eijlefvr"ek�dSeijlefeijlehfz���eheeeijj<ehefeijl<�p[e[f[h[iiZmedD]Zieiemeijl<�
[i�d��dU�Znen��[n�d��dV�Zo�dW�Zp�dX�Zq�d��dY�ZrG�dZ��d[��Zs�d\Zt�d]Zueteu�d^�Zv�d_�Zwex�d`k�rddlyZyeyjz�da��b��Z{e{�|�dceyj}�dd���de�df��g��e{�|�dh�diej~eyj}�dj���dk��l��e{�|�dm�dn�do�dp��q��e{�|�dr�dsdeC�dt��l��e{�|�du�dv�do�dw��q��e{�|�dx�dy�dz�d{��|��e{�|�d}�d~�do�d��q��e{�|�d��do�d���q��e{���Z�e�j�rew��dSe�j�r�d�ndZ�e�j�se{����dSe�e�j���d
kr&ere�j�de�j�de�j�e���dSe�j�rindZ�e�j�D]\Z�e�j���e�jj�����Z�e�j���e��d�z��ere�e�j�e�e�j�e����[dSdS(��N)�dis�genops�optimize���������������c��eZdZdZd�ZdS)�ArgumentDescriptor��name�n�reader�docc�>�||_||_||_||_dS�Nr
)�selfrrrrs     �2/opt/alt/python311/lib64/python3.11/pickletools.py�__init__zArgumentDescriptor.__init__�s&����	������������N��__name__�
__module__�__qualname__�	__slots__r�rrrr�s*�������I�$����rr)�unpackc�`�	|�d��}|r|dStd���)N�rz'not enough data in stream to read uint1)�read�
ValueError��f�datas  r�
read_uint1r&�s8���
�6�6�!�9�9�D����A�w��
�>�
?�
?�?r�uint1r zOne-byte unsigned integer.r
c��	|�d��}t|��dkrtd|��dStd���)N�z<Hrz'not enough data in stream to read uint2�r!�len�_unpackr"r#s  r�
read_uint2r-��K���
�6�6�!�9�9�D�
�4�y�y�A�~�~��t�T�"�"�1�%�%�
�>�
?�
?�?r�uint2r)z)Two-byte unsigned integer, little-endian.c��	|�d��}t|��dkrtd|��dStd���)N�z<irz&not enough data in stream to read int4r*r#s  r�	read_int4r2�sK���
�6�6�!�9�9�D�
�4�y�y�A�~�~��t�T�"�"�1�%�%�
�=�
>�
>�>r�int4r1z8Four-byte signed integer, little-endian, 2's complement.c��	|�d��}t|��dkrtd|��dStd���)Nr1z<Irz'not enough data in stream to read uint4r*r#s  r�
read_uint4r5r.r�uint4z*Four-byte unsigned integer, little-endian.c��	|�d��}t|��dkrtd|��dStd���)N�z<Qrz'not enough data in stream to read uint8r*r#s  r�
read_uint8r9&r.r�uint8r8z+Eight-byte unsigned integer, little-endian.Tc��	|���}|�d��std���|dd�}|rbdD]M}|�|��r6|�|��std|�d|�����|dd�}n�Ntd|z���|r-t	j|��d	�d
��}|S)N�
z-no newline found when trying to read stringnlr)�"�'z
strinq quote z not found at both ends of r zno string quotes around %rr�ascii)�readline�endswithr"�
startswith�codecs�
escape_decode�decode)r$rE�stripquotesr%�qs     r�
read_stringnlrH;s
���4
�:�:�<�<�D��=�=����J��H�I�I�I�����9�D��	B��	B�	B�A����q�!�!�
��}�}�Q�'�'�?�$�*�56�Q�Q���&>�?�?�?��A�b�D�z����
��9�D�@�A�A�A�
�=��#�D�)�)�!�,�3�3�G�<�<���Kr�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   c�$�t|d���S)NF)rF)rH�r$s r�read_stringnl_noescaperLts�����.�.�.�.r�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        c�F�	t|���dt|����S)N� )rLrKs r�read_stringnl_noescape_pairrP�s.���-�Q�/�/�/�/�1G��1J�1J�1J�K�Kr�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             c���	t|��}|�|��}t|��|kr|�d��St	d|t|��fz���)N�latin-1z2expected %d bytes in a string1, but only %d remain)r&r!r+rEr"�r$rr%s   r�read_string1rU�sk���	�1�
�
�A��6�6�!�9�9�D�
�4�y�y�A�~�~��{�{�9�%�%�%�
�I���T���^�$�%�%�%r�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              c��	t|��}|dkrtd|z���|�|��}t|��|kr|�d��Std|t|��fz���)Nrzstring4 byte count < 0: %drSz2expected %d bytes in a string4, but only %d remain)r2r"r!r+rErTs   r�read_string4rX�s���
�	�!���A��1�u�u��5��9�:�:�:��6�6�!�9�9�D�
�4�y�y�A�~�~��{�{�9�%�%�%�
�I���T���^�$�%�%�%r�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              c��	t|��}|�|��}t|��|kr|Std|t|��fz���)Nz1expected %d bytes in a bytes1, but only %d remain)r&r!r+r"rTs   r�read_bytes1r[�s^���	�1�
�
�A��6�6�!�9�9�D�
�4�y�y�A�~�~���
�H���T���^�$�%�%�%r�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              c��	t|��}|tjkrtd|z���|�|��}t|��|kr|Std|t|��fz���)Nz#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remain)r5�sys�maxsizer"r!r+rTs   r�read_bytes4r`�s}��
�	�1�
�
�A��3�;����>��B�C�C�C��6�6�!�9�9�D�
�4�y�y�A�~�~���
�H���T���^�$�%�%�%r�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              c��	t|��}|tjkrtd|z���|�|��}t|��|kr|Std|t|��fz���)Nz#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remain)r9r^r_r"r!r+rTs   r�read_bytes8rcs}���	�1�
�
�A��3�;����>��B�C�C�C��6�6�!�9�9�D�
�4�y�y�A�~�~���
�H���T���^�$�%�%�%r�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              c��	t|��}|tjkrtd|z���|�|��}t|��|krt
|��Std|t|��fz���)Nz'bytearray8 byte count > sys.maxsize: %dz5expected %d bytes in a bytearray8, but only %d remain)r9r^r_r"r!r+�	bytearrayrTs   r�read_bytearray8rg9s����	�1�
�
�A��3�;����B�Q�F�G�G�G��6�6�!�9�9�D�
�4�y�y�A�~�~������
�L���T���^�$�%�%�%r�
bytearray8z�A counted bytearray.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              c��	|���}|�d��std���|dd�}t|d��S)Nr<z4no newline found when trying to read unicodestringnlrzraw-unicode-escape)r@rAr"�strr#s  r�read_unicodestringnlrk[s_���
�:�:�<�<�D��=�=����,��+�,�,�	,�����9�D��t�)�*�*�*r�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      c���	t|��}|�|��}t|��|krt|dd��St	d|t|��fz���)N�utf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remain)r&r!r+rjr"rTs   r�read_unicodestring1rpusm���"	�1�
�
�A��6�6�!�9�9�D�
�4�y�y�A�~�~��4��/�2�2�2�
��!"�C��I�I��/�0�0�0r�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    c��	t|��}|tjkrtd|z���|�|��}t|��|krt
|dd��Std|t|��fz���)Nz+unicodestring4 byte count > sys.maxsize: %drnroz9expected %d bytes in a unicodestring4, but only %d remain)r5r^r_r"r!r+rjrTs   r�read_unicodestring4rs�����"	�1�
�
�A��3�;����F��J�K�K�K��6�6�!�9�9�D�
�4�y�y�A�~�~��4��/�2�2�2�
��!"�C��I�I��/�0�0�0r�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    c��	t|��}|tjkrtd|z���|�|��}t|��|krt
|dd��Std|t|��fz���)Nz+unicodestring8 byte count > sys.maxsize: %drnroz9expected %d bytes in a unicodestring8, but only %d remain)r9r^r_r"r!r+rjrTs   r�read_unicodestring8rw�rtr�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    c�f�	t|dd���}|dkrdS|dkrdSt|��S)NF�rErFs00s01T�rH�int�r$�ss  r�read_decimalnl_shortr�sF��	�	�a��5�9�9�9�A�	�E�z�z��u�	
�e����t��q�6�6�Mrc�v�	t|dd���}|dd�dkr
|dd�}t|��S)NFrzr�Lr{r}s  r�read_decimalnl_longr�sF���	�a��5�9�9�9�A�����v��~�~�
�c�r�c�F���q�6�6�Mr�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         c�F�	t|dd���}t|��S)NFrz)rH�floatr}s  r�read_floatnlr�-s(���
	�a��5�9�9�9�A���8�8�Or�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              c��	|�d��}t|��dkrtd|��dStd���)Nr8z>drz(not enough data in stream to read float8r*r#s  r�read_float8r�CsK���
�6�6�!�9�9�D�
�4�y�y�A�~�~��t�T�"�"�1�%�%�
�?�
@�
@�@r�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longc��	t|��}|�|��}t|��|krtd���t	|��S)Nz'not enough data in stream to read long1)r&r!r+r"r�rTs   r�
read_long1r�isO���	�1�
�
�A��6�6�!�9�9�D�
�4�y�y�A�~�~��B�C�C�C��t���r�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    c���	t|��}|dkrtd|z���|�|��}t|��|krtd���t	|��S)Nrzlong4 byte count < 0: %dz'not enough data in stream to read long4)r2r"r!r+r�rTs   r�
read_long4r��sl���	�!���A��1�u�u��3�a�7�8�8�8��6�6�!�9�9�D�
�4�y�y�A�~�~��B�C�C�C��t���r�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c��eZdZdZd�Zd�ZdS)�StackObject�r�obtyperc�d�||_t|t��r|D]}�||_||_dSr)r�
isinstance�tupler�r)rrr�r�	containeds     rrzStackObject.__init__�sB����	��f�e�$�$�	3�#�
3�
3�	�	��������rc��|jSr�r)rs r�__repr__zStackObject.__repr__�s
���y�rN)rrrrrr�rrrr�r��s9������
�I��������rr�r|zA Python integer object.r��int_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.r�zA Python float object.�bytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rfzA Python bytearray object.rjz!A Python (Unicode) string object.�NonezThe Python None object.r�zA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�bufferzA Python buffer-like object.�anyzAny kind of object whatsoever.�markaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c��eZdZdZd�ZdS)�
OpcodeInfo�r�code�arg�stack_before�stack_after�protorc�|�||_||_||_|D]}�||_|D]}�||_||_||_dSrr�)	rrr�r�r�r�r�r�xs	         rrzOpcodeInfo.__init__dsi����	���	�����	.�	.�A�A�(����	.�	.�A�A�&�����
�����rNrrrrr�r�Es*�������I�:����rr��INT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      r��BININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      �BININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      �BININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      �LONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      �LONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.�LONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      �	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      �SHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      �BINBYTES�B�z�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      �SHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      �	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      �
BYTEARRAY8�–�z�Push a Python bytearray object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the bytearray, and the second is that many bytes,
      which are taken literally as the bytearray content.
      �NEXT_BUFFER�—z"Push an out-of-band buffer object.�READONLY_BUFFER�˜z,Make an out-of-band buffer object read-only.�NONE�NzPush None on the stack.�NEWTRUE�ˆzPush True onto the stack.�NEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      �SHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      �
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      �BINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      �FLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      �BINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      �
EMPTY_LIST�]zPush an empty list.�APPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      �APPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      �LIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      �EMPTY_TUPLE�)zPush an empty tuple.�TUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      �TUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      �TUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      �TUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      �
EMPTY_DICT�}zPush an empty dict.�DICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      �SETITEMr~z�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      �SETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      �	EMPTY_SET�zPush an empty set.�ADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      �	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.�DUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      �POP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTrGz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      �EXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      �EXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      �EXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      �GLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      �STACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      �REDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      �BUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      �INST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      �OBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      �NEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      �	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      �STOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      �PERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      �	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFc	��t���}tjD]�}t	jd|��s|rt
d|z���,tt|��}t|t��rt|��dkr|rt
d|�d|�d�����|�d��}||vrL|rt
d|�d	|�d
���||}|j|krtd|�d|�d
|j�����||=��td|�d|�d����|r_dg}|���D]%\}}|�d|j�d|�����&td�|�����dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namer z	skipping z: value z  doesn't look like a pickle coderSzchecking name z	 w/ code z for consistencyzfor pickle code z, pickle.py uses name z but we're using name z4pickle.py appears to have a pickle opcode with name z
 and code z, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z	    name z with code �
)�code2op�copy�pickle�__all__�re�match�print�getattrr�r�r+rErr"�items�append�join)�verboser@r�
picklecoder��msgr�s       r�assure_pickle_consistencyrM�s����<�<�>�>�D���1�1���x�*�D�1�1�	��
Q��H�4�O�P�P�P���V�T�*�*�
��*�e�,�,�	��J���1�0D�0D��
5���!%���z�z�z�3�5�5�5���&�&�y�1�1�
������
)����d�d�J�J�J�(�)�)�)��Z� �A��v��~�~� �j�>H�j�j�>B�d�d�>?�f�f�"F�G�G�G��Z� � ��*�"�d�d�J�J�J�0�1�1�
1��)�N�O���z�z�|�|�	D�	D�G�D�!��J�J�J�Q�V�V�V�T�T�B�C�C�C�C�����3���(�(�(�	)�)rc#�K�t|t��rtj|��}t	|d��r|j}nd�}	|��}|�d��}t�|�	d����}|�/|dkrtd���td|�d	n|�d
|�d����|j�d}n|j�|��}|r||||��fV�n|||fV�|dkrdS��)
N�tellc��dSrrrrr�<lambda>z_genops.<locals>.<lambda>�s���rTr rSrz#pickle exhausted before seeing STOPzat position z	<unknown>z	, opcode z unknown�.)
r��bytes_types�io�BytesIO�hasattrrOr!r?�getrEr"r�r)r%�
yield_end_pos�getpos�posr��opcoder�s       r�_genopsr\�sE�����$��$�$� ��z�$�����t�V�������������f�h�h���y�y��|�|�����T�[�[��3�3�4�4���>��s�{�{� �!F�G�G�G� �j�03�����!D�!D�!%���"'�(�(�(��:���C�C��*�#�#�D�)�)�C��	#��#�s�F�F�H�H�,�,�,�,�,��#�s�"�"�"�"��4�<�<��E�+rc�"�	t|��Sr)r\)rAs rrr�s���,�6�?�?�rc�:�	d}d}t��}i}g}d}d}t|d���D�]\}}	}
}d|jvr-|�|	��|�||	f���>|jdkr<t|��}|�|��|�||f����d|jvr��d|jvr/|j|kr|j}d||	<|�||	f����|jd	kr2|	|kr|	}|
dkr||
|�}��|�|
|f����|�|
|f����~tj��}
|
�	|��tj|
|��}|d
kr|j�
��d}|D]�\}}	d}||ur%|	|vr�|�|��}|||	<|dz
}nG||ur|�||	��}n'|||	�}t|��|jjk}|j�|�
��|r|j�|����|�	|����|j���|
���S)NrrrrT)rXrr7r3r1Fr )�force)r�r\r�addrHr+r�rTrU�writerA�_Pickler�framer�
start_framing�putrW�_FRAME_SIZE_TARGET�commit_frame�
file_write�end_framing�getvalue)rrerW�oldids�newids�opcodesr��protoheaderr[r�rZ�end_pos�idx�out�pickler�op�	framelessr%s                  rrr	s���=�
�C�
�C�
�U�U�F�
�F��G�
�E��K�%,�Q�d�%C�%C�%C�+�+�!���S�'��F�K����J�J�s�O�O�O��N�N�C��:�&�&�&�&�
�[�I�
%�
%��f�+�+�C��J�J�s�O�O�O��N�N�C��:�&�&�&�&�
���
#�
#��
�f�k�
!�
!��|�e�#�#�����F�3�K��N�N�C��:�&�&�&�&�
�[�G�
#�
#��U�{�{����a�x�x���G��n�������W�~�.�.�.�.��N�N�C��>�*�*�*�*��
�*�,�,�C��I�I�k�����o�c�5�)�)�G���z�z���$�$�&�&�&�
�C�� � ���C��	�
��9�9��&� � ���;�;�s�#�#�D��F�3�K��1�H�C�C�
�3�Y�Y��;�;�v�c�{�+�+�D�D��R��V�9�D��D�	�	�G�N�$E�E�I���#�#�)�#�4�4�4��	 ��N�%�%�d�+�+�+�+��M�M�$������N��� � � ��<�<�>�>�rc�l�	g}|�i}d}g}d|z}d}	|}
t|��D�]�\}}}
|
�td|
zd|���t|j��dd�d�d|t	|��z�|j��}t
||j��}|j}|j	}t	|��}d}t|vs|jdkr�|r�|dtur�	|r�|���}|�d	}nd
|z}|dtur#|���|dtu�#|���	|�t��}n#t$rd}YnwxYwdx}	}|jd
vrO|jdkrt	|��}d|z}n|}||vrd|z}	n?|sd}	n:|dturd}	n(|d||<n|jdvr||vr
||g}nd|z}	|�|r>|ddt	|j��z
zz
}|�|dt|��zz
}|r|d|zz
}|rV|d|
t	|��z
zz
}t	|��}
|
dkr|}
|d|j�dd��dzz
}t||���|	rt|	���t	|��|kr!td|t	|��fz���|r||d�=t|vr|�|
��|�|�����td||���|rtd|z���dS)NrrOz%5d:)�end�filer �4rFz(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stack)rrrrrz(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memo)rrrz&memo key %r has never been stored into�
�2r>)rwz3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %r)rrE�reprr�r+r�maxr�r�r��
markobject�pop�indexr"r�splitrH�extend)rArq�memo�indentlevel�annotate�stack�maxproto�	markstack�indentchunk�errormsg�annocolr[r�rZ�line�before�after�numtopop�markmsg�markpos�memo_idxs                     rrr[	s(��&�X
�E��|����H��I���#�K��H��G�"�6�N�N�_�_����S��?��&�3�,�C�c�2�2�2�2�"�6�;�/�/��"��5�5�5�5�)�C�	�N�N�:�:�$�k�k�+���x���.�.���$���"���v�;�;��������F�K�5�$8�$8�$)�%9�$)�"�I��$;�$;�
4��
?�#�-�-�/�/���?�?�G�G�,�w�6�G��B�i�z�1�1��I�I�K�K�K��B�i�z�1�1��	�	����!�%�|�|�J�7�7�H�H��!�!�!�!� �H�H�H�!����&?�>��7��;�E�E�E��{�i�'�'��t�9�9��#�h�.������4���8�3�>����
+�D����r��j�(�(�?���!&�r���X���
�[�<�
<�
<��d�{�{��c�����C�c�I���?�g�?��C�2��F�K� 0� 0�0�1�1�D�����d�3�i�i��'���
&���g�
�%���	7��C�7�S��Y�Y�.�/�/�D��$�i�i�G���|�|�"���C�&�*�*�*�4��3�3�A�6�6�6�D�
�d�������	'��X�&�&�&��u�:�:�� � ��-�08�#�e�*�*�/E�F�G�G�
G��	"��x�i�j�j�!��������S�!�!�!�
���U�����	�
,�h�S�A�A�A�A��C��9�E�A�B�B�B�C�Cs�<E�E&�%E&c��eZdZd�ZdS)�_Examplec��||_dSr)�value)rr�s  rrz_Example.__init__�	s
����
�
�
rN)rrrrrrrr�r��	s#����������rr�a�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: I    INT        1
    8: a    APPEND
    9: I    INT        2
   12: a    APPEND
   13: (    MARK
   14: I        INT        3
   17: I        INT        4
   20: t        TUPLE      (MARK at 13)
   21: p    PUT        1
   24: a    APPEND
   25: (    MARK
   26: d        DICT       (MARK at 25)
   27: p    PUT        2
   30: c    GLOBAL     '_codecs encode'
   46: p    PUT        3
   49: (    MARK
   50: V        UNICODE    'abc'
   55: p        PUT        4
   58: V        UNICODE    'latin1'
   66: p        PUT        5
   69: t        TUPLE      (MARK at 49)
   70: p    PUT        6
   73: R    REDUCE
   74: p    PUT        7
   77: V    UNICODE    'def'
   82: p    PUT        8
   85: s    SETITEM
   86: a    APPEND
   87: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: I    INT        42
  110: s    SETITEM
  111: b    BUILD
  112: a    APPEND
  113: g    GET        5
  116: a    APPEND
  117: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)�disassembler_test�disassembler_memo_testc�2�ddl}|���S)Nr)�doctest�testmod)r�s r�_testr�s���N�N�N��?�?���r�__main__z$disassemble one or more pickle files)�description�pickle_file�br�*zthe pickle file)�type�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultr�r�z-mz--memo�
store_truez#preserve memo between disassemblies)�actionr�z-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)r�r�z-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�r�r>)TT)F)NNr1r)�rCrTrArCr^rBrS�
UP_TO_NEWLINE�TAKEN_FROM_ARGUMENT1�TAKEN_FROM_ARGUMENT4�TAKEN_FROM_ARGUMENT4U�TAKEN_FROM_ARGUMENT8U�objectr�structrr,r&r'r-r/r2r3r5r6r9r:rHrIrLrMrPrQrUrVrXrYr[r\r`rarcrdrgrhrkrlrprqrsrurwrxrr�r�r�r�r�r�r�r�r�r�r�r�r�r|�pyint�pylongr��pyinteger_or_bool�pyboolr��pyfloatr�rj�pybytes_or_str�pystring�pybytesrf�pybytearray�	pyunicoder��pynoner��pytupler��pylistr��pydictr��pyset�pyfrozenset�pybuffer�	anyobjectr}r�r�r�rm�name2i�code2i�	enumerater,r�rr"r�r?rMr\rrrr��	_dis_test�
_memo_test�__test__r�r�argparse�ArgumentParser�parser�add_argument�FileType�stdout�
parse_args�args�testr�r��
print_helpr+�outputr�r�r$�preamble�formatrarrr�<module>r�s��
��
�
�
�	�	�	�	�
�
�
�
�	�	�	�	�
�
�
�
�
'�
'�
'��� ��`�
���������"�"�"�"�"��"�"�"�H%�$�$�$�$�$�
@�
@�
@�	�����,�		.�	.�	.��@�@�@�	�����;�		=�	=�	=��?�?�?����
��I�	K�K�K��@�@�@�	�����<�		>�	>�	>��@�@�@�	�����=�		?�	?�	?��-�-�-�-�^����#��	����/�/�/�'�&�0�'�5��		�	�	��L�L�L�,�+�":�,�$?�"!�	"�"�"��%�%�%�"�
��$�!��		�	�	��%�%�%�,�
��$�!��		�	�	��%�%�%�"
�	��$� ��	
�
�
��%�%�%�.
�	��%� ��	
�
�
��%�%�%�0
�	��%� ��	
�
�
��%�%�%�0 �
��%�$��	���
�+�+�+�%�$�,�%�1��		�	�	��0�0�0�4$�#�)�*�.��	
�
�
��0�0�0�8$�#�)�+�.��	
�
�
��0�0�0�8$�#�)�+�.��	
�
�
�����,���"%�$�,�%�1��	����$�#�*�$�/��	��������
���!��	����
A�
A�
A� 
�	�����	
�
�
��(���������*	��	���	�				�			�			�����.	��	���	�			�		�		��(�����&����<��	��"�$�$�$�$���
 �K�	���;�-�/�/�/��

��	��"�
$�
$�
$��
�+�	�� �"�"�"��
(�K�	��3�<�4�6�6�6�6���
�+�	�� �"�"�"��
�k�	��$�&�&�&��

�K�	��+�
-�
-�
-�	�

��	��4��:�:�!�
#�
#�
#��
�+�	�� �"�"�"��

��	���
!�
!�
!��

��	���
!�
!�
!��
	��	���	 �	 �	 ��
�k�	��$�&�&�&��
�;�	��&�(�(�(��

�K�	��(�
*�
*�
*�	�
�[�	��		����
��[�	��
	����
�*9�9�9�9�9��9�9�9�v��Q��A�5��
��$�%�
�
�
���	Q�:�A�8��
���'�
�
�
���;Q�V�A�9��
���'�
�
�
�
�
�WQ�n�A�9��
���'�
�
�
���oQ�H�A�6��
���'�
�

�
���IQ�l�A�7��
���'�
��
	�	�	�mQ�B�A�7��
���'�
��
	�	�	�CQ�\�A�8��
��!�"�
�
�
���]Q�|�A�;��
��!�"�
�	
�
���}Q�^�A���
��!�"�
�	
�
���_Q�D�A�:��
���)�
�
�
���EQ�^�A���
���)�
�
�
���_Q�x�A�;��
���)�
�
�
���yQ�V�A�<��
���-�
�
�
���WQ�t�A�=��
���*�
�
.�
0�0�0�uQ�D�A���
��:��*�
�
8�
:�:�:�EQ�X�A�6��
���(�
�
#�
%�%�%�YQ�n�A�9��
���(�
�
%�
'�'�'�oQ�~�A�:��
���(�
�
&�
(�(�(�Q�R�A�9��
���+�
�
�
���SQ�l�A���
���+�
�
�
���mQ�F	�A�<��
���+�
�
�
���G	Q�`	�A�=��
���+�
�
�
���a	Q�~	�A�7��
���)�
�
�
���	Q�f
�A�:��
���)�
�
�
���g
Q�J�A�<��
���(�
�
�
!�!�!�KQ�Z�A�8��
��I�&��(�
�
�
���[Q�v�A�9��
��J�
�3��(�
�
�
���wQ�R�A�6��
��
�+��(�
�
�
���SQ�v�A�=��
���)�
�
 �
"�"�"�wQ�F
�A�7��
��
�+��)�
�
�
���G
Q�f
�A�8��
��;��)�
�
�

�
�
�g
Q�D�A�8��
��y�)��)�
�
�

�
�
�EQ�b�A�8��
��y�)�4��)�
�
�

�
�
�cQ�D�A�<��
���(�
�
�
!�!�!�EQ�T�A�6��
��
�+��(�
�	
�
���UQ�v�A�9��
��I�y�1��(�
�
�
���wQ�R�A�:��
��J�
�3��(�
�

�
���SQ�@�A�;��
���'�
�
�
 � � �AQ�P�A�:��
��:�z�2��'�
�
�
���QQ�|�A�;��
��
�+��-�
�
�
���}Q�`�A�5��
��;��
�
H�
J�J�J�aQ�p�A�5��
��;��i�(�
�
I�
K�K�K�qQ�@�A�6��
���,�
�
�
���AQ�Z�A�:��
��
�+��
�
�
���[Q�z�A�5��
���+�
�
�
���{Q�T�A�8��
���+�
�
�
�
�
�UQ�l�A�=��
���+�
�
�
�
�
�mQ�D�A�5��
���
�
�
���EQ�^�A�8��
���
�
�
�
�
�_Q�v�A�=��
���
�
�
�
�
�wQ�N�A�9��
��;��+�
�
�
�
�
�OQ�l�A�6��
���+�
�
�
���mQ�X�A�6��
���+�
�
�
	�	�	�YQ�n�A�6��
���+�
�
�
	�	�	�oQ�J�A�8��
 ���+�
�
�

�
�
�KQ�h�A�>��
��y�)��+�
�
�
���iQ�D�A�8��
��y�)��+�
�
�
���EQ�~�A�7��
��y�)��+�
�
�
���Q�p�A�6��
 ��
�+��+�
�*
�
0�0�0�qQ�T�A�5��
��	�:�6��+�
�
�
���UQ�T�A�8��
��y�)��+�
�
�

�
�
�UQ�r�A�;��
��y�)�4��+�
�
�

�
�
�sQ�T�A�7��
���
�
�
�
�
�UQ�l�A�6��
��;��
�
�
���mQ�J�A�7��
���
�
�
�
�
�KQ�f�A�8��
���+�
�	
�
���gQ�H �A�;��
��;��+�
�
�
���I Q��d �
��	���I�g���	�	�D�A�q��v�����j�@��&�&���.�!�4�5�6�6�	6��v�����j�@��&�&���.�!�4�5�6�6�	6��F�1�6�N��F�1�6�N�N�
�F�A�q�
��	���A��G�A�F�O�O��$)�$)�$)�$)�L������
����@���8>�>�>�FXC�XC�XC�XC�v��������}
�	�~�
�:"+�&0�
�
������z����O�O�O�
$�X�
$�:�<�<�<�F�
����-�H�-�d�3�3��)��+�+�+�����j�#�*�3D�8�3D�S�3I�3I�
:��<�<�<�����h�|�
2��4�4�4�����o�q�s�
G��I�I�I�����l�L�
A��C�C�C�����l�$4����������h�|�
"��$�$�$�����\�
8��:�:�:������D��y�F�
���������-�2�2�A����
	F���������
�S��!�
"�
"�a�
'�
'��C�� ��#�T�[�$�� �(�
,�
,�
,�
,�
,���,�2�2��D��%�
F�
F���=�/�/�Q�V�/�<�<����!�!�(�T�/�2�2�2���A�t�{�D�$�*:�H�E�E�E�E�Y��R
F�
Fr

ZeroDay Forums Mini