diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-11-19 13:16:20 -0500 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-11-19 13:16:20 -0500 |
commit | fb099c9ef134166ecaf3905c0d8b2995245f3ded (patch) | |
tree | 2f41745c93f1daaf0dbe505dc1ebf24227f63651 /Lib/csv.py | |
parent | #1098749: re-word gettext docs to not encourage using pygettext so much. (diff) | |
download | cpython-fb099c9ef134166ecaf3905c0d8b2995245f3ded.tar.gz cpython-fb099c9ef134166ecaf3905c0d8b2995245f3ded.tar.bz2 cpython-fb099c9ef134166ecaf3905c0d8b2995245f3ded.zip |
#19449: Handle non-string keys when generating 'fieldnames' error.
csv was handling non-string keys fine except for the error message
generated when a non-string key was not in 'fieldnames'.
Fix by Tomas Grahn, full patch-with-test by Vajrasky Kok (tweaked slightly).
Diffstat (limited to 'Lib/csv.py')
-rw-r--r-- | Lib/csv.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/csv.py b/Lib/csv.py index da3bc44e7ac..a56eed88c86 100644 --- a/Lib/csv.py +++ b/Lib/csv.py @@ -146,7 +146,7 @@ class DictWriter: wrong_fields = [k for k in rowdict if k not in self.fieldnames] if wrong_fields: raise ValueError("dict contains fields not in fieldnames: " - + ", ".join(wrong_fields)) + + ", ".join([repr(x) for x in wrong_fields])) return [rowdict.get(key, self.restval) for key in self.fieldnames] def writerow(self, rowdict): |