Skip to content

Regroup sentinels#3048

Merged
Rowlando13 merged 1 commit intopallets:mainfrom
kdeldycke:regroup-sentinels
Aug 26, 2025
Merged

Regroup sentinels#3048
Rowlando13 merged 1 commit intopallets:mainfrom
kdeldycke:regroup-sentinels

Conversation

@kdeldycke
Copy link
Copy Markdown
Collaborator

This is a small refactor to regroup all sentinels used across the Click codebase to the same private _utils.py file.

With this change:

  • The new FLAG_NEEDS_VALUE sentinel is self-documenting. Compare:

    >>> from click.parser import _flag_needs_value
    >>> repr(_flag_needs_value)
    '<object object at 0x104798620>'

    with:

    >>> from click._utils import FLAG_NEEDS_VALUE
    >>> repr(FLAG_NEEDS_VALUE)
    'Sentinel.FLAG_NEEDS_VALUE'
  • An option's _flag_needs_value property cannot be confused with the FLAG_NEEDS_VALUE sentinel as they are now clearly distinct by their naming convention.

@kdeldycke kdeldycke added this to the 8.3.0 milestone Aug 24, 2025
@kdeldycke kdeldycke added python Pull requests that update Python code f:parser labels Aug 24, 2025
@kdeldycke
Copy link
Copy Markdown
Collaborator Author

@Rowlando13 I guess this is a green-light from @davidism to merge this one! 😉

@Rowlando13 Rowlando13 merged commit 0afce31 into pallets:main Aug 26, 2025
10 checks passed
@kdeldycke
Copy link
Copy Markdown
Collaborator Author

Thanks @Rowlando13 for the merge! 😃

@kdeldycke kdeldycke deleted the regroup-sentinels branch August 26, 2025 04:53
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f:parser python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants