From 759e7a5586f279efd41b65b2f84e0dd3bcf77fbd Mon Sep 17 00:00:00 2001
From: chenhaixing123 <chenhaixing@huawei.com>
Date: Wed, 22 Feb 2023 17:27:04 +0800
Subject: [PATCH] fix AttributeError when IO busy and press ctrl c

Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/rpm-software-management/dnf/pull/1899/commits/759e7a5586f279efd41b65b2f84e0dd3bcf77fbd
---
 dnf/conf/config.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dnf/conf/config.py b/dnf/conf/config.py
index 32516d1..e08ca72 100644
--- a/dnf/conf/config.py
+++ b/dnf/conf/config.py
@@ -251,8 +251,9 @@ class MainConf(BaseConfig):
         self.tempfiles = []
 
     def __del__(self):
-        for file_name in self.tempfiles:
-            os.unlink(file_name)
+        if hasattr(self, 'tempfiles'):
+            for file_name in self.tempfiles:
+                os.unlink(file_name)
 
     @property
     def get_reposdir(self):
-- 
2.27.0