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`.
This commit is contained in:
kennytm 2017-10-10 00:16:24 +08:00
commit 743ff73e20
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C

View file

@ -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: