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

HTTPSConnectionWithTimeout.connect crashes on Python 3 with debuglevel > 0 #161

Closed
cjwatson opened this issue Apr 10, 2020 · 1 comment
Closed

Comments

@cjwatson
Copy link
Contributor

@cjwatson cjwatson commented Apr 10, 2020

The following crashes on a host with no IPv6 connectivity:

Python 3.8.2 (default, Mar 13 2020, 10:14:16)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib2
>>> httplib2.debuglevel = 1
>>> h = httplib2.Http()
>>> h.request("https://api.launchpad.net/")
Traceback (most recent call last):
  File "/home/cjwatson/src/python/httplib2/python3/httplib2/__init__.py", line 1324, in connect
    sock.connect((self.host, self.port))
OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cjwatson/src/python/httplib2/python3/httplib2/__init__.py", line 1982, in request
    (response, content) = self._request(
  File "/home/cjwatson/src/python/httplib2/python3/httplib2/__init__.py", line 1650, in _request
    (response, content) = self._conn_request(
  File "/home/cjwatson/src/python/httplib2/python3/httplib2/__init__.py", line 1557, in _conn_request
    conn.connect()
  File "/home/cjwatson/src/python/httplib2/python3/httplib2/__init__.py", line 1369, in connect
    print("connect fail: ({0}, {1})".format((self.host, self.port)))
IndexError: Replacement index 1 out of range for positional args tuple

This is because there's one more layer of parentheses in that str.format call than there should be. The Python 2 version doesn't have the same bug.

@temoto
Copy link
Member

@temoto temoto commented Apr 11, 2020

Released 0.17.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants