Skip to content

Commit 667c9a2

Browse files
committed
correcting deletions
1 parent 02b645d commit 667c9a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/csv.py

+5
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ def __next__(self):
130130
return d
131131

132132
__class_getitem__ = classmethod(types.GenericAlias)
133+
133134
class DictWriter:
134135
def __init__(self, f, fieldnames, restval="", extrasaction="raise",
135136
dialect="excel", *args, **kwds):
137+
if fieldnames is not None and iter(fieldnames) is fieldnames:
138+
fieldnames = list(fieldnames)
136139
self.fieldnames = fieldnames # list of keys for the dict
137140
self.restval = restval # for writing short dicts
138141
if extrasaction.lower() not in ("raise", "ignore"):
@@ -158,6 +161,8 @@ def writerow(self, rowdict):
158161

159162
def writerows(self, rowdicts):
160163
return self.writer.writerows(map(self._dict_to_list, rowdicts))
164+
165+
__class_getitem__ = classmethod(types.GenericAlias)
161166

162167
# Guard Sniffer's type checking against builds that exclude complex()
163168
try:

0 commit comments

Comments
 (0)