nebius/SWE-bench-extra huggingface dataset:
Repository: aio-libs/aiocache

Issue:
Cache.REDIS: issubclass() arg 1 must be a class
In trying https://stackoverflow.com/questions/65686318/sharing-python-objects-across-multiple-workers I've encountered this exception.

Seems hit same issue here: https://github.com/samuelcolvin/pydantic/issues/545#issuecomment-595983173

From docker stderr:
```
app_1    |   File "/app/./main.py", line 8, in <module>
app_1    |     cache = Cache(Cache.REDIS, endpoint="localhost", port=6379, namespace="main")
app_1    |   File "/usr/local/lib/python3.8/site-packages/aiocache/factory.py", line 65, in __new__
app_1    |     assert issubclass(cache_class, BaseCache)
app_1    | TypeError: issubclass() arg 1 must be a class
```

REPL:

```
>>> from aiocache import Cache
ujson module not found, using json
msgpack not installed, MsgPackSerializer unavailable
>>> Cache()
<aiocache.backends.memory.SimpleMemoryCache object at 0x1085fd820>
>>> Cache(Cache.REDIS)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/variant23/repos/mintad-validator/venv/lib/python3.8/site-packages/aiocache/factory.py", line 65, in __new__
    assert issubclass(cache_class, BaseCache)
TypeError: issubclass() arg 1 must be a class
>>> type(Cache.REDIS)
<class 'NoneType'>
>>> print(Cache.REDIS)
None
>>> print(Cache.MEMORY)
<class 'aiocache.backends.memory.SimpleMemoryCache'>
```

Packages:

```
aiocache==0.11.1
fastapi==0.65.1
pydantic==1.8.2
```



Comments:

Patch:
diff --git a/aiocache/factory.py b/aiocache/factory.py
index 9ad2f98..ec674fd 100644
--- a/aiocache/factory.py
+++ b/aiocache/factory.py
@@ -60,7 +60,7 @@ class Cache:
     MEMCACHED = AIOCACHE_CACHES.get("memcached")
 
     def __new__(cls, cache_class=MEMORY, **kwargs):
-        if not issubclass(cache_class, BaseCache):
+        if not (cache_class and issubclass(cache_class, BaseCache)):
             raise InvalidCacheType(
                 "Invalid cache type, you can only use {}".format(list(AIOCACHE_CACHES.keys()))
             )


Test patch:
diff --git a/tests/ut/test_factory.py b/tests/ut/test_factory.py
index 56de47e..54120e9 100644
--- a/tests/ut/test_factory.py
+++ b/tests/ut/test_factory.py
@@ -74,9 +74,10 @@ class TestCache:
     def test_new_defaults_to_memory(self):
         assert isinstance(Cache(), Cache.MEMORY)
 
-    def test_new_invalid_cache_raises(self):
+    @pytest.mark.parametrize("cache_type", (None, object))
+    def test_new_invalid_cache_raises(self, cache_type):
         with pytest.raises(InvalidCacheType) as e:
-            Cache(object)
+            Cache(cache_type)
         assert str(e.value) == "Invalid cache type, you can only use {}".format(
             list(AIOCACHE_CACHES.keys())
         )