Commit 2a7e9ed0 authored by gsamain's avatar gsamain

Let Symbol Table handle Cypclass types

parent d4701827
......@@ -17,7 +17,7 @@ from .Errors import warning, error, InternalError
from .StringEncoding import EncodedString
from . import Options, Naming
from . import PyrexTypes
from .PyrexTypes import py_object_type, unspecified_type
from .PyrexTypes import py_object_type, cy_object_type, unspecified_type
from .TypeSlots import (
pyfunction_signature, pymethod_signature, richcmp_special_methods,
get_special_method_signature, get_property_accessor_signature)
......@@ -601,7 +601,7 @@ class Scope(object):
def declare_cpp_class(self, name, scope,
pos, cname = None, base_classes = (),
visibility = 'extern', templates = None):
visibility = 'extern', templates = None, cypclass=0):
if cname is None:
if self.in_cinclude or (visibility != 'private'):
cname = name
......@@ -610,8 +610,12 @@ class Scope(object):
base_classes = list(base_classes)
entry = self.lookup_here(name)
if not entry:
type = PyrexTypes.CppClassType(
name, scope, cname, base_classes, templates = templates)
if cypclass:
type = PyrexTypes.CypClassType(
name, scope, cname, base_classes, templates = templates)
else:
type = PyrexTypes.CppClassType(
name, scope, cname, base_classes, templates = templates)
entry = self.declare_type(name, type, pos, cname,
visibility = visibility, defining = scope is not None)
self.sue_entries.append(entry)
......@@ -639,7 +643,7 @@ class Scope(object):
def declare_inherited_attributes(entry, base_classes):
for base_class in base_classes:
if base_class is PyrexTypes.error_type:
if base_class is PyrexTypes.error_type or base_class is PyrexTypes.cy_object_type:
continue
if base_class.scope is None:
error(pos, "Cannot inherit from incomplete type")
......@@ -2465,6 +2469,8 @@ class CppClassScope(Scope):
type.return_type = PyrexTypes.c_void_type
if name in ('<init>', '<del>') and type.nogil:
for base in self.type.base_classes:
if base is cy_object_type:
continue
base_entry = base.scope.lookup(name)
if base_entry and not base_entry.type.nogil:
error(pos, "Constructor cannot be called without GIL unless all base constructors can also be called without GIL")
......
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