Issue #23661: unittest.mock side_effects can now be exceptions again.

This was a regression vs Python 3.4. Patch from Ignacio Rossi
diff --git a/NEWS b/NEWS
index 2aa442a..90fdb0e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- Issue #23661: unittest.mock side_effects can now be exceptions again. This
+  was a regression vs Python 3.4. Patch from Ignacio Rossi
+
 - Issue #23310: Fix MagicMock's initializer to work with __methods__, just
   like configure_mock().  Patch by Kasia Jachim.
 
diff --git a/mock/mock.py b/mock/mock.py
index 269f17d..c4da6d0 100644
--- a/mock/mock.py
+++ b/mock/mock.py
@@ -644,7 +644,8 @@
         if delegated is None:
             return self._mock_side_effect
         sf = delegated.side_effect
-        if sf is not None and not callable(sf) and not isinstance(sf, _MockIter):
+        if (sf is not None and not callable(sf)
+                and not isinstance(sf, _MockIter) and not _is_exception(sf)):
             sf = _MockIter(sf)
             delegated.side_effect = sf
         return sf
diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py
index 17e7999..4ddef33 100644
--- a/mock/tests/testmock.py
+++ b/mock/tests/testmock.py
@@ -198,6 +198,15 @@
         self.assertEqual([mock(), mock(), mock()], [3, 2, 1],
                           "callable side effect not used correctly")
 
+    def test_autospec_side_effect_exception(self):
+        # Test for issue 23661
+        def f():
+            pass
+
+        mock = create_autospec(f)
+        mock.side_effect = ValueError('Bazinga!')
+        self.assertRaisesRegex(ValueError, 'Bazinga!', mock)
+
     @unittest.skipUnless('java' in sys.platform,
                           'This test only applies to Jython')
     def test_java_exception_side_effect(self):