bpo-37417: Fix error handling in bytearray.extend. (GH-14407)

diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index c684db7..1bb19a9 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1698,6 +1698,10 @@
     }
     Py_DECREF(bytearray_obj);
 
+    if (PyErr_Occurred()) {
+        return NULL;
+    }
+
     Py_RETURN_NONE;
 }