registered = {}

class GObjectMeta(type):
    def __new__(cls, name, bases, dict):
        c = super().__new__(cls, name, bases, dict)
        qualname = '{}.{}'.format(c.__module__, c.__qualname__)
        if qualname in registered:
            print(cls, qualname)
            c = type(name, (registered[qualname], c), {})
        return c

def register(name):
    def decorator(cls):
        registered[name] = cls
        return cls
    return decorator

registered = {}
created = {}

class GObjectMeta(type):
    def __new__(cls, name, bases, dict):
        c = super().__new__(cls, name, bases, dict)

        # Do not handle classes that are already decorated
        if c.__module__.startswith('<meta>'):
            return c

        # Fullname of the class (base module + qualified name)
        fullname = '{}.{}'.format(c.__module__, c.__qualname__)

        # Decorate registered classes
        if fullname in registered:
            print(cls, fullname)
            c = type(name,
                     (registered[fullname], c),
                     {'__module__': '<meta>.{}'.format(fullname)})

        # Set fullname, save class and return
        c.__fullname__ = fullname
        created[fullname] = c
        return c

def register(name):
    def decorator(cls):
        registered[name] = cls
        return cls
    return decorator

Add __fullname__ attribute on all game classes
Add __fullname__ attribute on all game classes

  registered = {}
+ created = {}
  
  class GObjectMeta(type):
      def __new__(cls, name, bases, dict):
          c = super().__new__(cls, name, bases, dict)
+ 
+         # Do not handle classes that are already decorated
+         if c.__module__.startswith('<meta>'):
+             return c
+ 
+         # Fullname of the class (base module + qualified name)
-         qualname = '{}.{}'.format(c.__module__, c.__qualname__)
+         fullname = '{}.{}'.format(c.__module__, c.__qualname__)
+ 
+         # Decorate registered classes
-         if qualname in registered:
+         if fullname in registered:
-             print(cls, qualname)
+             print(cls, fullname)
-             c = type(name, (registered[qualname], c), {})
+             c = type(name,
+                      (registered[fullname], c),
+                      {'__module__': '<meta>.{}'.format(fullname)})
+ 
+         # Set fullname, save class and return
+         c.__fullname__ = fullname
+         created[fullname] = c
          return c
  
  def register(name):
      def decorator(cls):
          registered[name] = cls
          return cls
      return decorator
  
Add __fullname__ attribute on all game classes
## Code Before:
registered = {}

class GObjectMeta(type):
    def __new__(cls, name, bases, dict):
        c = super().__new__(cls, name, bases, dict)
        qualname = '{}.{}'.format(c.__module__, c.__qualname__)
        if qualname in registered:
            print(cls, qualname)
            c = type(name, (registered[qualname], c), {})
        return c

def register(name):
    def decorator(cls):
        registered[name] = cls
        return cls
    return decorator

## Instruction:
Add __fullname__ attribute on all game classes
## Code After:
registered = {}
created = {}

class GObjectMeta(type):
    def __new__(cls, name, bases, dict):
        c = super().__new__(cls, name, bases, dict)

        # Do not handle classes that are already decorated
        if c.__module__.startswith('<meta>'):
            return c

        # Fullname of the class (base module + qualified name)
        fullname = '{}.{}'.format(c.__module__, c.__qualname__)

        # Decorate registered classes
        if fullname in registered:
            print(cls, fullname)
            c = type(name,
                     (registered[fullname], c),
                     {'__module__': '<meta>.{}'.format(fullname)})

        # Set fullname, save class and return
        c.__fullname__ = fullname
        created[fullname] = c
        return c

def register(name):
    def decorator(cls):
        registered[name] = cls
        return cls
    return decorator
