Skip to content

prompt_toolkit.shortcuts.confirm doesn't always return bool #2046

@iliqiliev

Description

@iliqiliev

prompt_toolkit.shortcuts.confirm doesn't always return bool. When pressing just enter it returns a str.

For example:

from prompt_toolkit.shortcuts import confirm

result = confirm()

print(f"Result|{result}|")
print(type(result))

Produces:

Confirm? (y/n)  ### I press `Enter` here ###
Result||
<class 'str'>

This is on Windows, using prompt_toolkit 3.0.52 if it matters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions