Make the given obj un-picklable. obj should be either a dictionary, or an Enum
(obj)
| 97 | return num == 0 |
| 98 | |
| 99 | def _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 | |
| 114 | def _iter_bits_lsb(num): |
| 115 | # num must be a positive integer |
no test coverage detected