Visitar URL original
bpo-44554: refactor pdb targets (and internal tweaks) by jaraco · Pull Request #26992 · python/cpython · GitHub
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
Use cached_property for details.
  • Loading branch information
jaraco committed Jul 2, 2021
commit 86fbc39159a5793a763c8b1a45cebac4636027d9
12 changes: 5 additions & 7 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ def _run(self, target):
def _runmodule(self, target: 'ModuleTarget'):
self._wait_for_mainpyfile = True
self._user_requested_quit = False
mod_name, mod_spec, code = target.module_details
mod_name, mod_spec, code = target.details
self.mainpyfile = self.canonic(code.co_filename)
import __main__
__main__.__dict__.clear()
Expand Down Expand Up @@ -1691,12 +1691,10 @@ class ModuleTarget(str):
def check(self):
pass

@property
def module_details(self):
if not hasattr(self, '_details'):
import runpy
self._details = runpy._get_module_details(self)
return self._details
@functools.cached_property
def details(self):
import runpy
return runpy._get_module_details(self)


def main():
Expand Down