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 — gh-133644: remove deprecated global configuration variables by picnixz · Pull Request #133654 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented May 8, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Ok, this one is really tricky and I really need more eyes to be sure about it, namely @vstinner's eyes.

There are two global configuration variables that were marked as deprecated but not explicitly slated for removal in the docs, namely Py_UTF8Mode and Py_InteractiveFlag. As such, I've left them untouched. They were however mentioned in the "pending removals" documents so I don't know if we can just remove them (note that users are more likely to land on the C API page rather than the what's new page when they are looking for docs).

I'll write a NEWS entry afterwards.

  • Issue: Remove deprecated C API objects slated for removal in 3.15 #133644

📚 Documentation preview 📚: https://cpython-previews--133654.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

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

All reactions
picnixz added 19 commits May 8, 2025 09:33
@picnixz
remove Py_BytesWarningFlag
12f494a
@picnixz
remove Py_DebugFlag
a6467f8
@picnixz
remove Py_VerboseFlag
df48806
@picnixz
remove Py_QuietFlag
cfabb22
@picnixz
remove Py_InspectFlag
71bca31
@picnixz
remove Py_OptimizeFlag
7ebf7bd
@picnixz
remove Py_NoSiteFlag
2d05afe
@picnixz
remove Py_FrozenFlag
2a8e546
@picnixz
remove Py_IgnoreEnvironmentFlag
93eee09
@picnixz
remove Py_DontWriteBytecodeFlag
311f95c
@picnixz
remove Py_NoUserSiteDirectory
f5b39db
@picnixz
remove Py_UnbufferedStdioFlag
c66edb3
@picnixz
remove Py_HashRandomizationFlag
9116a65
@picnixz
remove Py_IsolatedFlag
fb2a247
@picnixz
remove Py_LegacyWindowsFSEncodingFlag
86c0c87
@picnixz
remove Py_LegacyWindowsStdioFlag
eab9e01
@picnixz
remove Py_FileSystemDefaultEncoding and `Py_HasFileSystemDefaultEnc…
54ff2aa
…oding`
@picnixz
remove Py_FileSystemDefaultEncodeErrors
9a322fe
The following are also removed:

- `_Py_SetFileSystemEncoding`
- `_Py_ClearFileSystemEncoding`
- `_Py_HasFileSystemDefaultEncodeErrors`
@picnixz
fix test_embed
d4ff0f7
@picnixz
picnixz requested review from a team, encukou and ericsnowcurrently as code owners May 8, 2025 10:14
@picnixz
picnixz requested a review from vstinner May 8, 2025 10:15
@bedevere-app bedevere-app Bot mentioned this pull request May 8, 2025
Remove deprecated C API objects slated for removal in 3.15 #133644
Open
6 of 9 tasks
@bedevere-app bedevere-app Bot added the awaiting core review label May 8, 2025
picnixz added 5 commits May 8, 2025 12:16
@picnixz
blurb
5d59540
@picnixz
update What's New entries
eef039e
@picnixz
update docs
1248cea
@picnixz
update docutils refs
583bafb
@picnixz
fixup
daa1e2d
@bedevere-app bedevere-app Bot removed the awaiting core review label May 8, 2025
@hugovk

hugovk commented May 8, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I'll only keep the docs changes

How will people know these are deprecated, if it's not documented?

We have 12 months until 3.15's feature freeze (and and 17 until 3.15's release), things may have changed in that time. We can also open issues/PRs with the above projects.

  • pillow (11.1.0)

Which deprecated variables is Pillow using? I don't recall any deprecation warnings.

zooba reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented May 8, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

How will people know these are deprecated, if it's not documented?

The symbols are marked with __attribute__((deprecated)), so the compiler would have warned them (I guess?) Do you mean that we should keep the documentation entries? I thought we removed them in general

All reactions

Sorry, something went wrong.

Uh oh!

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

@hugovk

hugovk commented May 8, 2025

Copy link
Copy Markdown
Member

The symbols are marked with __attribute__((deprecated)), so the compiler would have warned them (I guess?)

Hmm, nothing at https://github.com/python-pillow/Pillow/actions/runs/14906674072/job/41870605210?pr=8948

Do you mean that we should keep the documentation entries?

Yes.

This PR isn't removing any deprecations, it's only removing documentation about them.

If we only remove the docs, we might end up keeping the deprecations in 3.15, making their status unclear.

Let's remove the deprecations and their docs at the same time.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented May 8, 2025

Copy link
Copy Markdown
Member Author

If we only remove the docs, we might end up keeping the deprecations in 3.15, making their status unclear.

Ah, I see what you mean. Ok let's remove them in one go. Or if someone else has a cleaner PR for the runtime changes, they can just merge this one into theirs and they don't need to update the docs themselves.

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 8, 2025

Copy link
Copy Markdown
Member

Which deprecated variables is Pillow using? I don't recall any deprecation warnings.

Pillow uses Py_FileSystemDefaultEncoding: source.

    if (!PyArg_ParseTupleAndKeywords(
            args,
            kw,
            "etf|nsy#n",
            kwlist,
            Py_FileSystemDefaultEncoding,  # <==== HERE ====
            &filename,
            &size,
            &index,
            &encoding,
            &font_bytes,
            &font_bytes_size,
            &layout_engine
        )) {
        return NULL;
    }

Oh, but this code path is only taken on Python 3.10 and older! So you can ignore Pillow which is up to date!

hugovk reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

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

@hugovk

hugovk commented May 8, 2025

Copy link
Copy Markdown
Member

Hooray! Although I don't see any deprecations in the 3.9 build logs, should there be?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 8, 2025

Copy link
Copy Markdown
Member

Hooray! Although I don't see any deprecations in the 3.9 build logs, should there be?

No, the deprecation was added later.

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@hugovk

hugovk commented May 9, 2025

Copy link
Copy Markdown
Member

OK, thanks.


Unrelated to this issue, I wanted to see what the deprecation looks like. Just for testing, I edited the Pillow code so it only has a code path hitting the deprecation. A normal pip install -e . on Python 3.14.0b1 doesn't show any warnings, but it does with --verbose:

  src/_imagingft.c:145:13: warning: 'Py_FileSystemDefaultEncoding' is deprecated [-Wdeprecated-declarations]
    145 |             Py_FileSystemDefaultEncoding,
        |             ^
  /Library/Frameworks/Python.framework/Versions/3.14/include/python3.14/fileobject.h:22:1: note: 'Py_FileSystemDefaultEncoding' has been explicitly marked deprecated here
     22 | Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
        | ^
  /Library/Frameworks/Python.framework/Versions/3.14/include/python3.14/pyport.h:280:54: note: expanded from macro 'Py_DEPRECATED'
    280 | #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
        |                                                      ^

Neither uv pip install -e . nor with --verbose showed the deprecation.

It's unfortunate that neither show the warning in normal use, as their maintainers will be less likely to see them. Perhaps something to raise with pip and uv.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented May 9, 2025

Copy link
Copy Markdown
Member Author

It's unfortunate that neither show the warning in normal use, as their maintainers will be less likely to see them. Perhaps something to raise with pip and uv.

I think it'd be a good idea yes. Should we raise it for both? or is uv bundling part of pip and it suffices to just change pip?

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz
Merge remote-tracking branch 'upstream/main' into cleanup/315/depreca…
b8afe23
…ted-globals-133644
@picnixz

picnixz commented May 9, 2025

Copy link
Copy Markdown
Member Author

@vstinner @hugovk Actually, there were two variables that were slated for removal and notified in 3.12 What's New I think but they never had a deprecated-removed directive and only the deprecation version is rendered. Those are Py_UTF8Mode and Py_InteractiveFlag.

Should we push the removal version to 3.16 or just delay the removal of all variables?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 9, 2025

Copy link
Copy Markdown
Member

Actually, there were two variables that were slated for removal and notified in 3.12 What's New I think but they never had a deprecated-removed directive and only the deprecation version is rendered. Those are Py_UTF8Mode and Py_InteractiveFlag.

Both variables emit deprecation warnings using Py_DEPRECATED():

Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UTF8Mode;
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_InteractiveFlag;

I don't think that the doc is a big deal here, Py_DEPRECATED() is more important.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 9, 2025

Copy link
Copy Markdown
Member

Also, all global configuration variables are documented in "Pending removal in Python 3.15": https://docs.python.org/dev/whatsnew/3.14.html#id13

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented May 9, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Ok, I'll update the docs first for 3.13 and 3.14. I always hate doing backports, so would it be fine for me to first update main and let the bot make the backports automatically? that way, even 3.15 is consistent.

One way why I can think of why it's annoying to users is that they don't necessarily land on the What's New page if they make a Google search.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz picnixz mentioned this pull request May 9, 2025
gh-133644: update Py_InteractiveFlag deprecation notice #133749
Merged
@hugovk

hugovk commented May 9, 2025

Copy link
Copy Markdown
Member

I think it'd be a good idea yes. Should we raise it for both?

Yes, raised in the PyPA/pip Discord and they asked to comment here: pypa/pyproject-hooks#157 (comment)

or is uv bundling part of pip and it suffices to just change pip?

uv is all Rust, no Python.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz
Merge remote-tracking branch 'upstream/main' into cleanup/315/depreca…
8a2173f
…ted-globals-133644
@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 24, 2026
@vstinner

vstinner commented Apr 29, 2026

Copy link
Copy Markdown
Member

See issue gh-149163 "Add PEP 741 PyInitConfig API to the limited C API". It's not directly related, but it may help projects to move to the PyInitConfig API.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Apr 30, 2026
Add PEP 741 PyInitConfig API to the limited C API #149163
Closed
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 15, 2026
This was referenced Jul 27, 2026
26 C APIs scheduled for removal in 3.16 are still present #154757
Open
gh-154757: Remove the deprecated Py_UNICODE type #154759
Open
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 17, 2026
@vstinner vstinner mentioned this pull request Sep 23, 2026
C API: Remove deprecated API to configure Python initialization #158001
Closed
@ambv

ambv commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This PR is superseded by #136277, a newer open pull request for the same issue (gh-133644), and it no longer merges cleanly. Closing to cull the number of open pull requests. Do not reopen this pull request without getting a go-ahead from a triager or core developer.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ambv ambv closed this Oct 20, 2026
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
@zooba zooba zooba left review comments
@encukou encukou Awaiting requested review from encukou
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner will be requested when the pull request is marked ready for review AA-Turner is a code owner
@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity will be requested when the pull request is marked ready for review ZeroIntensity is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

stale Stale PR or inactive for long period of time.

Projects

None yet

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.

5 participants

@picnixz @vstinner @hugovk @ambv @zooba
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.