diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2013-12-15 20:33:02 +1000 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2013-12-15 20:33:02 +1000 |
commit | 720c7e28cb892204debd1b3820e460a9d654f178 (patch) | |
tree | ba0c12cc266baa1c1d1c274134f83d6843d605fd /Lib/test/script_helper.py | |
parent | 8aa36a3db97cfed3108f32fcb66c9c84e5c4b00d (diff) | |
download | cpython-git-720c7e28cb892204debd1b3820e460a9d654f178.tar.gz |
Issue #19700: set __spec__ appropriately in runpy
Note that __spec__.name is not currently guaranteed to be in
sys.modules when the code is running, only __name__ is.
The "running module is in sys.modules" invariant will be
expanded to also cover __spec__.name in a subsequent patch.
Diffstat (limited to 'Lib/test/script_helper.py')
-rw-r--r-- | Lib/test/script_helper.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py index 4d5c1f120a..af0545bac2 100644 --- a/Lib/test/script_helper.py +++ b/Lib/test/script_helper.py @@ -101,8 +101,10 @@ def kill_python(p): subprocess._cleanup() return data -def make_script(script_dir, script_basename, source): - script_filename = script_basename+os.extsep+'py' +def make_script(script_dir, script_basename, source, omit_suffix=False): + script_filename = script_basename + if not omit_suffix: + script_filename += os.extsep + 'py' script_name = os.path.join(script_dir, script_filename) # The script should be encoded to UTF-8, the default string encoding script_file = open(script_name, 'w', encoding='utf-8') |