Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously we checked that the `request` being sent was an instance of a PreparedRequest. If a user somehow created a PreparedRequest using a different Requests library instance, this check makes the request un-sendable. (This happened recently - unbeknownst to me, my server was running an outdated version of pip, vulnerable to this issue - pypa/pip#1489, which creates multiple subdirectories (src/requests, src/requests/requests) when you rerun pip install --target. So the PreparedRequest was being created in one version of the library and compared against the other version of the library, and throwing this exception, even though they were both PreparedRequest instances!) It would probably be preferable to check the object's behavior (instead of its type), but a PreparedRequest has a lot of behavior, and it wouldn't be really feasible or allow us to provide a helpful error message to check all of it here. Instead flip the conditional to guard against the user sending an unprepared Request, which should still give us most of the benefits of the better error message. Fixes psf#3102
- Loading branch information