Revert "Fix NUL byte error handling on Python 3.4"

This reverts commit a7d5a98cc4.
Not needed anymore now that we dropped support.
This commit is contained in:
Florian Bruhin 2017-09-22 22:30:02 +02:00
parent e8ceeceac8
commit b8389e4496
2 changed files with 2 additions and 2 deletions

View File

@ -251,7 +251,7 @@ def read_config_py(filename=None, raising=False):
try:
code = compile(source, filename, 'exec')
except (ValueError, TypeError) as e:
except ValueError as e:
# source contains NUL bytes
desc = configexc.ConfigErrorDesc("Error while compiling", e)
raise configexc.ConfigFileErrors(basename, [desc])

View File

@ -409,7 +409,7 @@ class TestConfigPy:
assert len(excinfo.value.errors) == 1
error = excinfo.value.errors[0]
assert isinstance(error.exception, (TypeError, ValueError))
assert isinstance(error.exception, ValueError)
assert error.text == "Error while compiling"
exception_text = 'source code string cannot contain null bytes'
assert str(error.exception) == exception_text