Make sure exception is pickleable.
(exc)
| 159 | |
| 160 | |
| 161 | def get_pickleable_exception(exc): |
| 162 | """Make sure exception is pickleable.""" |
| 163 | try: |
| 164 | pickle.loads(pickle.dumps(exc)) |
| 165 | except Exception: # pylint: disable=broad-except |
| 166 | pass |
| 167 | else: |
| 168 | return exc |
| 169 | nearest = find_pickleable_exception(exc) |
| 170 | if nearest: |
| 171 | return nearest |
| 172 | return UnpickleableExceptionWrapper.from_exception(exc) |
| 173 | |
| 174 | |
| 175 | def get_pickleable_etype(cls, loads=pickle.loads, dumps=pickle.dumps): |
no test coverage detected