summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorWilliam Schwartz <wkschwartz@gmail.com>2020-11-09 16:41:13 -0600
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-11 09:18:26 +0100
commitc0fc5ba3808becefcdc8b878f133fd2a864a072d (patch)
tree0078f9f6c1fd6c3ba7f2b5862653e604e2fdc4a1 /django
parentd26d1c196dbb82bf034608576b1019b163086e51 (diff)
Fixed #32183 -- Fixed shell crash when passing code with nested scopes.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/shell.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py
index 2b306a579e..3e8a451e3e 100644
--- a/django/core/management/commands/shell.py
+++ b/django/core/management/commands/shell.py
@@ -84,13 +84,13 @@ class Command(BaseCommand):
def handle(self, **options):
# Execute the command and exit.
if options['command']:
- exec(options['command'])
+ exec(options['command'], globals())
return
# Execute stdin if it has anything to read and exit.
# Not supported on Windows due to select.select() limitations.
if sys.platform != 'win32' and not sys.stdin.isatty() and select.select([sys.stdin], [], [], 0)[0]:
- exec(sys.stdin.read())
+ exec(sys.stdin.read(), globals())
return
available_shells = [options['interface']] if options['interface'] else self.shells