Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
cba8fe49
Commit
cba8fe49
authored
Dec 04, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support ext type inheritance from builtin types
parent
5646b808
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+8
-1
No files found.
Cython/Compiler/ModuleNode.py
View file @
cba8fe49
...
@@ -1996,7 +1996,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1996,7 +1996,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def
generate_base_type_import_code
(
self
,
env
,
entry
,
code
):
def
generate_base_type_import_code
(
self
,
env
,
entry
,
code
):
base_type
=
entry
.
type
.
base_type
base_type
=
entry
.
type
.
base_type
if
base_type
and
base_type
.
module_name
!=
env
.
qualified_name
:
if
base_type
and
base_type
.
module_name
!=
env
.
qualified_name
\
and
not
base_type
.
is_builtin_type
:
self
.
generate_type_import_code
(
env
,
base_type
,
self
.
pos
,
code
)
self
.
generate_type_import_code
(
env
,
base_type
,
self
.
pos
,
code
)
def
use_type_import_utility_code
(
self
,
env
):
def
use_type_import_utility_code
(
self
,
env
):
...
...
Cython/Compiler/Nodes.py
View file @
cba8fe49
...
@@ -3192,7 +3192,9 @@ class CClassDefNode(ClassDefNode):
...
@@ -3192,7 +3192,9 @@ class CClassDefNode(ClassDefNode):
if
base_class_entry
:
if
base_class_entry
:
if
not
base_class_entry
.
is_type
:
if
not
base_class_entry
.
is_type
:
error
(
self
.
pos
,
"'%s' is not a type name"
%
self
.
base_class_name
)
error
(
self
.
pos
,
"'%s' is not a type name"
%
self
.
base_class_name
)
elif
not
base_class_entry
.
type
.
is_extension_type
:
elif
not
base_class_entry
.
type
.
is_extension_type
and
\
not
(
base_class_entry
.
type
.
is_builtin_type
and
\
base_class_entry
.
type
.
objstruct_cname
):
error
(
self
.
pos
,
"'%s' is not an extension type"
%
self
.
base_class_name
)
error
(
self
.
pos
,
"'%s' is not an extension type"
%
self
.
base_class_name
)
elif
not
base_class_entry
.
type
.
is_complete
():
elif
not
base_class_entry
.
type
.
is_complete
():
error
(
self
.
pos
,
"Base class '%s' of type '%s' is incomplete"
%
(
error
(
self
.
pos
,
"Base class '%s' of type '%s' is incomplete"
%
(
...
...
Cython/Compiler/PyrexTypes.py
View file @
cba8fe49
...
@@ -380,10 +380,17 @@ class BuiltinObjectType(PyObjectType):
...
@@ -380,10 +380,17 @@ class BuiltinObjectType(PyObjectType):
base_type
=
None
base_type
=
None
module_name
=
'__builtin__'
module_name
=
'__builtin__'
# fields that let it look like an extension type
vtabslot_cname
=
None
vtabstruct_cname
=
None
vtabptr_cname
=
None
typedef_flag
=
True
is_external
=
True
def
__init__
(
self
,
name
,
cname
,
objstruct_cname
=
None
):
def
__init__
(
self
,
name
,
cname
,
objstruct_cname
=
None
):
self
.
name
=
name
self
.
name
=
name
self
.
cname
=
cname
self
.
cname
=
cname
self
.
typeptr_cname
=
"
&"
+
cname
self
.
typeptr_cname
=
"
(&%s)"
%
cname
self
.
objstruct_cname
=
objstruct_cname
self
.
objstruct_cname
=
objstruct_cname
def
set_scope
(
self
,
scope
):
def
set_scope
(
self
,
scope
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment