B
    U²È[  ã               @   st   d Z ddlZe de¡ ddlZddlZyddlZW n ek
rP   ddlZY nX dd„ Z	dd„ Z
e eje
¡ dS )a›  Utilities to enable code objects to be pickled.

Any process that import this module will be able to pickle code objects.  This
includes the func_code attribute of any function.  Once unpickled, new
functions can be built using new.function(code, globals()).  Eventually
we need to automate all of this so that functions themselves can be pickled.

Reference: A. Tremols, P Cogolo, "Python Cookbook," p 302-305
é    Nz]ipykernel.codeutil is deprecated since IPykernel 4.3.1. It has moved to ipyparallel.serializec              G   s
   t j| Ž S )N)ÚtypesÚCodeType)Úargs© r   ú1lib/python3.7/site-packages/ipykernel/codeutil.pyÚ	code_ctor   s    r   c             C   sd   | j | j| j| j| j| j| j| j| j| j	| j
| j| j| jg}tjd dkrX| d| j¡ tt|ƒfS )Nr   é   é   )Úco_argcountÚ
co_nlocalsÚco_stacksizeÚco_flagsÚco_codeÚ	co_constsÚco_namesÚco_varnamesÚco_filenameÚco_nameÚco_firstlinenoÚ	co_lnotabÚco_freevarsÚco_cellvarsÚsysÚversion_infoÚinsertÚco_kwonlyargcountr   Útuple)Úcor   r   r   r   Úreduce_code   s    r   )Ú__doc__ÚwarningsÚwarnÚDeprecationWarningr   r   ÚcopyregÚImportErrorZcopy_regr   r   Úpickler   r   r   r   r   Ú<module>   s   	