We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a63e5e3 commit e76bd8aCopy full SHA for e76bd8a
aiohttp/web_fileresponse.py
@@ -337,8 +337,11 @@ async def prepare(
337
self.headers[hdrs.CONTENT_RANGE] = 'bytes {0}-{1}/{2}'.format(
338
real_start, real_start + count - 1, file_size)
339
340
- with (await loop.run_in_executor(None, filepath.open, 'rb')) as fobj:
341
- if start: # be aware that start could be None or int=0 here.
342
- await loop.run_in_executor(None, fobj.seek, start)
+ fobj = await loop.run_in_executor(None, filepath.open, 'rb')
+ if start: # be aware that start could be None or int=0 here.
+ await loop.run_in_executor(None, fobj.seek, start)
343
344
+ try:
345
return await self._sendfile(request, fobj, count)
346
+ finally:
347
+ await loop.run_in_executor(None, fobj.close)
0 commit comments