theelous3 / asks

Async requests-like httplib for python.
MIT License
508 stars 63 forks source link

AttributeError in StreamBody context manager #77

Closed tilboerner closed 6 years ago

tilboerner commented 6 years ago

StreamBody.__aenter__ tries to access self.session._checked_out_sockets, which doesn't exist. As far as I can tell, this is the only occurrence of _checked_out_sockets in the whole project.

Running this minimal example:

$ cat | python
import asks, trio

async def main():
    r = await asks.get('https://google.com/', stream=True)
    async with r.body:
        pass

asks.init('trio')
trio.run(main)

results in:

Traceback (most recent call last):
  File "<stdin>", line 10, in <module>

[trio and other third party calls]

  File "<stdin>", line 6, in main
  File ".../lib/python3.6/site-packages/asks/response_objects.py", line 182, in __aenter__
    self.session._checked_out_sockets.remove(self.sock)
AttributeError: 'Session' object has no attribute '_checked_out_sockets'
theelous3 commented 6 years ago

ah shit, ty

theelous3 commented 6 years ago

fixed, pypi'd