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-149083: Make functools.Placeholder a sentinel by JelleZijlstra · Pull Request #149088 · python/cpython

Conversation

@JelleZijlstra

@JelleZijlstra JelleZijlstra commented Apr 28, 2026 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This greatly simplifies the code. The only behavioral difference observable in the tests is that type(Placeholder)() no longer works, because Placeholder is now an instance of sentinel.

  • Issue: Use PEP 661 (sentinels) in the standard library #149083

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@JelleZijlstra
pythongh-149083: Make functools.Placeholder a sentinel
5fe5051
@JelleZijlstra
JelleZijlstra requested a review from rhettinger as a code owner April 28, 2026 03:33
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 28, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 28, 2026
Use PEP 661 (sentinels) in the standard library #149083
Open
@picnixz

picnixz commented Apr 28, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Is type(Placeholder)() acceptable? I would have actually expected that type(MySentinel)() returned the sentinel as for type(None)() but it's not the case since MySentinel is an instance of a sentinel!

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented Apr 28, 2026

Copy link
Copy Markdown
Member

Actually, since we're launching beta, it may be ok to change this and see if it breaks something

All reactions

Sorry, something went wrong.

Uh oh!

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

@JelleZijlstra

JelleZijlstra commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

It's difficult to imagine why people would be doing things like type(Placeholder)() outside of test code, but you never know.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented Apr 28, 2026

Copy link
Copy Markdown
Member

I can see people doing type(Placeholder) for maybe their mypy plugin or whatever, or even for checking if a default is a placeholder instance and do something else with it (though they should assume that it's a singleton so there is no real need to check placeholders through isinstance checks). I think there was a discussion when introducing placeholders about type(P)() returning P but I can't find it (and maybe I remembered wrongly). One could argue that type(Placeholder) could also be used for type annotations =/

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented Jul 31, 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 Jul 31, 2026
@JelleZijlstra JelleZijlstra mentioned this pull request Oct 31, 2026
Simplify Placeholder with the new sentinel() class #161031
Closed
@rhettinger

rhettinger commented Oct 31, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

I'm not worried about the type(Placeholder) issue. That is an undocumented, unimportant, and unintended implementation detail.

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

rhettinger
rhettinger approved these changes Oct 31, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 31, 2026
picnixz
picnixz reviewed Oct 31, 2026
View reviewed changes
Comment thread Doc/library/functools.rst Resolved

Uh oh!

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

@picnixz
Update Doc/library/functools.rst
4546be5
@picnixz picnixz removed the stale Stale PR or inactive for long period of time. label Oct 31, 2026
@read-the-docs-community

read-the-docs-community Bot commented Oct 31, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35551338 | 📁 Comparing 4001152 against main (d2f506a)

  🔍 Preview build  

466 files changed · + 18 added · ± 447 modified · - 1 deleted

+ Added

  • builtins/constants.html
  • builtins/exceptions.html
  • builtins/functions.html
  • builtins/index.html
  • builtins/stdtypes.html
  • builtins/threadsafety.html
  • builtins/time-complexity.html
  • c-api/pyexpat.html
  • c-api/slots.html
  • deprecations/pending-removal-in-3.21.html
  • and 8 more...

± Modified

  • bugs.html
  • glossary.html
  • index.html
  • license.html
  • py-modindex.html
  • _static/tachyon-example-heatmap.html
  • c-api/arg.html
  • c-api/bool.html
  • c-api/buffer.html
  • c-api/bytearray.html
  • and 437 more...

- Deleted

  • library/asyncio-policy.html
All reactions

Sorry, something went wrong.

Uh oh!

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

picnixz
picnixz reviewed Oct 31, 2026
View reviewed changes
Comment thread Modules/_functoolsmodule.c Resolved

Uh oh!

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

picnixz added 2 commits October 31, 2026 23:06
@picnixz
Update Modules/_functoolsmodule.c
aecd0b9
@picnixz
Merge branch 'main' into placehold
4001152
@picnixz
picnixz merged commit ee074d1 into python:main Nov 1, 2026
56 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@rhettinger rhettinger rhettinger approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

3 participants

@JelleZijlstra @picnixz @rhettinger
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.