Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently exceptions created by botocore fail when sent through
pickle.loads(pickle.dumps(err))
.pickle
is a module commonly used for serialization of python objects sent between runs or processes. One notable usage example is inmultiprocessing
module which in turn is used in Django's parallel test suite.Any user who currently performs boto3 operations inside Django's test runner risks that his test suite blows up without running appropriate teardown operations. I've filed a separate fix for Django in django/django#7325.
These commits fix picklability of botocore exception classes. The culprit seemed to be calling parent
Exception.__init__
for defining exception's string representation instead of implementing our own more specialized__str__
method.One unrelated thing that surprised me while going through the code is that
ClientError
does not inheritBotoCoreError
. I was 100% expecting to be able to catch all AWS-related errors with a single error class, but it seems that I would have to write something like this instead:Is the reason for this to shift blame between AWS/Client? If so I think there would be a room here for another error class that would be parent for both of these.