[Python-modules-team] Bug#870888: breaks awscli 1.11.121-1

Nicolás Alvarez nicolas.alvarez at gmail.com
Sat Aug 26 06:33:03 UTC 2017


This might be a botocore bug.

botocore/awsrequest.py has this code:

class AWSHTTPConnection(HTTPConnection):
    def __init__(self, *args, **kwargs):
        HTTPConnection.__init__(self, *args, **kwargs)
        # [snip]

    # [snip more overridden methods...]

class AWSHTTPSConnection(VerifiedHTTPSConnection):
    pass

# Now we need to set the methods we overrode from AWSHTTPConnection
# onto AWSHTTPSConnection.  This is just a shortcut to avoid
# copy/pasting the same code into AWSHTTPSConnection.
for name, function in AWSHTTPConnection.__dict__.items():
    if inspect.isfunction(function):
        setattr(AWSHTTPSConnection, name, function)

This seems incorrect, because AWSHTTPSConnection will get an __init__
method that calls HTTPConnection.__init__ instead of
VerifiedHTTPSConnection.__init__, and the latter is where ssl_context
gets set.

But if that botocore code is indeed wrong, then comes the question of
why this ever worked before, and why the change in requests made it
fail.

-- 
Nicolás



More information about the Python-modules-team mailing list