summaryrefslogtreecommitdiff
path: root/django/utils/autoreload.py
diff options
context:
space:
mode:
authorChenyang Yan <memory.yancy@gmail.com>2021-08-15 10:48:23 +0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-29 11:37:50 +0200
commit36d54b7a142689e0f882338159bca879d8b6d783 (patch)
tree4814a4c6f68543980b7d6eed6b7376c2193ca6ca /django/utils/autoreload.py
parent4884a87e022056eda10534c13d74e49b8cdda632 (diff)
Fixed #33027 -- Made autoreloader pass -X options.
Diffstat (limited to 'django/utils/autoreload.py')
-rw-r--r--django/utils/autoreload.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index cc65c043ab..583c2be647 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -220,6 +220,11 @@ def get_child_arguments():
py_script = Path(sys.argv[0])
args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions]
+ if sys.implementation.name == 'cpython':
+ args.extend(
+ f'-X{key}' if value is True else f'-X{key}={value}'
+ for key, value in sys._xoptions.items()
+ )
# __spec__ is set when the server was started with the `-m` option,
# see https://docs.python.org/3/reference/import.html#main-spec
# __spec__ may not exist, e.g. when running in a Conda env.