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
Merge branch 'main' into pdb-target-refactor
  • Loading branch information
gaogaotiantian committed Mar 28, 2024
commit abaa34adfbd4856619e764206495c2dcd91dfef5
9 changes: 4 additions & 5 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
import linecache

from contextlib import contextmanager
from rlcompleter import Completer
from types import CodeType
from typing import Union


class Restart(Exception):
Expand Down Expand Up @@ -177,9 +177,6 @@ def __init__(self, target):
if not sys.flags.safe_path:
sys.path[0] = os.path.dirname(self._target)

with io.open_code(self._target) as fp:
self._code = f"exec(compile({fp.read()!r}, {self._target!r}, 'exec'))"

def __repr__(self):
return self._target

Expand All @@ -189,7 +186,9 @@ def filename(self):

@property
def code(self):
return self._code
# We need to open the file each time because the file may be modified
with io.open_code(self._target) as fp:
return f"exec(compile({fp.read()!r}, {self._target!r}, 'exec'))"

@property
def namespace(self):
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.