Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9dba93

Browse files
committed
Revert copy.replace() to raise ValueError for unkown fields for namedtuples
1 parent c4655ca commit a9dba93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/collections/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def _make(cls, iterable):
457457
def _replace(self, /, **kwds):
458458
result = self._make(_map(kwds.pop, field_names, self))
459459
if kwds:
460-
raise TypeError(f'Got unexpected field name(s): {list(kwds)!r}')
460+
raise ValueError(f'Got unexpected field name(s): {list(kwds)!r}')
461461
return result
462462

463463
_replace.__doc__ = (f'Return a new {typename} object replacing specified '

0 commit comments

Comments
 (0)