I am unsure if the documentation should be updated to reflect the codebase OR the codebase should be updated to reflect the documentation. The fix is simple.
Example
#Run the following example code on the current `master` branch
import questionary
questionary.prompt([{"type":"text","message":"Just enter any string value", "name":"string_value","default":"some_default_value"}])
#Before answering the question, hit Ctrl-C to generate a keyboard input. You should notice the {}, a dict, is returned.
Steps to reproduce
See the example code above
Expected behaviour
According to the documentation, this should return None, but the code actually returns {}, a dict. I am unsure which is correct, so either the code or documentation should be updated to reflect the intended behavior.
Latest version
[X] I have checked that this issue occurs on the latest version of questionary.
Questionary version
2.0.1 (and latest commit in repo master: cf10f3e650d1550376a8e908baa0c9811ef72041)
Describe the bug
The following documentation states that if a keyboard interrupt is captured during a questionary.prompt() call, then
None
should be returned: https://github.com/tmbo/questionary/blob/cf10f3e650d1550376a8e908baa0c9811ef72041/docs/pages/advanced.rst#safeHowever, the codebase shows that if a Keyboard Interrupt is captured, then it is actually an empty dict
{}
which should be returned: https://github.com/tmbo/questionary/blob/cf10f3e650d1550376a8e908baa0c9811ef72041/questionary/prompt.py#L81I am unsure if the documentation should be updated to reflect the codebase OR the codebase should be updated to reflect the documentation. The fix is simple.
Example
Steps to reproduce
See the example code above
Expected behaviour
According to the documentation, this should return None, but the code actually returns {}, a dict. I am unsure which is correct, so either the code or documentation should be updated to reflect the intended behavior.
Latest version
Questionary version
2.0.1 (and latest commit in repo master: cf10f3e650d1550376a8e908baa0c9811ef72041)
Prompt Toolkit version
3.0.36
Operating System
macOS