Commit 5f13fdb2 authored by Gregory Ewing's avatar Gregory Ewing

Base class not needed in forward extension class declaration


+
+Enhancements:
+
+    - It is no longer necessary to specify the base class of an
+        extension type in a forward declaration. Also, if the class is
+        defined in a .pxd file, the base class only needs to be specified
+        in the .pxd file, not the .pyx file.
+        [Arc Riley]
-
parent 4c4f6bdb
...@@ -912,11 +912,16 @@ class ModuleScope(Scope): ...@@ -912,11 +912,16 @@ class ModuleScope(Scope):
if entry: if entry:
type = entry.type type = entry.type
if not (entry.is_type and type.is_extension_type): if not (entry.is_type and type.is_extension_type):
entry = None # Will cause an error when we redeclare it entry = None # Will cause redeclaration and produce an error
else: else:
scope = type.scope
if typedef_flag and scope.defined:
self.check_previous_typedef_flag(entry, typedef_flag, pos) self.check_previous_typedef_flag(entry, typedef_flag, pos)
if base_type != type.base_type: if (scope and scope.defined) or (base_type and type.base_type):
if base_type and base_type is not type.base_type:
error(pos, "Base type does not match previous declaration") error(pos, "Base type does not match previous declaration")
if base_type and not type.base_type:
type.base_type = base_type
# #
# Make a new entry if needed # Make a new entry if needed
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment