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 — Fix callable ``flag_value`` being instantiated when used as a default by kdeldycke · Pull Request #3225 · pallets/click

Conversation

@kdeldycke

@kdeldycke kdeldycke commented Feb 21, 2026

Copy link
Copy Markdown
Collaborator

This fix issue #3121, where a flag_value set to a class produce an instance of that class in the particular case that it is explicitly set as the default.

The fix consist in lazily resolving the default value at the time of use, with a branch dedicated to callables.

I extended the unittests to default_map to demonstrate the current state of callable presence in them.

Sorry, something went wrong.

Uh oh!

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

All reactions
@kdeldycke

kdeldycke commented Feb 21, 2026

Copy link
Copy Markdown
Collaborator Author

This PR replace AI-slop from: #3201 and #3213

All reactions

Sorry, something went wrong.

Uh oh!

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

@kdeldycke
kdeldycke force-pushed the keep-classes-flag-values-uninstanciated branch from ead2d43 to 75d0590 Compare February 21, 2026 14:15
@kdeldycke kdeldycke added this to the 8.3.2 milestone Feb 21, 2026
@kdeldycke kdeldycke added bug labels Feb 21, 2026
@kdeldycke kdeldycke mentioned this pull request Feb 21, 2026
Using a class as a flag_value causes the default to be instantiated in click 8.3.0 #3121
Closed
@kdeldycke
kdeldycke force-pushed the keep-classes-flag-values-uninstanciated branch from 90ea873 to d898d6c Compare February 21, 2026 14:16
@kdeldycke kdeldycke linked an issue Feb 21, 2026 that may be closed by this pull request
Using a class as a flag_value causes the default to be instantiated in click 8.3.0 #3121
Closed
@kdeldycke
kdeldycke force-pushed the keep-classes-flag-values-uninstanciated branch from d898d6c to de48f5d Compare February 21, 2026 14:27
@Rowlando13
Rowlando13 changed the base branch from main to stable February 27, 2026 21:15
@Rowlando13

Rowlando13 commented Feb 27, 2026

Copy link
Copy Markdown
Member

@kdeldycke Can you please fix merge conflicts.

All reactions

Sorry, something went wrong.

Uh oh!

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

@kdeldycke
kdeldycke force-pushed the keep-classes-flag-values-uninstanciated branch from de48f5d to ca3ae49 Compare February 28, 2026 06:42
@kdeldycke

kdeldycke commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator Author

@Rowlando13 rebased and ready to merge! :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@kdeldycke
Fix callable flag_value being instantiated when used as a default
546f285
Closes pallets#3121
Refs: pallets#3201 pallets#3213
@kdeldycke
kdeldycke force-pushed the keep-classes-flag-values-uninstanciated branch from ca3ae49 to 546f285 Compare March 1, 2026 16:27
@kdeldycke

kdeldycke commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator Author

Had to rebase it once again. Done.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Rowlando13
Rowlando13 merged commit 5850ef9 into pallets:stable Mar 1, 2026
14 checks passed

Uh oh!

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

@kdeldycke

kdeldycke commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @Rowlando13 for the merge! :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@kdeldycke
kdeldycke deleted the keep-classes-flag-values-uninstanciated branch March 2, 2026 04:47
@kdeldycke kdeldycke mentioned this pull request Mar 2, 2026
Reconcile default value passing and default activation #3239
Merged
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 17, 2026
@kdeldycke kdeldycke added parsing Parsing, parameters, commands, chaining, context and removed f:parameters labels Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

parsing Parsing, parameters, commands, chaining, context

Projects

None yet

Milestone

8.3.2

Development

Successfully merging this pull request may close these issues.

Using a class as a flag_value causes the default to be instantiated in click 8.3.0

Uh oh!

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

2 participants

@kdeldycke @Rowlando13
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 01402775 — 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.