diff options
author | robot-piglet <[email protected]> | 2024-06-19 11:03:24 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2024-06-19 11:11:19 +0300 |
commit | 30bcb2b0866066d4f27f91b538958641f4c2cbdc (patch) | |
tree | 79233ffb046b9152ce1751134f06ad745ece58af /contrib/python/prompt-toolkit/py3/prompt_toolkit/application | |
parent | 71e31152d8d81e2e84441aa5b6574e5f112a9449 (diff) |
Intermediate changes
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/application')
-rw-r--r-- | contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py index 908141a4767..7e2cf480ba8 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py @@ -147,11 +147,17 @@ def create_app_session( Like in the case of an Telnet/SSH server. """ # If no input/output is specified, fall back to the current input/output, - # whatever that is. + # if there was one that was set/created for the current session. + # (Note that we check `_input`/`_output` and not `input`/`output`. This is + # because we don't want to accidently create a new input/output objects + # here and store it in the "parent" `AppSession`. Especially, when + # combining pytest's `capsys` fixture and `create_app_session`, sys.stdin + # and sys.stderr are patched for every test, so we don't want to leak + # those outputs object across `AppSession`s.) if input is None: - input = get_app_session().input + input = get_app_session()._input if output is None: - output = get_app_session().output + output = get_app_session()._output # Create new `AppSession` and activate. session = AppSession(input=input, output=output) |