mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #23426: run_setup was broken in distutils.
Patch from Alexander Belopolsky.
This commit is contained in:
parent
9c11d91b50
commit
c6d9228290
3 changed files with 35 additions and 3 deletions
|
@ -204,16 +204,15 @@ def run_setup (script_name, script_args=None, stop_after="run"):
|
|||
global _setup_stop_after, _setup_distribution
|
||||
_setup_stop_after = stop_after
|
||||
|
||||
save_argv = sys.argv
|
||||
save_argv = sys.argv.copy()
|
||||
g = {'__file__': script_name}
|
||||
l = {}
|
||||
try:
|
||||
try:
|
||||
sys.argv[0] = script_name
|
||||
if script_args is not None:
|
||||
sys.argv[1:] = script_args
|
||||
with open(script_name, 'rb') as f:
|
||||
exec(f.read(), g, l)
|
||||
exec(f.read(), g)
|
||||
finally:
|
||||
sys.argv = save_argv
|
||||
_setup_stop_after = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue