Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix raising a bare str as an exception in configure.py #45117

Merged
merged 1 commit into from
Oct 10, 2017
Merged

Fix raising a bare str as an exception in configure.py #45117

merged 1 commit into from
Oct 10, 2017

Conversation

johnthagen
Copy link
Contributor

@johnthagen johnthagen commented Oct 8, 2017

Raising a bare str has been deprecated since Python 2.5.

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.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

@bors: r+ rollup

Thanks!

@bors
Copy link
Contributor

bors commented Oct 9, 2017

📌 Commit dee517a has been approved by alexcrichton

@carols10cents carols10cents added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 9, 2017
kennytm added a commit to kennytm/rust that referenced this pull request Oct 9, 2017
…chton

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`.
bors added a commit that referenced this pull request Oct 10, 2017
Rollup of 9 pull requests

- Successful merges: #44962, #45051, #45091, #45106, #45117, #45118, #45120, #45125, #45136
- Failed merges:
@bors bors merged commit dee517a into rust-lang:master Oct 10, 2017
@johnthagen johnthagen deleted the fix-str-raise branch October 10, 2017 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants