summaryrefslogtreecommitdiff
path: root/sphinx/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/config.py')
-rw-r--r--sphinx/config.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/config.py b/sphinx/config.py
index 2012634e1..c020992b5 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -16,7 +16,7 @@ from os import path
from sphinx.errors import ConfigError
from sphinx.locale import l_
-from sphinx.util.osutil import make_filename
+from sphinx.util.osutil import make_filename, fs_encoding
from sphinx.util.pycompat import bytes, b, convert_with_2to3
nonascii_re = re.compile(b(r'[\x80-\xff]'))
@@ -208,14 +208,15 @@ class Config(object):
f.close()
try:
# compile to a code object, handle syntax errors
+ config_file_enc = config_file.encode(fs_encoding)
try:
- code = compile(source, config_file, 'exec')
+ code = compile(source, config_file_enc, 'exec')
except SyntaxError:
if convert_with_2to3:
# maybe the file uses 2.x syntax; try to refactor to
# 3.x syntax using 2to3
source = convert_with_2to3(config_file)
- code = compile(source, config_file, 'exec')
+ code = compile(source, config_file_enc, 'exec')
else:
raise
exec code in config