Ejemplo n.º 1
0
def _replace_interattr(source, rel, new):
    if isinstance(source, CellType):
        api.PyCell_Set(ctypes.py_object(source), ctypes.py_object(new))
        return
    if rel == "ob_type":
        source.__class__ = new
        return
    print "Unknown R_INTERATTR:", rel, type(source)
Ejemplo n.º 2
0
def _fill_function(func, globals, defaults, closure, dict):
    """ Fills in the rest of function data into the skeleton function object
      that were created via _make_skel_func(), including closures.
  """
    result = cloudpickle._fill_function(func, globals, defaults, dict)
    if pythonapi is not None:
        for i, v in enumerate(closure):
            pythonapi.PyCell_Set(c_void_p(id(result.__closure__[i])),
                                 c_void_p(id(v)))
    return result