Skip to content

Commit

Permalink
Fix fdopen RuntimeWarning in 3.8 (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
junnplus authored and benoitc committed Oct 30, 2019
1 parent 3fcb551 commit 21d6287
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gunicorn/workers/workertmp.py
Expand Up @@ -32,7 +32,9 @@ def __init__(self, cfg):
try:
if not IS_CYGWIN:
util.unlink(name)
self._tmp = os.fdopen(fd, 'w+b', 1)
# In Python 3.8, open() emits RuntimeWarning if buffering=1 for binary mode.
# Because we never write to this file, pass 0 to switch buffering off.
self._tmp = os.fdopen(fd, 'w+b', 0)
except:
os.close(fd)
raise
Expand Down

0 comments on commit 21d6287

Please sign in to comment.