Consider the following code:
import click
class Foo:
pass
class Bar:
pass
@click.command()
@click.option("--foo", "ty", flag_value=Foo, type=click.UNPROCESSED, default=True)
@click.option("--bar", "ty", flag_value=Bar, type=click.UNPROCESSED)
def main(ty):
click.echo(repr(ty))
if __name__ == "__main__":
main()
When run with no arguments using click 8.3.0, this prints <__main__.Foo object at 0x10bed92b0>, indicating that Foo has been instantiated, which is not what I want. When using an older version of click, the script outputs <class '__main__.Foo'>, which is what I want.
If the script is passed an explicit --foo or --bar option, a class is output, indicating that the problem lies with the default handling.
Changing the default=True to default=Foo does not help.