]>
Commit | Line | Data |
---|---|---|
0c61ae25 AM |
1 | # HG changeset patch |
2 | # User Georg Brandl <georg@python.org> | |
3 | # Date 1413746745 -7200 | |
4 | # Node ID 2d66ade078e490968b21022918b2074389b77dd0 | |
5 | # Parent 1e2406af4606eb1f03fd48262114938922e949b8 | |
6 | Guard against sys.exit() called while exec()ing the conf.py file. | |
7 | ||
8 | diff --git a/sphinx/config.py b/sphinx/config.py | |
9 | --- a/sphinx/config.py | |
10 | +++ b/sphinx/config.py | |
11 | @@ -24,6 +24,9 @@ | |
12 | CONFIG_SYNTAX_ERROR = "There is a syntax error in your configuration file: %s" | |
13 | if PY3: | |
14 | CONFIG_SYNTAX_ERROR += "\nDid you change the syntax from 2.x to 3.x?" | |
15 | +CONFIG_EXIT_ERROR = "The configuration file (or one of the modules it imports) " \ | |
16 | + "called sys.exit()" | |
17 | + | |
18 | ||
19 | class Config(object): | |
20 | """ | |
21 | @@ -232,6 +232,8 @@ class Config(object): | |
22 | execfile_(filename, config) | |
23 | except SyntaxError, err: | |
24 | raise ConfigError(CONFIG_SYNTAX_ERROR % err) | |
25 | + except SystemExit: | |
26 | + raise ConfigError(CONFIG_EXIT_ERROR) | |
27 | finally: | |
28 | os.chdir(olddir) | |
29 | ||
30 |