title: How to tell if a class is abstract in Python 3?
body: <p>I wrote a metaclass that automatically registers its classes in a dict at runtime.  In order for it to work properly, it must be able to ignore abstract classes.</p>
  
  <p>The code works really well in Python 2, but I've run into a wall trying to make it compatible with Python 3.</p>
  
  <p>Here's what the code looks like currently:</p>
  
  
  
  <pre><code>def AutoRegister(registry, base_type=ABCMeta):
      class _metaclass(base_type):
          def __init__(self, what, bases=None, attrs=None):
              super(_metaclass, self).__init__(what, bases, attrs)
  
              # Do not register abstract classes.
              # Note that we do not use `inspect.isabstract` here, as
              #   that only detects classes with unimplemented abstract
              #   methods - which is a valid approach, but not what we
              #   want here.
              # :see: http://stackoverflow.com/a/14410942/
              metaclass = attrs.get('__metaclass__')
              if not (metaclass and issubclass(metaclass, ABCMeta)):
                  registry.register(self)
  
      return _metaclass
  </code></pre>
  
  <p>Usage in Python 2 looks like this:</p>
  
  
  
  <pre><code># Abstract classes; these are not registered.
  class BaseWidget(object):  __metaclass__ = AutoRegister(widget_registry)
  class BaseGizmo(BaseWidget): __metaclass__ = ABCMeta
  
  # Concrete classes; these get registered.
  class AlphaWidget(BaseWidget): pass
  class BravoGizmo(BaseGizmo): pass
  </code></pre>
  
  <p>What I can't figure out, though, is how to make this work in Python 3.</p>
  
  <p><em>How can a metaclass determine if it is initializing an abstract class in Python 3?</em></p>