diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2021-07-30 17:10:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 17:10:37 (GMT) |
commit | ceea579ccc51791f3e115155d6f27905bc7544a9 (patch) | |
tree | 09c3575db3b9d802ffb5afcf40c08b1717bee8f3 /Lib/csv.py | |
parent | e3f877c32d7cccb734f45310f26beeec793364ce (diff) | |
download | cpython-ceea579ccc51791f3e115155d6f27905bc7544a9.zip cpython-ceea579ccc51791f3e115155d6f27905bc7544a9.tar.gz cpython-ceea579ccc51791f3e115155d6f27905bc7544a9.tar.bz2 |
bpo-43625: Enhance csv sniffer has_headers() to be more accurate (GH-26939)
Diffstat (limited to 'Lib/csv.py')
-rw-r--r-- | Lib/csv.py | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -409,14 +409,10 @@ class Sniffer: 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]) |