Ensure self.tdir exists in __del__

This commit is contained in:
Kovid Goyal 2022-05-27 10:48:16 +05:30
parent f5695ac4f4
commit 76e75d9f89
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -571,6 +571,7 @@ def parse_message(msg: str, simple: Container[str]) -> Iterator[Tuple[str, str]]
class EditCmd:
def __init__(self, msg: str) -> None:
self.tdir = ''
self.args: List[str] = []
self.cwd = self.file_name = self.file_localpath = ''
self.file_data = b''
@ -605,7 +606,6 @@ class EditCmd:
self.file_name = os.path.basename(self.file_spec)
self.file_localpath = os.path.normpath(os.path.join(self.cwd, self.file_spec))
self.is_local_file = False
self.tdir = ''
with suppress(FileNotFoundError):
st = os.stat(self.file_localpath)
self.is_local_file = (st.st_dev, st.st_ino) == self.file_inode