diff options
| author | Mark Rogaski <mrogaski@pobox.com> | 2017-08-28 12:40:27 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-08-31 07:33:01 -0400 |
| commit | 80a0016c49331bf0a14ef76e714acbff6c6640bd (patch) | |
| tree | 3bb54b3aada8e44f5e13874c100b22a4ebac4158 /django | |
| parent | 046b8c80ce76ed1d410910aa92f67c405b8a15ba (diff) | |
[1.11.x] Fixed #28487 -- Fixed runserver crash with non-Unicode system encodings on Python 2 + Windows.
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/autoreload.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index cf2cefeea9..7a9702aebb 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -40,7 +40,7 @@ from django.conf import settings from django.core.signals import request_finished from django.utils import six from django.utils._os import npath -from django.utils.encoding import force_bytes, get_system_encoding +from django.utils.encoding import get_system_encoding from django.utils.six.moves import _thread as thread # This import does nothing, but it's necessary to avoid some race conditions @@ -290,8 +290,8 @@ def restart_with_reloader(): # Environment variables on Python 2 + Windows must be str. encoding = get_system_encoding() for key in new_environ.keys(): - str_key = force_bytes(key, encoding=encoding) - str_value = force_bytes(new_environ[key], encoding=encoding) + str_key = key.decode(encoding).encode('utf-8') + str_value = new_environ[key].decode(encoding).encode('utf-8') del new_environ[key] new_environ[str_key] = str_value new_environ["RUN_MAIN"] = 'true' |
