Skip to content

Single is_password prompt changes all further prompts #967

Open
@SoerenBusse

Description

@SoerenBusse

Hey there,

when using a prompt session the default value for is_password will be overwritten by a single call to prompt("Hello World", is_password=True). Any further prompts without having the attribute is_password set will still be in password mode.

Here's an example:

from prompt_toolkit import PromptSession
session = PromptSession()
session.prompt("Your Password:", is_password=True)
session.prompt("Your Magic Number:")

The output is the following:

Your Password:**** 
Your Magic Number:** 

Currently I have to explicitly set is_password=False on every further prompt after using a single prompt with is_password=True. Is this the expected behaviour? I would expect the second prompt to show the entered characters.
Our shouldn't you use a prompt session for entering a password? This however will makes things complicated when using a global style in your prompt session for example.

I'm using prompt_toolkit 3.0.0 from source at commit 850a4cd

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions