#16336: fix input checking in the surrogatepass error handler.  Patch by Serhiy Storchaka.
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 42d0da3..0f7c23e 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -647,6 +647,8 @@
         self.assertTrue(codecs.lookup_error("surrogatepass"))
         with self.assertRaises(UnicodeDecodeError):
             b"abc\xed\xa0".decode("utf-8", "surrogatepass")
+        with self.assertRaises(UnicodeDecodeError):
+            b"abc\xed\xa0z".decode("utf-8", "surrogatepass")
 
 class UTF7Test(ReadTest):
     encoding = "utf-7"