summaryrefslogtreecommitdiffstats
path: root/Lib/csv.py
diff options
context:
space:
mode:
authorandrei kulakov <andrei.avk@gmail.com>2022-12-09 16:14:33 (GMT)
committerGitHub <noreply@github.com>2022-12-09 16:14:33 (GMT)
commitd0679c12398579fe9f10e78b6332dded119e4697 (patch)
tree840c814be55fe6579fe099c27bf7b8c2614f85ed /Lib/csv.py
parenta29a7b9b786d6b928c4bb4e6e683a3788e3ab1c1 (diff)
downloadcpython-d0679c12398579fe9f10e78b6332dded119e4697.zip
cpython-d0679c12398579fe9f10e78b6332dded119e4697.tar.gz
cpython-d0679c12398579fe9f10e78b6332dded119e4697.tar.bz2
bpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or upper case (#26924)
Diffstat (limited to 'Lib/csv.py')
-rw-r--r--Lib/csv.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/csv.py b/Lib/csv.py
index 309a8f3..4ef8be4 100644
--- a/Lib/csv.py
+++ b/Lib/csv.py
@@ -139,7 +139,8 @@ class DictWriter:
fieldnames = list(fieldnames)
self.fieldnames = fieldnames # list of keys for the dict
self.restval = restval # for writing short dicts
- if extrasaction.lower() not in ("raise", "ignore"):
+ extrasaction = extrasaction.lower()
+ if extrasaction not in ("raise", "ignore"):
raise ValueError("extrasaction (%s) must be 'raise' or 'ignore'"
% extrasaction)
self.extrasaction = extrasaction