Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment
variable.

.. c:var:: int Py_UTF8Mode

Enables the UTF-8 Mode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a link to https://docs.python.org/dev/library/os.html#python-utf-8-mode using utf8-mode reference. Please replace "UTF-8 Mode" with "Pyhon UTF-8 Mode".


If set to 1, enable the UTF-8 Mode.
If set to 0, disable the UTF-8 Mode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that it works this way. preconfig_get_global_vars() ignores Py_UTF8Mode if Py_UTF8Mode <= 0.

Py_UTF8Mode should not be used: PyPreConfig.utf8_mode should be used instead. Today, it seems like the only purpose of Py_UTF8Mode is to explicitly enable the Python UTF-8 Mode with Py_UTF8Mode=1.

If set to -1, look for the :option:`-x` option and the :envvar:`PYTHONUTF8` environment variable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention that the variable is now deprecated: #93943

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3ec424d (#31480) when resolving the conflict.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If set to -1, look for the :option:`-x` option and the :envvar:`PYTHONUTF8` environment variable.
If set to -1, look for the :option:`-x utf8 <-x>` command line option and the :envvar:`PYTHONUTF8` environment variable.


Initializing and finalizing the interpreter
===========================================
Expand Down