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: Use sentinel for os.path.{ALLOW_MISSING,ALL_BUT_LAST} by JelleZijlstra · Pull Request #149613 · python/cpython

Conversation

@JelleZijlstra

@JelleZijlstra JelleZijlstra commented May 9, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

ALL_BUT_LAST is new in 3.15 (#117562). ALLOW_MISSING is also recent (#135037) but was backported to other branches for security reasons.

Making these sentinels has a few effects:

  • The repr changes from os.path.ALLOW_MISSING to just ALLOW_MISSING
  • The docstring is no longer present on the object itself.

Still it seems worth it to simplify to standard sentinels for 3.15+.

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@JelleZijlstra JelleZijlstra added the needs backport to 3.15 bugs and security fixes label May 9, 2026
@bedevere-app bedevere-app Bot mentioned this pull request May 9, 2026
Use PEP 661 (sentinels) in the standard library #149083
Open
@bedevere-app bedevere-app Bot added the awaiting core review label May 9, 2026
@read-the-docs-community

read-the-docs-community Bot commented May 9, 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 #32618158 | 📁 Comparing 71b5fee against main (7241f27)

  🔍 Preview build  

2 files changed
± library/os.path.html
± whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed May 9, 2026
View reviewed changes
Comment thread Lib/genericpath.py Outdated
return self.__class__.__name__
# Sentinels.
ALL_BUT_LAST = sentinel('ALL_BUT_LAST')
"""Special value for use in realpath()."""

@serhiy-storchaka serhiy-storchaka May 9, 2026

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.

Is it used as a docstring of the sentinel? I wonder, how can this be implemented?

Sorry, something went wrong.

Uh oh!

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

All reactions

@JelleZijlstra JelleZijlstra May 9, 2026

Copy link
Copy Markdown
Member Author

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.

Sentinels don't actually support docstrings. Putting a string like this is an established way to document a variable and I believe Sphinx supports it.

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka May 9, 2026

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.

Then they are not needed.

Sorry, something went wrong.

Uh oh!

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

All reactions
@JelleZijlstra JelleZijlstra closed this May 17, 2026
@JelleZijlstra
JelleZijlstra force-pushed the main branch from 71b5fee to acefff9 Compare May 17, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka left review comments

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review needs backport to 3.15 bugs and security fixes

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.

2 participants

@JelleZijlstra @serhiy-storchaka
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.