summaryrefslogtreecommitdiff
path: root/src/mailman/utilities/interact.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/utilities/interact.py')
-rw-r--r--src/mailman/utilities/interact.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mailman/utilities/interact.py b/src/mailman/utilities/interact.py
index d74cd8af7..3c38b02aa 100644
--- a/src/mailman/utilities/interact.py
+++ b/src/mailman/utilities/interact.py
@@ -24,7 +24,7 @@ import code
from mailman import public
-DEFAULT_BANNER = ''
+DEFAULT_BANNER = object()
@public
@@ -33,7 +33,7 @@ def interact(upframe=True, banner=DEFAULT_BANNER, overrides=None):
:param upframe: Whether or not to populate the interpreter's globals with
the locals from the frame that called this function.
- :type upfframe: bool
+ :type upframe: bool
:param banner: The banner to print before the interpreter starts.
:type banner: string
:param overrides: Additional interpreter globals to add.
@@ -61,13 +61,11 @@ def interact(upframe=True, banner=DEFAULT_BANNER, overrides=None):
startup = os.environ.get('PYTHONSTARTUP')
if startup:
with open(startup, 'r', encoding='utf-8') as fp:
- interp.runsource(fp.read(), startup)
+ interp.runcode(compile(fp.read(), startup, 'exec'))
# We don't want the funky console object in parentheses in the banner.
- if banner == DEFAULT_BANNER:
+ if banner is DEFAULT_BANNER:
banner = '''\
Python %s on %s
Type "help", "copyright", "credits" or "license" for more information.''' % (
sys.version, sys.platform)
- elif not banner:
- banner = None
interp.interact(banner)