mailman shell doesn't properly process PYTHONSTARTUP
When starting an interactive shell, mailman shell calls mailman.commands.cli_withlist.Withlist.process which in turn calls mailman.utilities.interact.interact to set up the interactive environment. This in turn sets up a code.InteractiveConsole() and feeds its runsource method the contents of the PYTHONSTARTUP file.
The problem is code.InteractiveConsole().runsource() only processes a single python command. This results in, e.g.,
$ bin/mailman shell
File "/opt/mailman/.pystart.py", line 1
import os
^
SyntaxError: multiple statements found while compiling a single statement
Welcome to the GNU Mailman shell
>>>
I have worked around this for the moment by wrapping my PYTHONSTARTUP file commands in a while True:
with a break
at the end so the file contains a single while
statement, but this is ugly and not necessary in other contexts.