Add error-checking to namedtuple's _replace() method.
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 34c3118..eaa823a 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -410,7 +410,10 @@
 
            def _replace(self, **kwds):
                'Return a new Point object replacing specified fields with new values'
-               return self.__class__._make(map(kwds.get, ('x', 'y'), self))
+               result = self.__class__._make(map(kwds.pop, ('x', 'y'), self))
+               if kwds:
+                   raise ValueError('Got unexpected field names: %r' % kwds.keys())
+               return result
 
            x = property(itemgetter(0))
            y = property(itemgetter(1))
diff --git a/Lib/collections.py b/Lib/collections.py
index 2a58b86..9985f93 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -78,7 +78,10 @@
             return {%(dicttxt)s} \n
         def _replace(self, **kwds):
             'Return a new %(typename)s object replacing specified fields with new values'
-            return self.__class__._make(map(kwds.get, %(field_names)r, self)) \n\n''' % locals()
+            result = self.__class__._make(map(kwds.pop, %(field_names)r, self))
+            if kwds:
+                raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
+            return result \n\n''' % locals()
     for i, name in enumerate(field_names):
         template += '        %s = property(itemgetter(%d))\n' % (name, i)
     if verbose:
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index c17b76d..dd9982a 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -55,6 +55,13 @@
         self.assertEqual(p._replace(x=1), (1, 22))                          # test _replace method
         self.assertEqual(p._asdict(), dict(x=11, y=22))                     # test _asdict method
 
+        try:
+            p._replace(x=1, error=2)
+        except ValueError:
+            pass
+        else:
+            self._fail('Did not detect an incorrect fieldname')
+
         # verify that field string can have commas
         Point = namedtuple('Point', 'x, y')
         p = Point(x=11, y=22)