Enforce python3 and deprecate the use of python2 #82433
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enforces python3 and depreciates the use of python2 to build the Rust compiler. As python2 is no longer supported and we are approaching python4, we should move towards python3. Python2 is no longer maintained and could bring bugs to rustc if used. Even though Rust is about compatibility, the Python team highly recommends deprecating python2 since it's no longer maintained and security/general bug reports will not be looked at. Additionally, if rustc wanted to use python3 only features/python3 only packages, this would break when using python2.
Note: this PR also formats the Python code
From the Python "Sunset Python 2" blog post: