bpo-43625: Enhance csv sniffer has_headers() to be more accurate (GH-26939) (GH-27494)

(cherry picked from commit ceea579ccc51791f3e115155d6f27905bc7544a9)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
diff --git a/Lib/csv.py b/Lib/csv.py
index dc85077..bb3ee26 100644
--- a/Lib/csv.py
+++ b/Lib/csv.py
@@ -409,14 +409,10 @@ def has_header(self, sample):
                 continue # skip rows that have irregular number of columns
 
             for col in list(columnTypes.keys()):
-
-                for thisType in [int, float, complex]:
-                    try:
-                        thisType(row[col])
-                        break
-                    except (ValueError, OverflowError):
-                        pass
-                else:
+                thisType = complex
+                try:
+                    thisType(row[col])
+                except (ValueError, OverflowError):
                     # fallback to length of string
                     thisType = len(row[col])