summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-11-11 10:46:24 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-11-11 10:46:24 +0100
commitdbbd10e75f2f078909d231b2fd5ca1a351726faa (patch)
treeadebc9d4306af52ee29be057633a1cc3bc1bc4d2 /django/utils
parent6010b5360f9cb228c19e1d1f85e1b63a11ec6d35 (diff)
Fixed #21420 -- Autoreloader on BSD with Python 3.
Thanks Bouke Haarsma for the report.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/autoreload.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 97522b9018..2325d0df80 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -37,6 +37,7 @@ import traceback
from django.conf import settings
from django.core.signals import request_finished
+from django.utils import six
try:
from django.utils.six.moves import _thread as thread
except ImportError:
@@ -170,7 +171,8 @@ def kqueue_code_changed():
# New modules may get imported when a request is processed. We add a file
# descriptor to the kqueue to exit the kqueue.control after each request.
- watcher = tempfile.TemporaryFile(bufsize=0)
+ buf_kwargs = {'buffering' if six.PY3 else 'bufsize': 0}
+ watcher = tempfile.TemporaryFile(**buf_kwargs)
kqueue.control([make_kevent(watcher)], 0)
def update_watch(sender=None, **kwargs):