MCPcopy Index your code
hub / github.com/RustPython/RustPython / _make_class_unpicklable

Function _make_class_unpicklable

Lib/enum.py:99–112  ·  view source on GitHub ↗

Make the given obj un-picklable. obj should be either a dictionary, or an Enum

(obj)

Source from the content-addressed store, hash-verified

97 return num == 0
98
99def _make_class_unpicklable(obj):
100 """
101 Make the given obj un-picklable.
102
103 obj should be either a dictionary, or an Enum
104 """
105 def _break_on_call_reduce(self, proto):
106 raise TypeError('%r cannot be pickled' % self)
107 if isinstance(obj, dict):
108 obj['__reduce_ex__'] = _break_on_call_reduce
109 obj['__module__'] = '<unknown>'
110 else:
111 setattr(obj, '__reduce_ex__', _break_on_call_reduce)
112 setattr(obj, '__module__', '<unknown>')
113
114def _iter_bits_lsb(num):
115 # num must be a positive integer

Callers 1

_create_Method · 0.85

Calls 2

isinstanceFunction · 0.85
setattrFunction · 0.85

Tested by

no test coverage detected