Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Polish run.py.
  • Loading branch information
terryjreedy committed Jun 16, 2019
commit 35f03799f5389b72b931bb1d473a0b58d170f80f
9 changes: 4 additions & 5 deletions Lib/idlelib/runscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ def run_module_event(self, event):
# tries to run a module using the keyboard shortcut
# (the menu item works fine).
self.editwin.text_frame.after(200,
lambda: self.editwin.text_frame.event_generate('<<run-module-event-2>>'))
lambda: self.editwin.text_frame.event_generate(
'<<run-module-event-2>>'))
return 'break'
else:
return self._run_module_event(event)

def run_custom_event(self, event):
run_args = CustomRun(event.widget, "Customize Run").result
# User cancelled.
if not run_args:
if not run_args: # User cancelled.
return 'break'
return self._run_module_event(event, cli_args=run_args[0], restart=run_args[1])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to pass run_args and unpack in _run_module.


Expand All @@ -143,9 +143,8 @@ def _run_module_event(self, event, *, cli_args=None, restart=True):
self.editwin._filename_to_unicode(filename))
dirname = os.path.dirname(filename)
argv = [filename]
if cli_args:
if cli_args is not None:
argv += cli_args
# XXX Too often this discards arguments the user just set...
interp.runcommand(f"""if 1:
__file__ = {filename!r}
import sys as _sys
Expand Down