GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-33601 Py_UTF8Mode is not documented by Vidhyavinu · Pull Request #31480 · python/cpython

Conversation

@Vidhyavinu

@Vidhyavinu Vidhyavinu commented Feb 21, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Added UTF8Mode documentation to https://docs.python.org/dev/c-api/init.html#global-configuration-variables

https://bugs.python.org/issue33601

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Vidhyavinu
bpo-33601 Py_UTF8Mode is not documented
885908e
Added UTF8Mode documentation to https://docs.python.org/dev/c-api/init.html#global-configuration-variables
@bedevere-bot bedevere-bot added the awaiting review label Feb 21, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 21, 2022
@bedevere-bot bedevere-bot added the docs Documentation in the Doc dir label Feb 21, 2022
@hugovk hugovk added the skip news label Feb 22, 2022
@AA-Turner

AA-Turner commented May 21, 2022

Copy link
Copy Markdown
Member

I only see checks for if Py_UTF8Mode is greater than 0 in the source (https://cs.github.com/python/cpython?q=Py_UTF8Mode), but perhaps I'm missing something.

cc: @vstinner @methane

A

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added needs backport to 3.10 needs backport to 3.11 only security fixes labels May 21, 2022
@serhiy-storchaka serhiy-storchaka mentioned this pull request May 23, 2022
[doc] Py_UTF8Mode is not documented #77782
Closed
@vstinner

vstinner commented May 23, 2022

Copy link
Copy Markdown
Member

I created #93103 to deprecate Global Configuration Variables like Py_IgnoreEnvironment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MaxwellDupre
MaxwellDupre reviewed Jun 14, 2022
View reviewed changes

@MaxwellDupre MaxwellDupre left a comment

Copy link
Copy Markdown
Contributor

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.

How about adding a link in C API Stability page to init.rst?
Also, adding
Py_UTF8Mode=1 enables UTF-8 mode. However the PYTHONUTF8 environment variable is ignored (even if use_environment=1).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vstinner
vstinner reviewed Jun 17, 2022
View reviewed changes
Comment thread Doc/c-api/init.rst

If set to 1, enable the UTF-8 Mode.
If set to 0, disable the UTF-8 Mode.
If set to -1, look for the :option:`-x` option and the :envvar:`PYTHONUTF8` environment variable.

@vstinner vstinner Jun 17, 2022

Copy link
Copy Markdown
Member

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.

Please mention that the variable is now deprecated: #93943

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@hugovk hugovk Apr 10, 2025

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vstinner
vstinner reviewed Jun 17, 2022
View reviewed changes
Comment thread Doc/c-api/init.rst

If set to 1, enable the UTF-8 Mode.
If set to 0, disable the UTF-8 Mode.
If set to -1, look for the :option:`-x` option and the :envvar:`PYTHONUTF8` environment variable.

@vstinner vstinner Jun 17, 2022

Copy link
Copy Markdown
Member

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/c-api/init.rst
Enables the UTF-8 Mode.

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

@vstinner vstinner Jun 17, 2022

Copy link
Copy Markdown
Member

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'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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/c-api/init.rst

.. c:var:: int Py_UTF8Mode

Enables the UTF-8 Mode.

@vstinner vstinner Jun 17, 2022

Copy link
Copy Markdown
Member

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 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes and removed needs backport to 3.10 needs backport to 3.11 only security fixes labels May 9, 2024
@hugovk hugovk removed the needs backport to 3.12 only security fixes label Apr 10, 2025
hugovk added 2 commits April 10, 2025 14:47
@hugovk
Merge branch 'main' into Vidhyavinu-patch-init-rst
3ec424d
@hugovk
Merge branch 'main' into Vidhyavinu-patch-init-rst
cda2c19
@python-cla-bot

python-cla-bot Bot commented Apr 18, 2025

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

  • [email protected]

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@StanFromIreland

StanFromIreland commented Jul 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Thank you for the contribution however it has been decided that this will in fact not be documented, the attached issue has been closed as not planned.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland closed this Jul 29, 2025
@AA-Turner AA-Turner removed needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@hugovk hugovk hugovk left review comments
+1 more reviewer
@MaxwellDupre MaxwellDupre MaxwellDupre left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Todo

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@Vidhyavinu @AA-Turner @vstinner @StanFromIreland @hugovk @MaxwellDupre @serhiy-storchaka @the-knights-who-say-ni @ezio-melotti @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.