diff -urN mysql-5.7.38.orig/mysql-test/suite/innodb_stress/t/load_generator.py mysql-5.7.38.new/mysql-test/suite/innodb_stress/t/load_generator.py
--- mysql-5.7.38.orig/mysql-test/suite/innodb_stress/t/load_generator.py	2022-03-22 01:30:20.000000000 +0800
+++ mysql-5.7.38.new/mysql-test/suite/innodb_stress/t/load_generator.py	2022-05-07 14:41:03.555188841 +0800
@@ -47,12 +47,12 @@
     try:
       self.runme()
       print >> self.log, "ok"
-    except Exception, e:
+    except Exception as e:
       self.exception = e
       try:
         cursor = self.con.cursor()
         cursor.execute("INSERT INTO errors VALUES('%s')" % e)
-      except MySQLdb.Error, e2:
+      except MySQLdb.Error as e2:
         print >> self.log, "caught while inserting error (%s)" % e2
       print >> self.log, "caught (%s)" % e
     finally:
@@ -147,12 +147,12 @@
     try:
       self.runme()
       print >> self.log, "ok"
-    except Exception, e:
+    except Exception as e:
       try:
         cursor = self.con.cursor()
         cursor.execute("INSERT INTO errors VALUES('%s')" % e)
         con.commit()
-      except MySQLdb.Error, e2:
+      except MySQLdb.Error as e2:
         print >> self.log, "caught while inserting error (%s)" % e2
 
       print >> self.log, "caught (%s)" % e
@@ -252,13 +252,13 @@
     try:
       self.runme()
       print >> self.log, "ok, with do_blob %s" % self.do_blob
-    except Exception, e:
+    except Exception as e:
 
       try:
         cursor = self.con.cursor()
         cursor.execute("INSERT INTO errors VALUES('%s')" % e)
         cursor.execute("COMMIT")
-      except MySQLdb.Error, e2:
+      except MySQLdb.Error as e2:
         print >> self.log, "caught while inserting error (%s)" % e2
 
       print >> self.log, "caught (%s)" % e
@@ -358,7 +358,7 @@
         elif r == 4:
           self.con.rollback()
 
-      except MySQLdb.Error, e:
+      except MySQLdb.Error as e:
         if e.args[0] == 2006:  # server is killed
           print >> self.log, "mysqld down, transaction %d" % self.xid
           return
@@ -367,7 +367,7 @@
 
     try:
       self.con.commit()
-    except Exception, e:
+    except Exception as e:
       print >> self.log, "commit error %s" % e
 
 if  __name__ == '__main__':
