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

sock_connect: TypeError: getaddrinfo() takes exactly 2 positional arguments (4 given) #99

Closed
cbay opened this issue Jul 10, 2017 · 4 comments

Comments

@cbay
Copy link

cbay commented Jul 10, 2017

  • uvloop version: 0.8.0
  • Python version: 3.6.0
  • Platform: Linux
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

The following program fails when executed with uvloop (works fine with asyncio):

import asyncio
import socket
import uvloop

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.get_event_loop()
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
sock.setblocking(False)
loop.run_until_complete(loop.sock_connect(sock, ('::1', 22, 0, 0)))
loop.close()
Traceback (most recent call last):
  File "tmp.py", line 9, in <module>
    loop.run_until_complete(loop.sock_connect(sock, ('::1', 22, 0, 0)))
  File "uvloop/loop.pyx", line 1203, in uvloop.loop.Loop.run_until_complete (uvloop/loop.c:25632)
  File "uvloop/loop.pyx", line 2042, in sock_connect (uvloop/loop.c:37250)
  File "uvloop/loop.pyx", line 1205, in uvloop.loop.Loop.getaddrinfo (uvloop/loop.c:25752)
TypeError: getaddrinfo() takes exactly 2 positional arguments (4 given)
@1st1
Copy link
Member

1st1 commented Nov 13, 2017

It works in asyncio by pure accident: https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L163

Please fix your program, as asyncio will raise the same error in Python 3.7.

@1st1 1st1 closed this as completed Nov 13, 2017
@1st1 1st1 reopened this Nov 13, 2017
@1st1
Copy link
Member

1st1 commented Nov 13, 2017

My mistake. After some testing with IPv6 connections I confirm this is a bug in uvloop.

@1st1
Copy link
Member

1st1 commented Nov 13, 2017

Fixed. Will be shipped in uvloop 0.9.0 soon.

@1st1 1st1 closed this as completed Nov 13, 2017
@1st1
Copy link
Member

1st1 commented Nov 27, 2017

Please try uvloop v0.9.0.

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

No branches or pull requests

2 participants