Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6628 - JSONDecodeError are not deserializable #6629

Merged

Commits on Jan 31, 2024

  1. Fix psf#6628 - JSONDecodeError are not deserializable

    requests.exceptions.JSONDecodeError are not deserializable: calling
    `pickle.dumps` followed by `pickle.loads` will trigger an error.
    
    This is particularly a problem in a process pool, as an attempt to
    decode json on an invalid json document will result in the entire
    process pool crashing.
    
    This is due to the MRO of the `requests.exceptions.JSONDecodeError`
    class: the `__reduce__` method called when pickling an instance is not
    the one from the JSON library parent: two out of three args expected
    for instantiation will be dropped, and the instance can't be
    deserialised.
    
    By specifying in the class which parent `__reduce__` method should be
    called, the bug is fixed as all args are carried over in the resulting
    pickled bytes.
    Tarty committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    3ff3ff2 View commit details
    Browse the repository at this point in the history