Skip to content

Conversation

mattoberle
Copy link
Contributor

The 2.18.0 version of requests breaks compatibility with docker-py:
psf/requests#4160

This block of code from urllib3 fails:

    def _get_timeout(self, timeout):
        """ Helper that always returns a :class:`urllib3.util.Timeout` """
        if timeout is _Default:
            return self.timeout.clone()

        if isinstance(timeout, Timeout):
            return timeout.clone()
        else:
            # User passed us an int/float. This is for backwards compatibility,
            # can be removed later
            return Timeout.from_float(timeout)

In the case of requests version 2.18.0:
timeout was an instance of urllib3.util.timeout.Timeout
Timeout was an instance of requests.packages.urllib3.util.timeout.Timeout

When the isinstance(timeout, Timeout) check fails the urllib3.util.timeout.Timeout object is passed as the connection argument to requests.packages.urllib3.util.timeout.Timeout.from_float.

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "patch-1" git@github.com:mattoberle/docker-py.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

The 2.18.0 version of requests breaks compatibility with docker-py:
psf/requests#4160

[This block](https://github.com/shazow/urllib3/blob/master/urllib3/connectionpool.py#L292) of code from urllib3 fails:
```python
    def _get_timeout(self, timeout):
        """ Helper that always returns a :class:`urllib3.util.Timeout` """
        if timeout is _Default:
            return self.timeout.clone()

        if isinstance(timeout, Timeout):
            return timeout.clone()
        else:
            # User passed us an int/float. This is for backwards compatibility,
            # can be removed later
            return Timeout.from_float(timeout)
```

In the case of requests version 2.18.0:
`timeout` was an instance of `urllib3.util.timeout.Timeout`
`Timeout` was an instance of `requests.packages.urllib3.util.timeout.Timeout`

When the `isinstance(timeout, Timeout)` check fails the `urllib3.util.timeout.Timeout` object is passed as the `connection` argument to `requests.packages.urllib3.util.timeout.Timeout.from_float`.

Signed-off-by: Matt Oberle <matt.r.oberle@gmail.com>
@shin-
Copy link
Contributor

shin- commented Jun 14, 2017

LGTM, thank you!

@shin- shin- merged commit be0a15a into docker:master Jun 14, 2017
@mattoberle mattoberle deleted the patch-1 branch June 14, 2017 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants