qstokkink / TriblerExperimental

GNU General Public License v3.0
6 stars 2 forks source link

transport_received() takes 2 positional arguments but 3 were given #48

Closed qstokkink closed 4 months ago

qstokkink commented 4 months ago

After the type refactorings the following error gets logged:

Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Python310\lib\asyncio\proactor_events.py", line 585, in _loop_reading
    self._protocol.datagram_received(data, addr)
  File "C:\TriblerExperimental\src\tribler\core\socks5\client.py", line 61, in datagram_received
    self.callback(request.data, request.destination)
TypeError: UdpSocketManager.transport_received() takes 2 positional arguments but 3 were given
qstokkink commented 4 months ago

https://github.com/qstokkink/TriblerExperimental/blob/f80223fd4006b8305b893a3536a00fd54cd9b8ed/src/tribler/core/torrent_checker/torrentchecker_session.py#L237

This should be self.datagram_received instead of self.transport_received.

qstokkink commented 4 months ago

PyCharm does seem to detect this violation correctly:

screenshot

This must be a MyPy bug/shortcoming.