Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
GH-133711: Enable UTF-8 mode by default (PEP 686)#133712
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Doc/whatsnew/3.15.rst Outdated
* Python UTF-8 mode is now enabled by default. | ||
It may be disabled with by setting :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` as | ||
an environment variable or by using the :option:`-X utf8=0 <-X>` flag. | ||
See :pep:`686` for further details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I feel like we can probably put some more explanation in here, such as that it affects TextIOWrapper and henceopen()
. The current description doesn't sound as scary as it needs to, in my opinion.
Along the lines of: "Python UTF-8 mode is now enabled by default. This means that (files/console/etc.) will now use UTF-8 regardless of system settings, unless specifically overridden in code (typically with anencoding=
argument)."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
To be clear, it's nothing new. But we shouldn't assume that everyone already knows what UTF-8 mode implies. There are many more people out there who haven't ever thought about it than those who are waiting for it to be the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Another effect of the UTF-8 Mode is that Python ignores the locale encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've expanded theWhat's New entry, please seehttps://cpython-previews--133712.org.readthedocs.build/en/133712/whatsnew/3.15.html#other-language-changes
Uh oh!
There was an error while loading.Please reload this page.
@@ -75,7 +75,30 @@ New features | |||
Other language changes | |||
====================== | |||
* Python now uses UTF-8_ as the default encoding, independent of the system's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You might mention the UTF-8 Mode earlier since it has other side effects documented in the UTF-8 Mode section, such as changing sys.stdout error handler and ignoring the locale encoding.
Uh oh!
There was an error while loading.Please reload this page.
# Conflicts:#Doc/whatsnew/3.15.rst
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
# Conflicts:#Lib/test/test_cmd_line.py
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
I wrote#134839 to fix test_regrtest when PYTHONUTF8=1 env var is set. |
I wrote#134841 to fix test_readline for the Python UTF-8 Mode. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Configure host Python fails with:
It seems to be unrelated to this PR. |
cc@brettcannon, this builder seems to beconsistently failing since ~15/05. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
Python UTF-8 mode is now enabled by default (:pep:`686`). | ||
It may be disabled with by setting :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` as | ||
an environment variable or by using the :option:`-X utf8=0 <-X>` flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
an environment variable or by using the:option:`-X utf8=0 <-X>`flag. | |
an environment variable or by using the:option:`-X utf8=0 <-X>`command line option. |
Enabled by default (equalto 1; PEP 686), or if Py_UTF8Mode=1, | ||
or if "-X utf8=1" or PYTHONUTF8=1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Enabledbydefault (equalto1;PEP686),orifPy_UTF8Mode=1, | |
orif"-X utf8=1"orPYTHONUTF8=1. | |
Enabledbydefault (equalto1;PEP686),orifPy_UTF8Mode=1, | |
orif"-X utf8=1"orPYTHONUTF8=1. |
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--133712.org.readthedocs.build/