Skip to content

get_parameter_source() returns None in 8.4.0 #3458

Closed

Description

@lemon24

Starting with 8.4, get_parameter_source() returns None.

Repro:

import click

class Source(click.ParamType):
    name = "source"
    def convert(self, value, param, ctx):
        return {'value': value, 'source': ctx.get_parameter_source(param.name)}

@click.command
@click.option('--default', type=Source(), default='/tmp/file')
@click.option('--nodefault', type=Source())
def main(default, nodefault):
    print("default:", default)
    print("nodefault:", nodefault)

if __name__ == '__main__':
    main()

Output:

$ pip install click==8.4.0 -q
$ python source.py                  
default: {'value': '/tmp/file', 'source': None}
nodefault: None
$ python source.py --default cli --nodefault cli
default: {'value': 'cli', 'source': None}
nodefault: {'value': 'cli', 'source': None}

$ pip install click==8.3.3 -q                   
$ python source.py                              
default: {'value': '/tmp/file', 'source': <ParameterSource.DEFAULT: 5>}
nodefault: None
$ python source.py --default cli --nodefault cli
default: {'value': 'cli', 'source': <ParameterSource.COMMANDLINE: 2>}
nodefault: {'value': 'cli', 'source': <ParameterSource.COMMANDLINE: 2>}

Environment:

  • Python version: 3.14.4 (seems to happen on all versions, on both macOS and Linux)
  • Click version: 8.4.0

Activity

  1. changed the title [-]get_parameter_source() returns None for default values in 8.4[/-] [+]get_parameter_source() returns None in 8.4[/+] on May 18, 2026
  2. added this to the 8.4.1 milestone on May 21, 2026
  3. kdeldycke commented on May 21, 2026

    @kdeldycke
    Collaborator

    Can confirm the issue. My Click Extra tests detected this regression on main before the 8.4.0 release. @Rowlando13 next time give me 1 or 2 days before releasing once all PRs are merged so I can catch the last remaining bugs! 😅

  4. changed the title [-]get_parameter_source() returns None in 8.4[/-] [+]`get_parameter_source()` returns `None` in 8.4.0[/+] on May 21, 2026
  5. kdeldycke commented on May 21, 2026

    @kdeldycke
    Collaborator

    A fix has been proposed in #3484 . @lemon24 can you test it?

  6. lemon24 commented on May 21, 2026

    @lemon24
    Author

    Thank you @yurishevtsov, @kdeldycke, all good on my side!

    $ pip install 'git+https://github.com/pallets/click.git@refs/pull/3483/head' -q
    $ python -m reader --db db.sqlite list feeds | head -n1
    reader:archived
    $ ./run.sh test tests/test_cli.py tests/test_config_utils.py --runslow -q --disable-warnings
    ................                                                          [100%]
    16 passed, 2 warnings in 0.94s
  7. locked as resolved and limited conversation to collaborators on Jul 24, 2026
  8. added
    parsing
    and removed on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsing

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions