title: TypeError: issubclass() arg 1 must be a class, while I am quite sure arg 1 is a class
body: <p>Somewhere within my code I have the following line of code.</p>
  <pre class="lang-py prettyprint-override"><code>from inspect import isclass
  
  if isclass(route.handler) and issubclass(route.handler, web.View):
  </code></pre>
  <p>Unfortunately this line of code gives the exception below in my production environment.</p>
  <pre class="lang-py prettyprint-override"><code>TypeError: issubclass() arg 1 must be a class
  </code></pre>
  <p>As far as I know, the Python (3.7.7) compiler will first check the first condition of the <code>if</code> statement and if this evaluates to <code>false</code>, it will not check the second condition. Therefore I must conclude that <code>route.handler</code> must be a class, and therefore the <code>TypeError</code> I am getting should not be occurring. Am I missing something here? Does someone know what might be causing this?</p>
  <p>(Unfortunately I am not able to reproduce the error)</p>
  <p>edit:</p>
  <p>The error originates from the <code>swagger-aiohttp</code> package. Here's the entire traceback:</p>
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File &quot;/var/www/app/main.py&quot;, line 249, in &lt;module&gt;
      run_app(cfg)
    File &quot;/var/www/app/main.py&quot;, line 225, in run_app
      setup_swagger(app, ui_version=SWAGGER_VERSION, swagger_url=SWAGGER_URL)
    File &quot;/home/webapp/.venv/lib/python3.7/site-packages/aiohttp_swagger/__init__.py&quot;, line 72, in setup_swagger
      security_definitions=security_definitions
    File &quot;/home/webapp/.venv/lib/python3.7/site-packages/aiohttp_swagger/helpers/builders.py&quot;, line 163, in generate_doc_from_each_end_point
      end_point_doc = _build_doc_from_func_doc(route)
    File &quot;/home/webapp/.venv/lib/python3.7/site-packages/aiohttp_swagger/helpers/builders.py&quot;, line 44, in _build_doc_from_func_doc
      if isclass(route.handler) and issubclass(route.handler, web.View):
    File &quot;/home/webapp/.venv/lib/python3.7/abc.py&quot;, line 143, in __subclasscheck__
      return _abc_subclasscheck(cls, subclass)
  TypeError: issubclass() arg 1 must be a class
  </code></pre>
  <p>edit2:</p>
  <p>The <code>route.handler</code> should be an <code>aiohttp</code> class-based view. For example this is how one would create one and build a swagger UI on top of that.</p>
  <pre class="lang-py prettyprint-override"><code>class PingHandler(web.View):
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
  
      async def get(request):
          &quot;&quot;&quot;
          ---
          description: This end-point allow to test that service is up.
          tags:
          - Health check
          produces:
          - text/plain
          responses:
              &quot;200&quot;:
                  description: successful operation. Return &quot;pong&quot; text
              &quot;405&quot;:
                  description: invalid HTTP Method
          &quot;&quot;&quot;
          return web.Response(text=&quot;pong&quot;)
  
  app = web.Application()
  app.router.add_route('GET', &quot;/ping&quot;, PingHandler)
  
  setup_swagger(app, swagger_url=&quot;/api/v1/doc&quot;, ui_version=3)
  </code></pre>
  <p>In my current implementation I also have a decorator added to the Handler class.</p>
  <p>edit3:</p>
  <p>When debugging locally (where it's working fine), the route.handler seems to be a <code>&lt;class 'abc.ABCMeta'&gt;</code>.</p>