encode / apistar

The Web API toolkit. 🛠
https://docs.apistar.com
BSD 3-Clause "New" or "Revised" License
5.57k stars 411 forks source link

Fix resource leak on ASyncStaticFiles #588

Closed danigosa closed 6 years ago

danigosa commented 6 years ago

Leak occurs when printing docs, but it would likely arise when using ASyncStaticFiles generally, just run async server with PYTHONASYNCIODEBUG=1 and warnings will start to show up.

Warning:

/usr/local/lib/python3.6/asyncio/coroutines.py:110: ResourceWarning: unclosed file
        <_io.BufferedReader 
          name='/usr/local/lib/python3.6/site-packages/apistar/static/fonts/fontawesome-webfont.woff'>
       return self.gen.send(None)
tomchristie commented 6 years ago

Thanks!