Fixed #21420 -- Autoreloader on BSD with Python 3.
Thanks Bouke Haarsma for the report.
This commit is contained in:
parent
6010b5360f
commit
dbbd10e75f
|
@ -37,6 +37,7 @@ import traceback
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.signals import request_finished
|
from django.core.signals import request_finished
|
||||||
|
from django.utils import six
|
||||||
try:
|
try:
|
||||||
from django.utils.six.moves import _thread as thread
|
from django.utils.six.moves import _thread as thread
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -170,7 +171,8 @@ def kqueue_code_changed():
|
||||||
|
|
||||||
# New modules may get imported when a request is processed. We add a file
|
# 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.
|
# 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)
|
kqueue.control([make_kevent(watcher)], 0)
|
||||||
|
|
||||||
def update_watch(sender=None, **kwargs):
|
def update_watch(sender=None, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue