#16306: report only the first unknown option and add more tests.  Patch by Serhiy Storchaka.
diff --git a/Python/getopt.c b/Python/getopt.c
index 037aa5d..5cf4cbd 100644
--- a/Python/getopt.c
+++ b/Python/getopt.c
@@ -45,7 +45,7 @@
 
 void _PyOS_ResetGetOpt(void)
 {
-    _PyOS_opterr = 0;  /* prevent printing the error in 2nd loop in main.c */
+    _PyOS_opterr = 1;
     _PyOS_optind = 1;
     _PyOS_optarg = NULL;
     opt_ptr = L"";