Skip to content

sys.stdout output with many lines is truncated on the integrated terminal with pythonTerminalEnvVarActivation #21312

Closed
@bersbersbers

Description

@bersbersbers

Type: Bug

Behaviour

Expected vs. Actual

Expected: See numbers 0-4999
Actual: See fewer numbers, in my case, 0-1249

Discovered in Nuitka/Nuitka#2249

The number of lines printed actually varies with the number of lines generated:
1 -> 1
10 -> 10
100 -> 100
900 -> 900
1000 -> 1000
2000 -> 2000
2300 -> 2300
2340 -> 2340

2342 -> 1171
2344 -> 1172
3000 -> 1500
4000 -> 2000

5000 -> 1250

10000 -> 1250

So it looks like something is restricting the number of lines to <= 2340 by division by 2. If the original number if not divisible by 2, one can even end up with incomplete lines. That number does not seem to depend on the length of the lines.

Steps to reproduce:

  1. Activate pythonTerminalEnvVarActivation experiment
  2. Reload VS Code
  3. Open integrated terminal
  4. Run python -c "import sys; sys.stdout.write(''.join(f'{i:04d} \n' for i in range(5000)))"

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.3
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-05-27 23:07:25.573 [info] Telemetry level is off
2023-05-27 23:07:25.573 [info] Experiments are disabled, only manually opted experiments are active.
2023-05-27 23:07:25.573 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-05-27 23:07:25.573 [info] Test server listening.
2023-05-27 23:07:25.573 [info] Python interpreter path: ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe
2023-05-27 23:07:25.573 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2023-05-27 23:07:25.573 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2023-05-27 23:07:25.741 [info] > ~/.pyenv-win-venv/envs/project_3.11/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/printEnvVariables.py
2023-05-27 23:07:25.742 [info] shell: commandPrompt
2023-05-27 23:07:25.920 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2023-05-27 23:07:26.562 [info] Starting Pylance language server.
2023-05-27 23:07:26.817 [info] > ~/.pyenv-win-venv/envs/project_3.11/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/printEnvVariables.py
2023-05-27 23:07:26.817 [info] shell: commandPrompt
2023-05-27 23:07:27.268 [info] > ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\linter.py -m bandit --configfile pyproject.toml .\project\bug.py
2023-05-27 23:07:27.269 [info] cwd: .
2023-05-27 23:07:27.282 [info] > ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\linter.py -m pycodestyle .\project\bug.py
2023-05-27 23:07:27.282 [info] cwd: .
2023-05-27 23:07:27.302 [info] > ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\linter.py -m pydocstyle .\project\bug.py
2023-05-27 23:07:27.302 [info] cwd: .
2023-05-27 23:07:27.329 [info] > ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\linter.py -m mypy --follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty .\project\bug.py
2023-05-27 23:07:27.329 [info] cwd: .
2023-05-27 23:07:27.346 [info] > ~\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\linter.py -m pylama .\project\bug.py
2023-05-27 23:07:27.346 [info] cwd: .
2023-05-27 23:07:28.504 [info] ##########Linting Output - pycodestyle##########

2023-05-27 23:07:28.504 [info] 
2023-05-27 23:07:28.763 [info] ##########Linting Output - pydocstyle##########

2023-05-27 23:07:28.763 [info] 
2023-05-27 23:07:29.125 [info] ##########Linting Output - mypy##########

2023-05-27 23:07:29.125 [info] Success: no issues found in 1 source file

2023-05-27 23:07:29.247 [info] ##########Linting Output - bandit##########

2023-05-27 23:07:29.247 [info] 
2023-05-27 23:07:30.348 [info] ##########Linting Output - pylama##########

2023-05-27 23:07:30.348 [info] 

User Settings


venvPath: "<placeholder>"

languageServer: "Pylance"

linting
• banditArgs: "<placeholder>"
• banditEnabled: true
• mypyEnabled: true
• pycodestyleEnabled: true
• pydocstyleEnabled: true
• pylamaEnabled: true

formatting
• provider: "none"

testing
• pytestEnabled: true

experiments
• optInto: ["pythonTerminalEnvVarActivation"]

Extension version: 2023.8.0
VS Code version: Code 1.78.2 (b3e4e68a0bc097f0ae7907b217c1119af9e03435, 2023-05-10T14:39:26.248Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No

Metadata

Metadata

Assignees

Labels

area-environmentsFeatures relating to handling interpreter environmentsarea-terminalbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions