mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #18219: Optimize csv.DictWriter for large number of columns.
Patch by Mariatta Wijaya.
This commit is contained in:
parent
4510e6de9d
commit
0a421a28f8
4 changed files with 28 additions and 5 deletions
|
@ -145,7 +145,7 @@ class DictWriter:
|
|||
|
||||
def _dict_to_list(self, rowdict):
|
||||
if self.extrasaction == "raise":
|
||||
wrong_fields = [k for k in rowdict if k not in self.fieldnames]
|
||||
wrong_fields = rowdict.keys() - self.fieldnames
|
||||
if wrong_fields:
|
||||
raise ValueError("dict contains fields not in fieldnames: "
|
||||
+ ", ".join([repr(x) for x in wrong_fields]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue