ebea5c41110303523045f46a0f08bd03101b51d5,python/ray/cloudpickle/cloudpickle_fast.py,,_class_getstate,#Any#,144

Before Change


    if "_abc_impl" in clsdict:
        (registry, _, _, _) = abc._get_dump(obj)
        clsdict["_abc_impl"] = [subclass_weakref()
                                for subclass_weakref in registry]
    if hasattr(obj, "__slots__"):
        // pickle string length optimization: member descriptors of obj are
        // created automatically from obj"s __slots__ attribute, no need to

After Change


    clsdict = _extract_class_dict(obj)
    clsdict.pop("__weakref__", None)

    if issubclass(type(obj), abc.ABCMeta):
        // If obj is an instance of an ABCMeta subclass, dont pickle the
        // cache/negative caches populated during isinstance/issubclass
        // checks, but pickle the list of registered subclasses of obj.
        clsdict.pop("_abc_cache", None)
        clsdict.pop("_abc_negative_cache", None)
        clsdict.pop("_abc_negative_cache_version", None)
        clsdict.pop("_abc_impl", None)
        registry = clsdict.pop("_abc_registry", None)
        if registry is None:
            // in Python3.7+, the abc caches and registered subclasses of a
            // class are bundled into the single _abc_impl attribute
            if hasattr(abc, "_get_dump"):
                (registry, _, _, _) = abc._get_dump(obj)
                clsdict["_abc_impl"] = [subclass_weakref()
                                        for subclass_weakref in registry]
            else:
                // FIXME(suquark): The upstream cloudpickle cannot work in Ray
                // because sometimes both "_abc_registry" and "_get_dump" does
                // not exist. Some strange typing objects may cause this issue.
                // Here the workaround just set "_abc_impl" to None.
                clsdict["_abc_impl"] = None
        else:
            // In the above if clause, registry is a set of weakrefs -- in
            // this case, registry is a WeakSet
            clsdict["_abc_impl"] = [type_ for type_ in registry]

    if "__slots__" in clsdict:
        // pickle string length optimization: member descriptors of obj are
        // created automatically from obj"s __slots__ attribute, no need to
        // save them in obj"s state
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: ray-project/ray
Commit Name: ebea5c41110303523045f46a0f08bd03101b51d5
Time: 2020-05-29
Author: suquark@gmail.com
File Name: python/ray/cloudpickle/cloudpickle_fast.py
Class Name:
Method Name: _class_getstate


Project Name: tryolabs/luminoth
Commit Name: 8a600f790ba68880e9a76a5eda33a3f4fccd22c4
Time: 2017-11-17
Author: javirey@gmail.com
File Name: luminoth/utils/config.py
Class Name:
Method Name: to_dict


Project Name: keras-team/keras
Commit Name: cc0e60c1012b7c72eeb5ea0c41b8a2045177ae5e
Time: 2016-07-19
Author: francois.chollet@gmail.com
File Name: keras/backend/tensorflow_backend.py
Class Name: Function
Method Name: __init__