cool-easter-32542
09/29/2023, 1:00 AMgetpass() not squashing input, and Python repl `>>>`'s being buffered.
Reproducer:
1. create the files (script below)
2. run pants run example.py, and type in a password. BUG: getpass() cannot control the terminal and emits warnings (below). As the warnings suggest, typing anything (e.g. here's what I typed) is echoed.
python3.11/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Password: here's what I typed
3. run pants repl example.py, and type anything, e.g. here's what I typed. BUG: the prompt `>>>`s don't appear until quitting.
Python 3.11.4 (main, Jun 15 2023, 07:52:47) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
here's what I typed
File "<console>", line 1
here's what I typed
^
SyntaxError: incomplete input
^D
now exiting InteractiveConsole...
>>> >>> %
4. (run those comments with PANTS_NO_NATIVE_CLIENT=1 and observe the behaviour is better: no warnings and getpass() can squash the input, and the repl prints >>> in the right places)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.17.0"
backend_packages = ["pants.backend.python"]
[python]
interpreter_constraints = ["==3.11.*"]
EOF
echo 'python_sources(name="src")' > BUILD
echo 'import getpass; getpass.getpass()' > example.py
Pants version
2.17.0, with the native client.
OS
macOS
Additional info
#16680 is kinda sorta related.
pantsbuild/pants