This function should have frames tracked by unhandled exceptions (the `_exec` name is important).
(self, is_module, entry_point_fn, module_name, file, globals, locals)
| 2705 | return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) |
| 2706 | |
| 2707 | def _exec(self, is_module, entry_point_fn, module_name, file, globals, locals): |
| 2708 | """ |
| 2709 | This function should have frames tracked by unhandled exceptions (the `_exec` name is important). |
| 2710 | """ |
| 2711 | t = threading.current_thread() # Keep in 't' local variable to be accessed afterwards from frame.f_locals. |
| 2712 | if not is_module: |
| 2713 | globals = pydevd_runpy.run_path(file, globals, "__main__") |
| 2714 | else: |
| 2715 | # treat ':' as a separator between module and entry point function |
| 2716 | # if there is no entry point we run we same as with -m switch. Otherwise we perform |
| 2717 | # an import and execute the entry point |
| 2718 | if entry_point_fn: |
| 2719 | mod = __import__(module_name, level=0, fromlist=[entry_point_fn], globals=globals, locals=locals) |
| 2720 | func = getattr(mod, entry_point_fn) |
| 2721 | func() |
| 2722 | else: |
| 2723 | # Run with the -m switch |
| 2724 | globals = pydevd_runpy._run_module_as_main(module_name, alter_argv=False) |
| 2725 | return globals |
| 2726 | |
| 2727 | def wait_for_commands(self, globals): |
| 2728 | self._activate_gui_if_needed() |