diff options
| author | kennytm <kennytm@gmail.com> | 2017-10-10 00:16:24 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-10-10 00:27:22 +0800 |
| commit | 743ff73e20848dc769ebface2b3164c33ded5bae (patch) | |
| tree | 71fb3d1c6386db615f7158f63dffb643e6df9c46 | |
| parent | 4c992111a3dee7eccdf789d730c26746b7d9b4ba (diff) | |
| parent | dee517a286de6387ad75291f3f8068ada99f2a92 (diff) | |
| download | rust-743ff73e20848dc769ebface2b3164c33ded5bae.tar.gz rust-743ff73e20848dc769ebface2b3164c33ded5bae.zip | |
Rollup merge of #45117 - johnthagen:fix-str-raise, r=alexcrichton
Fix raising a bare str as an exception in configure.py Raising a bare `str` has been [deprecated since Python 2.5](https://docs.python.org/2/whatsnew/2.5.html#pep-352-exceptions-as-new-style-classes). On Python 2.7 it produces the following error: ``` TypeError: exceptions must be old-style classes or derived from BaseException, not str ``` For maximum compatibility with Python 2.7 and 3.x, we wrap the error message in `RuntimeError` which derives from `Exception`.
| -rwxr-xr-x | src/bootstrap/configure.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 67337bf4421..176e9435528 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -360,7 +360,7 @@ def to_toml(value): elif isinstance(value, str): return "'" + value + "'" else: - raise 'no toml' + raise RuntimeError('no toml') def configure_section(lines, config): for key in config: |
