-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add more __future__ imports to increase compatibility with Python 3 in bootstrap #45138
Conversation
…e Option from object to make it a new-style class for Python 3 compatibility.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (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. |
r? @aidanhs -- you've reviewed Python in the past. I'm not really opposed to this as long as it keeps the same lower-bound on compatibility. |
I'll await feedback from @aidanhs. This should not change the lower-bound of compatibility, which is still Python 2.7. |
@bors r+ If I'm not mistaken, with the exception of "print function" (which we already depended on), all of these changes are pretty long-standing migrations in Python-land, in the sense that I remember them from my days writing Python like 10 years ago. ;) |
📌 Commit 49a73d0 has been approved by |
⌛ Testing commit 49a73d0 with merge 369710094062b176057dde172200e1c72f510a9a... |
💔 Test failed - status-travis |
@bors retry
|
☔ The latest upstream changes (presumably #45233) made this pull request unmergeable. Please resolve the merge conflicts. |
@johnthagen needs rebase |
@nikomatsakis Conflicts have been resovled |
@bors r=nikomatsakis |
📌 Commit bd84978 has been approved by |
Add more __future__ imports to increase compatibility with Python 3 in bootstrap The functionality of the `__future__` imports are described [here](https://docs.python.org/3/library/__future__.html). These will help ensure the bootstrap code stays compatible with Python 3. If changes are made in the future that use absolute imports, division, or the `print` function, this will be ensure that running it under Python 2 will pass or fail the same way as Python 3. `Option` is made a [new-style class](https://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes), so that it behaves the same way in Python 2 and 3. The `__future__ unicode_literals` import is not used, because that can change the semantics of the code in Python 2 in unwanted ways. For more information see [this article](http://python-future.org/unicode_literals.html).
☀️ Test successful - status-appveyor, status-travis |
The functionality of the
__future__
imports are described here.These will help ensure the bootstrap code stays compatible with Python 3. If changes are made in the future that use absolute imports, division, or the
print
function, this will be ensure that running it under Python 2 will pass or fail the same way as Python 3.Option
is made a new-style class, so that it behaves the same way in Python 2 and 3.The
__future__ unicode_literals
import is not used, because that can change the semantics of the code in Python 2 in unwanted ways. For more information see this article.